### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java,v retrieving revision 1.154 diff -u -r1.154 MethodVerifyTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 27 Jun 2008 16:04:43 -0000 1.154 +++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 8 Jul 2008 12:18:06 -0000 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Benjamin Muskalla - Contribution for bug 239066 *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -28,7 +29,7 @@ static { // TESTS_NAMES = new String[] { "test000" }; // TESTS_NUMBERS = new int[] { 121 }; -// TESTS_RANGE = new int[] { 113, -1}; + TESTS_RANGE = new int[] { 160, 170}; } public MethodVerifyTest(String name) { @@ -8676,4 +8677,75 @@ "----------\n" ); } + +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239066 +public void test166() { + this.runNegativeTest( + new String[] { + "X.java", + "class X { synchronized void foo() {} }\n" + + "class Y extends X { @Override void foo() { } }" + }, + "----------\n" + + "1. WARNING in X.java (at line 2)\n" + + " class Y extends X { @Override void foo() { } }\n" + + " ^^^^^\n" + + "The method Y.foo() is overriding a synchronized method without being synchronized\n" + + "----------\n" + ); +} + +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239066 +public void test167() { + this.runNegativeTest( + new String[] { + "X.java", + "public enum X {\n" + + " FOO { @Override void foo() { super.foo(); } };\n"+ + " synchronized void foo() { }\n"+ + "}" + }, + "----------\n" + + "1. WARNING in X.java (at line 2)\n" + + " FOO { @Override void foo() { super.foo(); } };\n" + + " ^^^^^\n" + + "The method new X(){}.foo() is overriding a synchronized method without being synchronized\n" + + "----------\n"); +} + +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239066 +public void test168() { + this.runNegativeTest( + new String[] { + "X.java", + "public class X {\n" + + " void bar() { new X() { @Override void foo() {} }; }\n"+ + " synchronized void foo() { }\n"+ + "}" + }, + "----------\n" + + "1. WARNING in X.java (at line 2)\n" + + " void bar() { new X() { @Override void foo() {} }; }\n"+ + " ^^^^^\n" + + "The method new X(){}.foo() is overriding a synchronized method without being synchronized\n" + + "----------\n"); +} + +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=239066 +public void test169() { + this.runNegativeTest( + new String[] { + "X.java", + "public class X { synchronized void foo() {} }\n" + + "class Y extends X {}\n" + + "class Z extends Y { @Override void foo() {} }\n" + }, + "----------\n" + + "1. WARNING in X.java (at line 3)\n" + + " class Z extends Y { @Override void foo() {} }\n" + + " ^^^^^\n" + + "The method Z.foo() is overriding a synchronized method without being synchronized\n" + + "----------\n"); +} + } \ No newline at end of file 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 8 Jul 2008 12:18:05 -0000 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Benjamin Muskalla - Contribution for bug 239066 *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -847,6 +848,7 @@ expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericConstructor", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); expectedProblemAttributes.put("ExternalProblemNotFixable", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); expectedProblemAttributes.put("ExternalProblemFixable", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); + expectedProblemAttributes.put("MissingSynchronizedModifierInInheritedMethod", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); StringBuffer failures = new StringBuffer(); Field[] fields = (iProblemClass = IProblem.class).getFields(); boolean watchInternalCategory = false, printHeader = true; @@ -1994,6 +1996,7 @@ expectedProblemAttributes.put("ExternalProblemNotFixable", SKIP); expectedProblemAttributes.put("ExternalProblemFixable", SKIP); expectedProblemAttributes.put("ComparingIdentical", new ProblemAttributes(JavaCore.COMPILER_PB_COMPARING_IDENTICAL)); + expectedProblemAttributes.put("MissingSynchronizedModifierInInheritedMethod", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_SYNCHRONIZED_ON_INHERITED_METHOD)); Map constantNamesIndex = new HashMap(); Field[] fields = JavaCore.class.getFields(); for (int i = 0, length = fields.length; i < length; i++) { Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v retrieving revision 1.166 diff -u -r1.166 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 27 Jun 2008 16:04:44 -0000 1.166 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 8 Jul 2008 12:18:04 -0000 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Benjamin Muskalla - Contribution for bug 239066 *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -1678,6 +1679,7 @@ " staticReceiver + non-static reference to static member\n" + " super overriding a method without making a super invocation\n" + " suppress + enable @SuppressWarnings\n" + + " syncOverride overriding a synchronized method without synchronizing it\n" + " synthetic-access same as syntheticAccess\n" + " syntheticAccess synthetic access for innerclass\n" + " tasks() tasks identified by tags inside comments\n" + @@ -1808,6 +1810,7 @@ "