Community
Participate
Working Groups
When compiling the following code public class Foo { protected enum E { E1, E2 } protected @interface AnnoE { E value(); } @AnnoE(true ? E.E1 : E.E2) public void foo() {} } Eclipse does not produce an error, but javac 1.6 does: Foo.java:8: an enum annotation value must be an enum constant @AnnoE(true ? E.E1 : E.E2) ^ I suspect this has to do with whether the result of the expression (true ? E.E1 : E.E2) is considered an enum constant, and I am not sure whether this is a javac bug or an Eclipse bug.
This is an Eclipse bug.
Created attachment 123732 [details] Proposed patch
Released for 3.5M5. We had it wrong since day 1; so not a regression we have to fix for 3.4.2 (also our codegen did eliminate the offending annotation silently already).
Created attachment 123762 [details] Complement In case the annotation cannot be generated, we should not leave unused strings in the constant pool. This patch properly resets the constant pool in this case.
(In reply to comment #4) > Created an attachment (id=123762) [details] > Complement > > In case the annotation cannot be generated, we should not leave unused strings > in the constant pool. This patch properly resets the constant pool in this > case. > This is unclear whether this complement was released in HEAD stream or not.
(In reply to comment #5) > (In reply to comment #4) > > Created an attachment (id=123762) [details] [details] > > Complement > > > This is unclear whether this complement was released in HEAD stream or not. > I verified that this change was also released in HEAD. So, the complete fix will be available in next I-build (I20090128-0100).
Verified for 3.5M5 using build I20090127-2000.
(In reply to Olivier Thomann from comment #4) > Created attachment 123762 [details] [diff] > Complement > > In case the annotation cannot be generated, we should not leave unused > strings in the constant pool. This patch properly resets the constant pool > in this case. For posterity: this Complement caused bug 504031 and will be reverted.