Bug 449739 - Improve is() pointcut to support class modifiers like 'final'
Summary: Improve is() pointcut to support class modifiers like 'final'
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.3   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: 1.8.4   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-03 07:09 EST by Alexander Kriegisch CLA
Modified: 2014-11-05 14:18 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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