Community
Participate
Working Groups
Build ID: 1.5.4.200701151324 Steps To Reproduce: I am using AJDT 1.5M7 (including AspectJ 1.5.4.200701151324) and Eclipse 3.3RC1. To reproduce the bug, use the following aspect and class: ================== public aspect Aspect1 { pointcut pc() : call(* *(..)) && if(0==0) && args(Type[]); } public class Main { public static void main(String[] args) throws Exception { Class clazz = Class.forName("Aspect1"); System.out.println("Methods:"); Method[] methods = clazz.getDeclaredMethods(); for(int i = 0; i < methods.length; i++) { if(methods[i].getAnnotations().length == 0) continue; System.out.println(methods[i]); printAnnotations(methods[i].getAnnotations()); } } private static void printAnnotations(Annotation[] annotations) { for(int i = 0; i < annotations.length; i++) { System.out.println(annotations[i]); } } } ============= The output is something like: Methods: void Aspect1.ajc$pointcut$$pc$6f() @org.aspectj.lang.annotation.Pointcut(argNames=, value=(call(* *(..)) && (if(void java.lang.Object.if_()) && args(Type)))) The method "Object.if_()" does not exist and the pointcut designator "if" should rather contain the signature of the method that has been generated from the "if"-expression ("0==0" in the example). In my test run, the method "ajc$if_112()Z" has been generated, thus I would expect to see if(boolean Aspect1.ajc$if_113()) in the annotation. And the last pointcut designator "args" shows that the argument type should be "Type", however, in the pointcut definition it was said that the argument type has to be the array type Type[]. Consequently, it should be: args(Type[]) More information:
you might have more luck grabbing the PointcutDeclaration classfile attribute which retains more info than the annotation. However, I know you cannot do this without picking the classfile apart since it isnt as readily available as the annotation - i'm just thinking of what you can do if this does not get addressed in the short term. Having the annotation contain unhelpful information isn't good - but it isn't breaking anything at the moment. Right now the annotation is built before the name of the if() method is worked out so that would all have to be addressed.