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 112454 Details for
Bug 227527
[1.5][compiler] Useless error message for local enum
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch with testcase
patch.txt (text/plain), 6.25 KB, created by
Kent Johnson
on 2008-09-12 14:27:17 EDT
(
hide
)
Description:
Proposed patch with testcase
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2008-09-12 14:27:17 EDT
Size:
6.25 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/core/compiler/IProblem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java,v >retrieving revision 1.204 >diff -u -r1.204 IProblem.java >--- compiler/org/eclipse/jdt/core/compiler/IProblem.java 26 Aug 2008 11:52:52 -0000 1.204 >+++ compiler/org/eclipse/jdt/core/compiler/IProblem.java 12 Sep 2008 18:21:19 -0000 >@@ -1247,7 +1247,8 @@ > int IllegalModifierForEnum = TypeRelated + 750; > /** @since 3.1 */ > int IllegalModifierForEnumConstant = FieldRelated + 751; >- /** @since 3.1 */ >+ /** @deprecated - problem could not be reported, enums cannot be local takes precedence >+ * @since 3.1 */ > int IllegalModifierForLocalEnum = TypeRelated + 752; > /** @since 3.1 */ > int IllegalModifierForMemberEnum = TypeRelated + 753; >Index: compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties,v >retrieving revision 1.240 >diff -u -r1.240 messages.properties >--- compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 9 Sep 2008 16:39:21 -0000 1.240 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 12 Sep 2008 18:21:19 -0000 >@@ -572,7 +572,7 @@ > ### ENUMS > 750 = Illegal modifier for the enum {0}; only public is permitted > 751 = Illegal modifier for the enum constant {0}; no modifier is allowed >-752 = Illegal modifier for the local enum {0}; only abstract is permitted >+###[obsolete] 752 = Illegal modifier for the local enum {0}; only abstract is permitted > 753 = Illegal modifier for the member enum {0}; only public, protected, private & static are permitted > 754 = The enum {1} already defines the method {0}({2}) implicitly > 755 = The enum constant {0}.{1} reference cannot be qualified in a case label >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.378 >diff -u -r1.378 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 12 Sep 2008 15:55:52 -0000 1.378 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 12 Sep 2008 18:21:19 -0000 >@@ -2185,15 +2185,6 @@ > type.sourceStart(), > type.sourceEnd()); > } >-public void illegalModifierForLocalEnum(SourceTypeBinding type) { >- String[] arguments = new String[] {new String(type.sourceName())}; >- this.handle( >- IProblem.IllegalModifierForLocalEnum, >- arguments, >- arguments, >- type.sourceStart(), >- type.sourceEnd()); >-} > public void illegalModifierForMemberClass(SourceTypeBinding type) { > String[] arguments = new String[] {new String(type.sourceName())}; > this.handle( >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java,v >retrieving revision 1.161 >diff -u -r1.161 ClassScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 27 Jun 2008 16:04:01 -0000 1.161 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 12 Sep 2008 18:21:19 -0000 >@@ -490,10 +490,8 @@ > // modifiers &= ~(realModifiers & UNEXPECTED_MODIFIERS); > // realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag; > } >- } else if (sourceType.isLocalType()) { // each enum constant is an anonymous local type >- final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccFinal | ClassFileConstants.AccEnum); // add final since implicitly set for anonymous type >- if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) >- problemReporter().illegalModifierForLocalEnum(sourceType); >+ } else if (sourceType.isLocalType()) { >+ // each enum constant is an anonymous local type and its modifiers were already checked as an enum constant field > } else { > final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccStrictfp | ClassFileConstants.AccEnum); > if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java,v >retrieving revision 1.129 >diff -u -r1.129 EnumTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 14 Aug 2008 17:34:25 -0000 1.129 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 12 Sep 2008 18:21:20 -0000 >@@ -196,19 +196,27 @@ > " \n" + > " public BLEU, \n" + > " transient BLANC, \n" + >- " ROUGE\n" + >+ " ROUGE, \n" + >+ " abstract RED {\n" + >+ " void test() {}\n" + >+ " }\n" + > "}" > }, > "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " public BLEU, \n" + >- " ^^^^\n" + >- "Illegal modifier for the enum constant BLEU; no modifier is allowed\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 4)\n" + >- " transient BLANC, \n" + >- " ^^^^^\n" + >- "Illegal modifier for the enum constant BLANC; no modifier is allowed\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " public BLEU, \n" + >+ " ^^^^\n" + >+ "Illegal modifier for the enum constant BLEU; no modifier is allowed\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 4)\n" + >+ " transient BLANC, \n" + >+ " ^^^^^\n" + >+ "Illegal modifier for the enum constant BLANC; no modifier is allowed\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 6)\n" + >+ " abstract RED {\n" + >+ " ^^^\n" + >+ "Illegal modifier for the enum constant RED; no modifier is allowed\n" + > "----------\n"); > } > // check using an enum constant
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 227527
: 112454