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

(-)src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java (+30 lines)
Lines 2955-2960 Link Here
2955
		"The type X cannot be a superinterface of Member; a superinterface must be an interface\n" + 
2955
		"The type X cannot be a superinterface of Member; a superinterface must be an interface\n" + 
2956
		"----------\n");
2956
		"----------\n");
2957
}
2957
}
2958
2959
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239833
2960
public void test090() {
2961
	this.runNegativeTest(
2962
		new String[] {
2963
			"X.java",
2964
			"public class X {\n" + 
2965
			"	public synchronized int f;\n" + 
2966
			"	public synchronized X() {}\n" + 
2967
			"	public volatile void foo() {}\n" + 
2968
			"}\n"
2969
		},
2970
		"----------\n" + 
2971
		"1. ERROR in X.java (at line 2)\n" + 
2972
		"	public synchronized int f;\n" + 
2973
		"	                        ^\n" + 
2974
		"Illegal modifier for the field f; only public, protected, private, static, final, transient & volatile are permitted\n" + 
2975
		"----------\n" + 
2976
		"2. ERROR in X.java (at line 3)\n" + 
2977
		"	public synchronized X() {}\n" + 
2978
		"	                    ^^^\n" + 
2979
		"Illegal modifier for the constructor in type X; only public, protected & private are permitted\n" + 
2980
		"----------\n" + 
2981
		"3. ERROR in X.java (at line 4)\n" + 
2982
		"	public volatile void foo() {}\n" + 
2983
		"	                     ^^^^^\n" + 
2984
		"Illegal modifier for the method foo; only public, protected, private, static, final, abstract, synchronized & native are permitted\n" + 
2985
		"----------\n"
2986
	);
2987
}
2958
public static Class testClass() {	return LookupTest.class;
2988
public static Class testClass() {	return LookupTest.class;
2959
}
2989
}
2960
}
2990
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java (+3 lines)
Lines 577-582 Link Here
577
		expectedProblemAttributes.put("ReturnTypeCannotBeVoidArray", DEPRECATED);
577
		expectedProblemAttributes.put("ReturnTypeCannotBeVoidArray", DEPRECATED);
