Summary: | [1.5][compiler] Annotation attribute should be able to reference field | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Frederic Fusier <frederic_fusier> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | CLOSED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 3.1 | ||
Target Milestone: | 3.1 RC2 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Frederic Fusier
2005-05-27 10:54:29 EDT
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 |