### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java,v retrieving revision 1.105 diff -u -r1.105 AbstractMethodDeclaration.java --- compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java 4 Jan 2010 19:19:59 -0000 1.105 +++ compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java 14 Jul 2010 05:04:13 -0000 @@ -451,7 +451,9 @@ this.statements[i].resolve(this.scope); } } else if ((this.bits & UndocumentedEmptyBlock) != 0) { - this.scope.problemReporter().undocumentedEmptyBlock(this.bodyStart-1, this.bodyEnd+1); + if (!this.isConstructor() || this.arguments != null) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=319626 + this.scope.problemReporter().undocumentedEmptyBlock(this.bodyStart-1, this.bodyEnd+1); + } } } #P org.eclipse.jdt.core.tests Index: Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java =================================================================== RCS file: /home/cvs/numbat/org.eclipse.jdt.core.tests/Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java,v retrieving revision 1.339 diff -u -r1.339 NegativeTest.java --- Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java 27 May 2010 14:36:29 -0000 1.339 +++ Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java 14 Jul 2010 05:04:21 -0000 @@ -14421,23 +14421,18 @@ " ^^^^\n" + "Empty block should be documented\n" + "----------\n" + - "2. ERROR in X.java (at line 9)\n" + - " X(){}\n" + - " ^^\n" + - "Empty block should be documented\n" + - "----------\n" + - "3. ERROR in X.java (at line 11)\n" + + "2. ERROR in X.java (at line 11)\n" + " missingReturnType(){\n" + " ^^^^^^^^^^^^^^^^^^^\n" + "Return type for the method is missing\n" + "----------\n" + - "4. ERROR in X.java (at line 11)\n" + + "3. ERROR in X.java (at line 11)\n" + " missingReturnType(){\n" + " }\n" + " ^^^^\n" + "Empty block should be documented\n" + "----------\n" + - "5. ERROR in X.java (at line 13)\n" + + "4. ERROR in X.java (at line 13)\n" + " missingReturnType2(){ /*do nothing*/\n" + " ^^^^^^^^^^^^^^^^^^^^\n" + "Return type for the method is missing\n" + @@ -14485,23 +14480,18 @@ " ^\n" + "Syntax error on token \"Invalid Character\", delete this token\n" + "----------\n" + - "3. ERROR in X.java (at line 10)\n" + - " X(){}\n" + - " ^^\n" + - "Empty block should be documented\n" + - "----------\n" + - "4. ERROR in X.java (at line 12)\n" + + "3. ERROR in X.java (at line 12)\n" + " missingReturnType(){\n" + " ^^^^^^^^^^^^^^^^^^^\n" + "Return type for the method is missing\n" + "----------\n" + - "5. ERROR in X.java (at line 12)\n" + + "4. ERROR in X.java (at line 12)\n" + " missingReturnType(){\n" + " }\n" + " ^^^^\n" + "Empty block should be documented\n" + "----------\n" + - "6. ERROR in X.java (at line 14)\n" + + "5. ERROR in X.java (at line 14)\n" + " missingReturnType2(){ /*do nothing*/\n" + " ^^^^^^^^^^^^^^^^^^^^\n" + "Return type for the method is missing\n" + #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java,v retrieving revision 1.25 diff -u -r1.25 ParserTest.java --- src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java 3 Jul 2008 09:05:22 -0000 1.25 +++ src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java 14 Jul 2010 05:04:23 -0000 @@ -688,12 +688,7 @@ " ^^\n" + "Empty block should be documented\n" + "----------\n" + - "2. ERROR in X.java (at line 8)\n" + - " A() {}\n" + - " ^^\n" + - "Empty block should be documented\n" + - "----------\n" + - "3. ERROR in X.java (at line 9)\n" + + "2. ERROR in X.java (at line 9)\n" + " public void bar() {}\n" + " ^^\n" + "Empty block should be documented\n" + Index: src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java,v retrieving revision 1.7 diff -u -r1.7 NonFatalErrorTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java 27 Jun 2008 16:04:44 -0000 1.7 +++ src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java 14 Jul 2010 05:04:23 -0000 @@ -206,4 +206,56 @@ // javac options JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */); } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=319626 + public void test006() { + Map customOptions = getCompilerOptions(); + customOptions.put(CompilerOptions.OPTION_FatalOptionalError, CompilerOptions.DISABLED); + customOptions.put(CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, CompilerOptions.ERROR); + runNegativeTest( + // test directory preparation + true /* flush output directory */, + new String[] { /* test files */ + "X.java", + "public class X {\n" + + " { }\n" + + " static { }\n" + + " X() { }\n" + + " X(int a) {}\n" + + " public void foo() {}\n" + + " public static void main(String argv[]) {\n" + + " System.out.println(\"SUCCESS\");\n" + + " }\n" + + "}\n" + }, + // compiler options + null /* no class libraries */, + customOptions /* custom options */, + // compiler results + "----------\n" + + "1. ERROR in X.java (at line 2)\n" + + " { }\n" + + " ^^^^^^^\n" + + "Empty block should be documented\n" + + "----------\n" + + "2. ERROR in X.java (at line 3)\n" + + " static { }\n" + + " ^^^^\n" + + "Empty block should be documented\n" + + "----------\n" + + "3. ERROR in X.java (at line 5)\n" + + " X(int a) {}\n" + + " ^^\n" + + "Empty block should be documented\n" + + "----------\n" + + "4. ERROR in X.java (at line 6)\n" + + " public void foo() {}\n" + + " ^^\n" + + "Empty block should be documented\n" + + "----------\n", + // runtime results + "SUCCESS" /* expected output string */, + null /* do not check error string */, + // javac options + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */); + } }