578
		expectedProblemAttributes.put("NativeMethodsCannotBeStrictfp", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
578
		expectedProblemAttributes.put("NativeMethodsCannotBeStrictfp", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
579
		expectedProblemAttributes.put("DuplicateModifierForArgument", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
579
		expectedProblemAttributes.put("DuplicateModifierForArgument", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
580
		expectedProblemAttributes.put("IllegalModifierForConstructor", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
580
		expectedProblemAttributes.put("ArgumentTypeNotFound", DEPRECATED);
581
		expectedProblemAttributes.put("ArgumentTypeNotFound", DEPRECATED);
581
		expectedProblemAttributes.put("ArgumentTypeNotVisible", DEPRECATED);
582
		expectedProblemAttributes.put("ArgumentTypeNotVisible", DEPRECATED);
582
		expectedProblemAttributes.put("ArgumentTypeAmbiguous", DEPRECATED);
583
		expectedProblemAttributes.put("ArgumentTypeAmbiguous", DEPRECATED);
Lines 1187-1192 Link Here
1187
		expectedProblemAttributes.put("ReturnTypeCannotBeVoidArray", SKIP);
1188
		expectedProblemAttributes.put("ReturnTypeCannotBeVoidArray", SKIP);
1188
		expectedProblemAttributes.put("NativeMethodsCannotBeStrictfp", SKIP);
1189
		expectedProblemAttributes.put("NativeMethodsCannotBeStrictfp", SKIP);
1189
		expectedProblemAttributes.put("DuplicateModifierForArgument", SKIP);
1190
		expectedProblemAttributes.put("DuplicateModifierForArgument", SKIP);
1191
		expectedProblemAttributes.put("IllegalModifierForConstructor", SKIP);
1190
		expectedProblemAttributes.put("ArgumentTypeNotFound", SKIP);
1192
		expectedProblemAttributes.put("ArgumentTypeNotFound", SKIP);
1191
		expectedProblemAttributes.put("ArgumentTypeNotVisible", SKIP);
1193
		expectedProblemAttributes.put("ArgumentTypeNotVisible", SKIP);
1192
		expectedProblemAttributes.put("ArgumentTypeAmbiguous", SKIP);
1194
		expectedProblemAttributes.put("ArgumentTypeAmbiguous", SKIP);
Lines 1724-1729 Link Here
1724
		expectedProblemAttributes.put("ReturnTypeCannotBeVoidArray", SKIP);
1726
		expectedProblemAttributes.put("ReturnTypeCannotBeVoidArray", SKIP);
1725
		expectedProblemAttributes.put("NativeMethodsCannotBeStrictfp", SKIP);
1727
		expectedProblemAttributes.put("NativeMethodsCannotBeStrictfp", SKIP);
1726
		expectedProblemAttributes.put("DuplicateModifierForArgument", SKIP);
1728
		expectedProblemAttributes.put("DuplicateModifierForArgument", SKIP);
1729
		expectedProblemAttributes.put("IllegalModifierForConstructor", SKIP);
1727
		expectedProblemAttributes.put("ArgumentTypeNotFound", SKIP);
1730
		expectedProblemAttributes.put("ArgumentTypeNotFound", SKIP);
1728
		expectedProblemAttributes.put("ArgumentTypeNotVisible", SKIP);
1731
		expectedProblemAttributes.put("ArgumentTypeNotVisible", SKIP);
1729
		expectedProblemAttributes.put("ArgumentTypeAmbiguous", SKIP);
1732
		expectedProblemAttributes.put("ArgumentTypeAmbiguous", SKIP);
(-)src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java (-1 / +1 lines)
Lines 2416-2422 Link Here
2416
		"1. ERROR in X.java (at line 3)\n" +
2416
		"1. ERROR in X.java (at line 3)\n" +
2417
		"	private strictfp X() {}\n" +
2417
		"	private strictfp X() {}\n" +
2418
		"	                 ^^^\n" +
2418
		"	                 ^^^\n" +
2419
		"Illegal modifier for the method X.X()\n" +
2419
		"Illegal modifier for the constructor in type X; only public, protected & private are permitted\n" +
2420
		"----------\n"
2420
		"----------\n"
2421
	);
2421
	);
2422
	this.runConformTest(
2422
	this.runConformTest(
(-)src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java (-2 / +2 lines)
Lines 1060-1066 Link Here
1060
			"1. ERROR in X.java (at line 2)\r\n" +
1060
			"1. ERROR in X.java (at line 2)\r\n" +
1061
			"	transient private X() {}\r\n" +
1061
			"	transient private X() {}\r\n" +
1062
			"	                  ^^^\n" +
1062
			"	                  ^^^\n" +
1063
			"Illegal modifier for the method X.X()\n" +
1063
			"Illegal modifier for the constructor in type X; only public, protected & private are permitted\n" +
1064
			"----------\n"
1064
			"----------\n"
1065
		);
1065
		);
1066
		this.runNegativeTest(
1066
		this.runNegativeTest(
Lines 1075-1081 Link Here
1075
			"1. ERROR in X.java (at line 2)\n" +
1075
			"1. ERROR in X.java (at line 2)\n" +
1076
			"	transient private X(Object... o) {}\n" +
1076
			"	transient private X(Object... o) {}\n" +
1077
			"	                  ^^^^^^^^^^^^^^\n" +
1077
			"	                  ^^^^^^^^^^^^^^\n" +
1078
			"Illegal modifier for the method X.X()\n" +
1078
			"Illegal modifier for the constructor in type X; only public, protected & private are permitted\n" +
1079
			"----------\n"
1079
			"----------\n"
1080
		);
1080
		);
1081
	}
1081
	}
(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (+1 lines)
Lines 684-689 Link Here
684
	int ReturnTypeCannotBeVoidArray = MethodRelated + 366;
684
	int ReturnTypeCannotBeVoidArray = MethodRelated + 366;
685
	int NativeMethodsCannotBeStrictfp = MethodRelated + 367;
685
	int NativeMethodsCannotBeStrictfp = MethodRelated + 367;
686
	int DuplicateModifierForArgument = MethodRelated + 368;
686
	int DuplicateModifierForArgument = MethodRelated + 368;
687
	int IllegalModifierForConstructor = MethodRelated + 369;
687
688
688
	/** @deprecated - problem is no longer generated, use {@link #UndefinedType} instead */
689
	/** @deprecated - problem is no longer generated, use {@link #UndefinedType} instead */
689
	int ArgumentTypeNotFound =  MethodRelated + 369 + ProblemReasons.NotFound; // MethodRelated + 370
690
	int ArgumentTypeNotFound =  MethodRelated + 369 + ProblemReasons.NotFound; // MethodRelated + 370
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (-2 / +3 lines)
Lines 284-291 Link Here
284
355 = Duplicate method {0}({2}) in type {1}
284
355 = Duplicate method {0}({2}) in type {1}
285
356 = Illegal modifier for parameter {0}; only final is permitted
285
356 = Illegal modifier for parameter {0}; only final is permitted
286
357 = Duplicate modifier for the method {1} in type {0}
286
357 = Duplicate modifier for the method {1} in type {0}
287
358 = Illegal modifier for the method {0}.{2}({1})
287
358 = Illegal modifier for the method {0}; only public, protected, private, static, final, abstract, synchronized & native are permitted
288
359 = Illegal modifier for the interface method {0}.{1}({2}); only public & abstract are permitted
288
359 = Illegal modifier for the interface method {0}; only public & abstract are permitted
289
360 = The method {1} in type {0} can only set one of public / protected / private
289
360 = The method {1} in type {0} can only set one of public / protected / private
290
361 = The method {1} cannot be declared static; static methods can only be declared in a static or top level type
290
361 = The method {1} cannot be declared static; static methods can only be declared in a static or top level type
291
362 = The abstract method {1} in type {0} can only set a visibility modifier, one of public or protected
291
362 = The abstract method {1} in type {0} can only set a visibility modifier, one of public or protected
Lines 295-300 Link Here
295
###[obsolete] 366 = An array of void is an invalid return type for the method {0}
295
###[obsolete] 366 = An array of void is an invalid return type for the method {0}
296
367 = The native method {1} cannot also be declared strictfp
296
367 = The native method {1} cannot also be declared strictfp
297
368 = Duplicate modifier for parameter {0}
297
368 = Duplicate modifier for parameter {0}
298
369 = Illegal modifier for the constructor in type {0}; only public, protected & private are permitted
298
299
299
###[obsolete] 370 = {2} cannot be resolved (or is not a valid type) for the parameter {1} of the method {0}
300
###[obsolete] 370 = {2} cannot be resolved (or is not a valid type) for the parameter {1} of the method {0}
300
###[obsolete] 371 = The type {2} is not visible for the parameter {1} of the method {0}
301
###[obsolete] 371 = The type {2} is not visible for the parameter {1} of the method {0}
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-13 / +9 lines)
Lines 2176-2192 Link Here
2176
		fieldDecl.sourceEnd);
