Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 123732 Details for
Bug 262304
[1.5][compiler] Enum constant in annotation value: javac vs Eclipse differ
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
262304.txt (text/plain), 2.61 KB, created by
Philipe Mulet
on 2009-01-26 08:09:22 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2009-01-26 08:09:22 EST
Size:
2.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java,v >retrieving revision 1.36 >diff -u -r1.36 MemberValuePair.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java 12 Sep 2008 13:11:54 -0000 1.36 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java 26 Jan 2009 13:09:00 -0000 >@@ -192,6 +192,8 @@ > } > } > } >+ } else { >+ scope.problemReporter().annotationValueMustBeConstant(this.binding.declaringClass, this.name, this.value, true); > } > break checkAnnotationMethodType; > } >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java,v >retrieving revision 1.194 >diff -u -r1.194 AnnotationTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java 23 Jan 2009 15:05:53 -0000 1.194 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java 26 Jan 2009 13:09:03 -0000 >@@ -8792,4 +8792,36 @@ > "----------\n", > JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=262304 >+public void test268() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", // ================= >+ "public class X {\n" + >+ " protected enum E {\n" + >+ " E1, E2\n" + >+ " }\n" + >+ " protected @interface Anno1 { E value(); }\n" + >+ " protected @interface Anno2 { E value(); }\n" + >+ " protected @interface Anno3 { E value(); }\n" + >+ " @Anno1(true ? E.E1 : E.E2)\n" + >+ " @Anno2(bar())\n" + >+ " @Anno3(((E.E1)))\n" + >+ " public void foo() {\n" + >+ " }\n" + >+ " public E bar() { return E.E1; }\n" + >+ "}\n", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 8)\n" + >+ " @Anno1(true ? E.E1 : E.E2)\n" + >+ " ^^^^^^^^^^^^^^^^^^\n" + >+ "The value for annotation attribute X.Anno1.value must be an enum constant expression\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 9)\n" + >+ " @Anno2(bar())\n" + >+ " ^^^^^\n" + >+ "The value for annotation attribute X.Anno2.value must be an enum constant expression\n" + >+ "----------\n"); >+} > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 262304
: 123732 |
123762