Bug 449739

Summary: Improve is() pointcut to support class modifiers like 'final'
Product: [Tools] AspectJ Reporter: Alexander Kriegisch <Alexander>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aclement
Version: 1.8.3   
Target Milestone: 1.8.4   
Hardware: PC   
OS: Windows NT   
Whiteboard:

Description Alexander Kriegisch CLA 2014-11-03 07:09:55 EST
The original intent of https://bugs.eclipse.org/bugs/show_bug.cgi?id=44365 was to support matching class modifiers like final, protected etc. This was not achived by the is() pointcut.

One prominent use case for my suggestion would be Spring AOP users wishing to exclude final types from weaving because Spring uses dynamic CGLIB proxies which cannot extend final types.

It would be nice if I could write something like:

execution(public * *(..))
    && !within(is(EnumType))
    && !within(is(FinalType))

Would it be hard to add support for class modifiers that way? I think it would come in handy sometimes. I am not going as far as wanting support for my favourite variant of direct modifier support is AspectJ pointcut syntax, e.g.:

execution(public * (!final *).*(..))
or
!within(final *)

That would be even better, but I am trying not to be too greedy. ;-)
Comment 1 Andrew Clement CLA 2014-11-05 11:28:38 EST
Implemented with tests, is(FinalType) now supported from 1.8.4 onwards.
Comment 2 Alexander Kriegisch CLA 2014-11-05 14:18:02 EST
Thank you very much, Andy. Blazingly fast! Looking forward to 1.8.4, changeset looks good (untested).

For reference: http://git.eclipse.org/c/aspectj/org.aspectj.git/commit/?id=11fba64f400694713cc6571c97e194eaf3b99f40