2176
		fieldDecl.sourceEnd);
2177
}
2177
}
2178
public void illegalModifierForInterfaceMethod(AbstractMethodDeclaration methodDecl) {
2178
public void illegalModifierForInterfaceMethod(AbstractMethodDeclaration methodDecl) {
2179
	// cannot include parameter types since they are not resolved yet
2180
	// and the error message would be too long
2179
	this.handle(
2181
	this.handle(
2180
		IProblem.IllegalModifierForInterfaceMethod,
2182
		IProblem.IllegalModifierForInterfaceMethod,
2181
		new String[] {
2183
		new String[] {
2182
			new String(methodDecl.binding.declaringClass.readableName()),
2184
			new String(methodDecl.selector)
2183
			new String(methodDecl.selector),
2184
			typesAsString(methodDecl.binding.isVarargs(), methodDecl.binding.parameters, false),
2185
		},
2185
		},
2186
		new String[] {
2186
		new String[] {
2187
			new String(methodDecl.binding.declaringClass.shortReadableName()),
2187
			new String(methodDecl.selector)
2188
			new String(methodDecl.selector),
2189
			typesAsString(methodDecl.binding.isVarargs(), methodDecl.binding.parameters, true),
2190
		},
2188
		},
2191
		methodDecl.sourceStart,
2189
		methodDecl.sourceStart,
2192
		methodDecl.sourceEnd);
2190
		methodDecl.sourceEnd);
Lines 2237-2253 Link Here
2237
		type.sourceEnd());
2235
		type.sourceEnd());
2238
}
2236
}
2239
public void illegalModifierForMethod(AbstractMethodDeclaration methodDecl) {
2237
public void illegalModifierForMethod(AbstractMethodDeclaration methodDecl) {
2238
	// cannot include parameter types since they are not resolved yet
2239
	// and the error message would be too long
2240
	this.handle(
2240
	this.handle(
2241
		IProblem.IllegalModifierForMethod,
2241
		methodDecl.isConstructor() ? IProblem.IllegalModifierForConstructor : IProblem.IllegalModifierForMethod,
2242
		new String[] {
2242
		new String[] {
2243
			new String(methodDecl.selector),
2243
			new String(methodDecl.selector)
2244
			typesAsString(methodDecl.binding.isVarargs(), methodDecl.binding.parameters, false),
2245
			new String(methodDecl.binding.declaringClass.readableName()),
2246
		},
2244
		},
2247
		new String[] {
2245
		new String[] {
2248
			new String(methodDecl.selector),
2246
			new String(methodDecl.selector)
2249
			typesAsString(methodDecl.binding.isVarargs(), methodDecl.binding.parameters, true),
2250
			new String(methodDecl.binding.declaringClass.shortReadableName()),
2251
		},
2247
		},
2252
		methodDecl.sourceStart,
2248
		methodDecl.sourceStart,
2253
		methodDecl.sourceEnd);
2249
		methodDecl.sourceEnd);

Return to bug 239833