Community
Participate
Working Groups
The following should raise an error on the foo() method, but does not: import org.aspectj.lang.annotation.DeclareWarning; import org.aspectj.lang.annotation.Aspect; @Aspect public aspect A { @DeclareWarning("execution(void *.foo(..))") static final String h = "barf"; void foo() { } } The following does work as expected: import org.aspectj.lang.annotation.DeclareWarning; import org.aspectj.lang.annotation.Aspect; @Aspect public class A { @DeclareWarning("execution(void *.foo(..))") static final String h = "barf"; void foo() { } } so it seems like it is not possibleto mix @AspectJ style declares in code style aspects.
this was actually policed by the compiler to behave in this way. I've changed it to allow it - I am concerned a little about performance but we do seem to check the constant pool for references to any kind of annotation before doing a detailed analysis of whether every method is a pointcut or an advice or deow, etc. it is not common to mix things up in this way, in fact I'd have thought the other way round was more likely (@Aspect on the class then code style syntax inside, as that may keep other parts of JDT happier whilst you are editing a mostly regular class).