View | Details | Raw Unified | Return to bug 227527
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (-1 / +2 lines)
Lines 1247-1253 Link Here
1247
	int IllegalModifierForEnum = TypeRelated + 750;
1247
	int IllegalModifierForEnum = TypeRelated + 750;
1248
	/** @since 3.1 */
1248
	/** @since 3.1 */
1249
	int IllegalModifierForEnumConstant = FieldRelated + 751;
1249
	int IllegalModifierForEnumConstant = FieldRelated + 751;
1250
	/** @since 3.1 */
1250
	/** @deprecated - problem could not be reported, enums cannot be local takes precedence 
1251
	 *   @since 3.1 */
1251
	int IllegalModifierForLocalEnum = TypeRelated + 752;
1252
	int IllegalModifierForLocalEnum = TypeRelated + 752;
1252
	/** @since 3.1 */
1253
	/** @since 3.1 */
1253
	int IllegalModifierForMemberEnum = TypeRelated + 753;
1254
	int IllegalModifierForMemberEnum = TypeRelated + 753;
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (-1 / +1 lines)
Lines 572-578 Link Here
572
### ENUMS
572
### ENUMS
573
750 = Illegal modifier for the enum {0}; only public is permitted
573
750 = Illegal modifier for the enum {0}; only public is permitted
574
751 = Illegal modifier for the enum constant {0}; no modifier is allowed
574
751 = Illegal modifier for the enum constant {0}; no modifier is allowed
575
752 = Illegal modifier for the local enum {0}; only abstract is permitted
575
###[obsolete] 752 = Illegal modifier for the local enum {0}; only abstract is permitted
576
753 = Illegal modifier for the member enum {0}; only public, protected, private & static are permitted
576
753 = Illegal modifier for the member enum {0}; only public, protected, private & static are permitted
577
754 = The enum {1} already defines the method {0}({2}) implicitly
577
754 = The enum {1} already defines the method {0}({2}) implicitly
578
755 = The enum constant {0}.{1} reference cannot be qualified in a case label
578
755 = The enum constant {0}.{1} reference cannot be qualified in a case label
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-9 lines)
Lines 2185-2199 Link Here
2185
		type.sourceStart(),
2185
		type.sourceStart(),
2186
		type.sourceEnd());
2186
		type.sourceEnd());
2187
}
2187
}
2188
public void illegalModifierForLocalEnum(SourceTypeBinding type) {
2189
	String[] arguments = new String[] {new String(type.sourceName())};
2190
	this.handle(
2191
		IProblem.IllegalModifierForLocalEnum,
2192
		arguments,
2193
		arguments,
2194
		type.sourceStart(),
2195
		type.sourceEnd());
2196
}
2197
public void illegalModifierForMemberClass(SourceTypeBinding type) {
2188
public void illegalModifierForMemberClass(SourceTypeBinding type) {
2198
	String[] arguments = new String[] {new String(type.sourceName())};
2189
	String[] arguments = new String[] {new String(type.sourceName())};
2199
	this.handle(
2190
	this.handle(
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java (-4 / +2 lines)
Lines 490-499 Link Here
490
//					modifiers &= ~(realModifiers & UNEXPECTED_MODIFIERS);
490
//					modifiers &= ~(realModifiers & UNEXPECTED_MODIFIERS);
491
//					realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag;
491
//					realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag;
492
				}
492
				}
493
			} else if (sourceType.isLocalType()) { // each enum constant is an anonymous local type
493
			} else if (sourceType.isLocalType()) {
494
				final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccFinal | ClassFileConstants.AccEnum); // add final since implicitly set for anonymous type
494
				// each enum constant is an anonymous local type and its modifiers were already checked as an enum constant field
495
				if ((realModifiers & UNEXPECTED_MODIFIERS) != 0)
496
					problemReporter().illegalModifierForLocalEnum(sourceType);
497
			} else {
495
			} else {
498
				final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccStrictfp | ClassFileConstants.AccEnum);
496
				final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccStrictfp | ClassFileConstants.AccEnum);
499
				if ((realModifiers & UNEXPECTED_MODIFIERS) != 0)
497
				if ((realModifiers & UNEXPECTED_MODIFIERS) != 0)
(-)src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java (-10 / +18 lines)
Lines 196-214 Link Here
196
			"	\n" +
196
			"	\n" +
197
			"	public BLEU, \n" +
197
			"	public BLEU, \n" +
198
			"	transient BLANC, \n" +
198
			"	transient BLANC, \n" +
199
			"	ROUGE\n" +
199
			"	ROUGE, \n" +
200
			"	abstract RED {\n" +
201
			"		void test() {}\n" +
202
			"	}\n" +
200
			"}"
203
			"}"
201
		},
204
		},
202
		"----------\n" +
205
		"----------\n" +
203
		"1. ERROR in X.java (at line 3)\n" +
206
		"1. ERROR in X.java (at line 3)\n" + 
204
		"	public BLEU, \n" +
207
		"	public BLEU, \n" + 
205
		"	       ^^^^\n" +
208
		"	       ^^^^\n" + 
206
		"Illegal modifier for the enum constant BLEU; no modifier is allowed\n" +
209
		"Illegal modifier for the enum constant BLEU; no modifier is allowed\n" + 
207
		"----------\n" +
210
		"----------\n" + 
208
		"2. ERROR in X.java (at line 4)\n" +
211
		"2. ERROR in X.java (at line 4)\n" + 
209
		"	transient BLANC, \n" +
212
		"	transient BLANC, \n" + 
210
		"	          ^^^^^\n" +
213
		"	          ^^^^^\n" + 
211
		"Illegal modifier for the enum constant BLANC; no modifier is allowed\n" +
214
		"Illegal modifier for the enum constant BLANC; no modifier is allowed\n" + 
215
		"----------\n" + 
216
		"3. ERROR in X.java (at line 6)\n" + 
217
		"	abstract RED {\n" + 
218
		"	         ^^^\n" + 
219
		"Illegal modifier for the enum constant RED; no modifier is allowed\n" + 
212
		"----------\n");
220
		"----------\n");
213
}
221
}
214
// check using an enum constant
222
// check using an enum constant

Return to bug 227527