This comment has been minimized.

Consider a class C, the pointcut target(org.xyz.SomeInterface), and the execution join point for some method in C.

When AspectJ evaluates whether or not the pointcut can match such a join point, it says "maybe". The reason is that someone may later introduce a new type

class D extends C implements SomeInterface { ... }

and if the method declared in C executes for an instance of D, then the join point should be matched.

However... in Spring, we know the exact type of the bean, and there is no chance that a subtype will be introduced later on. Therefore, we should optimize matching in this case, so that we don't create proxies that will never actually have any work to do at runtime.

The one caveat to this is the declare parents construct, which can introduce additional interfaces to a bean. We need to ensure that this() and target() pcds still continue to match on interfaces that are introduced via a declare parents construct.

This comment has been minimized.

Fix committed to head. I had to add an "IntroductionAwareMethodMatcher" to take into account declare parents constructs. The solution is somewhat ugly because it needs some information not available in the public AspectJ tools API. AspectJ enhancement request 151593 has been raised to cover this, and the Spring solution can be improved once AspectJ provides the needed public API.