Community
Participate
Working Groups
build I20050219 + jdtcore head 1) create p/Annot.java package p; public @interface Annot { String foo1() default ""; } 2) create p2/X.java package p2; import p.Annot; @Annot(foo1=zzz) public class X { static final String zzz = ""; } 3) compile there is no error but javac found an error p2\X.java:5: cannot find symbol symbol: variable zzz @Annot(foo1=zzz) ^ 1 error
It appears that zzz needs to be qualified. @Annot(foo1=X.zzz) public class X { static final String zzz = ""; } compiles fine with javac.
similar bug with qualification and private field. @Annot(foo1=X.zzz) public class X { private static final String zzz = ""; } javac found an error and not jdt compiler p2\X.java:5: zzz has private access in p2.X @Annot(foo1=X.zzz) ^ 1 error
Added AnnotationTest#test112 & test114 & test115. Introduced MethodScope#insideTypeAnnotation to be able to exclude offending constructs (type, method and field) from lookup algorithm. Curiously, javac allows resolving method annotation to method type parameters or parameters; which sounds inconsistent; which we also allow as well. Fixed
*** Bug 88506 has been marked as a duplicate of this bug. ***
Verified in I20050330-0500