Hi,
This is a follow-up to the bug report "perthis inserts perObjectField to all compiled classes” [1] which was fixed in 2011 [2].
The class HasMemberTypePatternForPerThisMatching [1] implements a pessimistic heuristic when a perthis pointcut could possibly match a type. It works well in all but one context that is already described as a comment
in the file: ITDs. The comment claims that it is not possible to determine whether an added method matches the pointcut because the annotations cannot be retrieved. I guess this is still true because neither NewMethodTypeMunger itself nor the methods that
create instances of it add annotations.
I wonder how much effort it would be to change this. Eventually, of course, the annotations are determined when adding the method, in BcelTypeMunger. But it is quite complex and involes a few private methods. Do you think
it would be possible to move the annotation collecting to the creation of the NewMethodTypeMunger, so that HasMemberTypePatternForPerThisMatching can access them? Would it somehow fit into the architecture?
We’d really like to get rid of unnecessary fields introduced by the perthis() aspects, but I don’t want to waste time breaking the whole architecture just to fix this issue.
Thanks!
Jan
[1] https://github.com/eclipse/org.aspectj/commit/363c363afffc7152e96da039ef767db111bb8245
[2]
https://bugs.eclipse.org/bugs/show_bug.cgi?id=354470