### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java,v retrieving revision 1.77 diff -u -r1.77 LookupTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 4 Jul 2008 20:25:27 -0000 1.77 +++ src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 14 Aug 2008 15:52:07 -0000 @@ -2955,6 +2955,36 @@ "The type X cannot be a superinterface of Member; a superinterface must be an interface\n" + "----------\n"); } + +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239833 +public void test090() { + this.runNegativeTest( + new String[] { + "X.java", + "public class X {\n" + + " public synchronized int f;\n" + + " public synchronized X() {}\n" + + " public volatile void foo() {}\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in X.java (at line 2)\n" + + " public synchronized int f;\n" + + " ^\n" + + "Illegal modifier for the field f; only public, protected, private, static, final, transient & volatile are permitted\n" + + "----------\n" + + "2. ERROR in X.java (at line 3)\n" + + " public synchronized X() {}\n" + + " ^^^\n" + + "Illegal modifier for the constructor in type X; only public, protected & private are permitted\n" + + "----------\n" + + "3. ERROR in X.java (at line 4)\n" + + " public volatile void foo() {}\n" + + " ^^^^^\n" + + "Illegal modifier for the method foo; only public, protected, private, static, final, abstract, synchronized & native are permitted\n" + + "----------\n" + ); +} public static Class testClass() { return LookupTest.class; } } Index: src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java,v retrieving revision 1.17 diff -u -r1.17 CompilerInvocationTests.java --- src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 27 Jun 2008 16:04:45 -0000 1.17 +++ src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 14 Aug 2008 15:52:07 -0000 @@ -577,6 +577,7 @@ expectedProblemAttributes.put("ReturnTypeCannotBeVoidArray", DEPRECATED); expectedProblemAttributes.put("NativeMethodsCannotBeStrictfp", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); expectedProblemAttributes.put("DuplicateModifierForArgument", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); + expectedProblemAttributes.put("IllegalModifierForConstructor", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); expectedProblemAttributes.put("ArgumentTypeNotFound", DEPRECATED); expectedProblemAttributes.put("ArgumentTypeNotVisible", DEPRECATED); expectedProblemAttributes.put("ArgumentTypeAmbiguous", DEPRECATED); @@ -1187,6 +1188,7 @@ expectedProblemAttributes.put("ReturnTypeCannotBeVoidArray", SKIP); expectedProblemAttributes.put("NativeMethodsCannotBeStrictfp", SKIP); expectedProblemAttributes.put("DuplicateModifierForArgument", SKIP); + expectedProblemAttributes.put("IllegalModifierForConstructor", SKIP); expectedProblemAttributes.put("ArgumentTypeNotFound", SKIP); expectedProblemAttributes.put("ArgumentTypeNotVisible", SKIP); expectedProblemAttributes.put("ArgumentTypeAmbiguous", SKIP); @@ -1724,6 +1726,7 @@ expectedProblemAttributes.put("ReturnTypeCannotBeVoidArray", SKIP); expectedProblemAttributes.put("NativeMethodsCannotBeStrictfp", SKIP); expectedProblemAttributes.put("DuplicateModifierForArgument", SKIP); + expectedProblemAttributes.put("IllegalModifierForConstructor", SKIP); expectedProblemAttributes.put("ArgumentTypeNotFound", SKIP); expectedProblemAttributes.put("ArgumentTypeNotVisible", SKIP); expectedProblemAttributes.put("ArgumentTypeAmbiguous", SKIP); 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.128 diff -u -r1.128 EnumTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 10 Jul 2008 15:42:56 -0000 1.128 +++ src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 14 Aug 2008 15:52:07 -0000 @@ -2416,7 +2416,7 @@ "1. ERROR in X.java (at line 3)\n" + " private strictfp X() {}\n" + " ^^^\n" + - "Illegal modifier for the method X.X()\n" + + "Illegal modifier for the constructor in type X; only public, protected & private are permitted\n" + "----------\n" ); this.runConformTest( Index: src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java,v retrieving revision 1.60 diff -u -r1.60 VarargsTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java 27 Jun 2008 16:04:45 -0000 1.60 +++ src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java 14 Aug 2008 15:52:07 -0000 @@ -1060,7 +1060,7 @@ "1. ERROR in X.java (at line 2)\r\n" + " transient private X() {}\r\n" + " ^^^\n" + - "Illegal modifier for the method X.X()\n" + + "Illegal modifier for the constructor in type X; only public, protected & private are permitted\n" + "----------\n" ); this.runNegativeTest( @@ -1075,7 +1075,7 @@ "1. ERROR in X.java (at line 2)\n" + " transient private X(Object... o) {}\n" + " ^^^^^^^^^^^^^^\n" + - "Illegal modifier for the method X.X()\n" + + "Illegal modifier for the constructor in type X; only public, protected & private are permitted\n" + "----------\n" ); } #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.201 diff -u -r1.201 IProblem.java --- compiler/org/eclipse/jdt/core/compiler/IProblem.java 27 Jun 2008 16:04:14 -0000 1.201 +++ compiler/org/eclipse/jdt/core/compiler/IProblem.java 14 Aug 2008 15:52:07 -0000 @@ -684,6 +684,7 @@ int ReturnTypeCannotBeVoidArray = MethodRelated + 366; int NativeMethodsCannotBeStrictfp = MethodRelated + 367; int DuplicateModifierForArgument = MethodRelated + 368; + int IllegalModifierForConstructor = MethodRelated + 369; /** @deprecated - problem is no longer generated, use {@link #UndefinedType} instead */ int ArgumentTypeNotFound = MethodRelated + 369 + ProblemReasons.NotFound; // MethodRelated + 370 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.235 diff -u -r1.235 messages.properties --- compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 16 Jul 2008 14:36:17 -0000 1.235 +++ compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 14 Aug 2008 15:52:08 -0000 @@ -284,8 +284,8 @@ 355 = Duplicate method {0}({2}) in type {1} 356 = Illegal modifier for parameter {0}; only final is permitted 357 = Duplicate modifier for the method {1} in type {0} -358 = Illegal modifier for the method {0}.{2}({1}) -359 = Illegal modifier for the interface method {0}.{1}({2}); only public & abstract are permitted +358 = Illegal modifier for the method {0}; only public, protected, private, static, final, abstract, synchronized & native are permitted +359 = Illegal modifier for the interface method {0}; only public & abstract are permitted 360 = The method {1} in type {0} can only set one of public / protected / private 361 = The method {1} cannot be declared static; static methods can only be declared in a static or top level type 362 = The abstract method {1} in type {0} can only set a visibility modifier, one of public or protected @@ -295,6 +295,7 @@ ###[obsolete] 366 = An array of void is an invalid return type for the method {0} 367 = The native method {1} cannot also be declared strictfp 368 = Duplicate modifier for parameter {0} +369 = Illegal modifier for the constructor in type {0}; only public, protected & private are permitted ###[obsolete] 370 = {2} cannot be resolved (or is not a valid type) for the parameter {1} of the method {0} ###[obsolete] 371 = The type {2} is not visible for the parameter {1} of the method {0} 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.373 diff -u -r1.373 ProblemReporter.java --- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 24 Jul 2008 14:06:58 -0000 1.373 +++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 14 Aug 2008 15:52:08 -0000 @@ -2176,17 +2176,15 @@ fieldDecl.sourceEnd); } public void illegalModifierForInterfaceMethod(AbstractMethodDeclaration methodDecl) { + // cannot include parameter types since they are not resolved yet + // and the error message would be too long this.handle( IProblem.IllegalModifierForInterfaceMethod, new String[] { - new String(methodDecl.binding.declaringClass.readableName()), - new String(methodDecl.selector), - typesAsString(methodDecl.binding.isVarargs(), methodDecl.binding.parameters, false), + new String(methodDecl.selector) }, new String[] { - new String(methodDecl.binding.declaringClass.shortReadableName()), - new String(methodDecl.selector), - typesAsString(methodDecl.binding.isVarargs(), methodDecl.binding.parameters, true), + new String(methodDecl.selector) }, methodDecl.sourceStart, methodDecl.sourceEnd); @@ -2237,17 +2235,15 @@ type.sourceEnd()); } public void illegalModifierForMethod(AbstractMethodDeclaration methodDecl) { + // cannot include parameter types since they are not resolved yet + // and the error message would be too long this.handle( - IProblem.IllegalModifierForMethod, + methodDecl.isConstructor() ? IProblem.IllegalModifierForConstructor : IProblem.IllegalModifierForMethod, new String[] { - new String(methodDecl.selector), - typesAsString(methodDecl.binding.isVarargs(), methodDecl.binding.parameters, false), - new String(methodDecl.binding.declaringClass.readableName()), + new String(methodDecl.selector) }, new String[] { - new String(methodDecl.selector), - typesAsString(methodDecl.binding.isVarargs(), methodDecl.binding.parameters, true), - new String(methodDecl.binding.declaringClass.shortReadableName()), + new String(methodDecl.selector) }, methodDecl.sourceStart, methodDecl.sourceEnd);