Community
Participate
Working Groups
Open this bug to address unexpected compiler error for bug 89937 comment 1 test case...
Issue is: package p2; import p.Annot; public class X { void bar(){ @Annot(foo=zzz) final int zzz = 0; } } With a local variable the behavior is the opposite. Eclipse refuse the code and produce this error message: "The value for annotation attribute Annot.foo must be a constant expression". Javac compile this code with no error.
Problem comes from the fact the local variable constant did not get computed by the time the annotation is being resolved. Moved annotation resolution after constant computation. Added AnnotationTest#test149. Interestingly field cases are rejecting similar situations as illegal forward refs which feels like locals should be the same. Fixed
Verified for 3.1 RC2 using build N20050607-0010 + JDT/Core HEAD
Verified with I20050610-0010