Community
Participate
Working Groups
Discovered by Ramnivas, compiling this should fail: package example; import org.aspectj.lang.annotation.*; import java.util.Date; @Aspect public class Main { @Pointcut("execution(Date foo())") public void pc() {} @Before("pc()") public void log() {} } because although Date is imported, the reference is from a pointcut string. Compiling with javac then weaving later would not have worked, so ajc shouldn't work either.
quite complex to fix as other parts of the compiler are building a cache per source file of types they can easily see. Overriding this to say 'no, you cant see things via import' is not trivial, but I have an implementation that appears to work. So unqualified types in annotation style pointcuts will be resolved against types in the same package as the aspect declaration or types in java.lang I've only tested it for basic pointcuts - I wonder if all the other language constructs that use strings use the same route through the code? I worry they dont...