### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java,v retrieving revision 1.32 diff -u -r1.32 JavadocBugsTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 25 Nov 2006 19:49:48 -0000 1.32 +++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 1 Dec 2006 18:03:07 -0000 @@ -73,6 +73,7 @@ options.put(CompilerOptions.OPTION_ReportDeprecation, reportDeprecation); options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR); options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE); + options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE); return options; } /* (non-Javadoc) @@ -4811,67 +4812,6 @@ } /** - * @bug 160015: [1.5][javadoc] Missing warning on autoboxing compatible methods - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=160015" - */ - public void testBug160015() { - runNegativeTest(new String[] { - "Test.java", - "/**\n" + - " * @see #method(Long) Warning!\n" + - " */\n" + - "public class Test {\n" + - " public void method(long l) {}\n" + - " /**\n" + - " * @see #method(Long) Warning!\n" + - " */\n" + - " void bar() {}\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in Test.java (at line 2)\n" + - " * @see #method(Long) Warning!\n" + - " ^^^^^^\n" + - "Javadoc: The method method(long) in the type Test is not applicable for the arguments (Long)\n" + - "----------\n" + - "2. ERROR in Test.java (at line 7)\n" + - " * @see #method(Long) Warning!\n" + - " ^^^^^^\n" + - "Javadoc: The method method(long) in the type Test is not applicable for the arguments (Long)\n" + - "----------\n" - ); - } - - /** - * @bug 163659: [javadoc] Compiler should warn when method parameters are not identical - * @test Ensure that a warning is raised when method parameter types are not identical - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=163659" - */ - public void testBug163659() { - runNegativeTest( - new String[] { - "Test.java", - "/**\n" + - " * @see #foo(MyInterface)\n" + - " * @see #foo(MySubInterface)\n" + - " */\n" + - "public class Test {\n" + - " public void foo(MyInterface mi) {\n" + - " }\n" + - "}\n" + - "interface MyInterface {}\n" + - "interface MySubInterface extends MyInterface {} \n" - }, - "----------\n" + - "1. ERROR in Test.java (at line 3)\n" + - " * @see #foo(MySubInterface)\n" + - " ^^^\n" + - "Javadoc: The method foo(MyInterface) in the type Test is not applicable for the arguments (MySubInterface)\n" + - "----------\n" - ); - } - - /** * @bug 153399: [javadoc] JDT Core should warn if the @value tag is not used correctly * @test Ensure that 'value' tag is well warned when not used correctly * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=153399" @@ -4981,12 +4921,12 @@ "1. ERROR in X.java (at line 3)\n" + " * {@value #MY_VALUE}\n" + " ^^^^^\n" + - "Javadoc: Unexpected duplicated tag @value\n" + + "Javadoc: Unexpected tag\n" + "----------\n" + "2. ERROR in X.java (at line 4)\n" + " * {@value}\n" + " ^^^^^\n" + - "Javadoc: Unexpected duplicated tag @value\n" + + "Javadoc: Unexpected tag\n" + "----------\n" ); } else { @@ -5017,7 +4957,7 @@ "1. ERROR in X.java (at line 3)\n" + " * {@value Invalid}\n" + " ^^^^^\n" + - "Javadoc: Unexpected duplicated tag @value\n" + + "Javadoc: Unexpected tag\n" + "----------\n" ); } else { @@ -5033,6 +4973,67 @@ } /** + * @bug 160015: [1.5][javadoc] Missing warning on autoboxing compatible methods + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=160015" + */ + public void testBug160015() { + runNegativeTest(new String[] { + "Test.java", + "/**\n" + + " * @see #method(Long) Warning!\n" + + " */\n" + + "public class Test {\n" + + " public void method(long l) {}\n" + + " /**\n" + + " * @see #method(Long) Warning!\n" + + " */\n" + + " void bar() {}\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in Test.java (at line 2)\n" + + " * @see #method(Long) Warning!\n" + + " ^^^^^^\n" + + "Javadoc: The method method(long) in the type Test is not applicable for the arguments (Long)\n" + + "----------\n" + + "2. ERROR in Test.java (at line 7)\n" + + " * @see #method(Long) Warning!\n" + + " ^^^^^^\n" + + "Javadoc: The method method(long) in the type Test is not applicable for the arguments (Long)\n" + + "----------\n" + ); + } + + /** + * @bug 163659: [javadoc] Compiler should warn when method parameters are not identical + * @test Ensure that a warning is raised when method parameter types are not identical + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=163659" + */ + public void testBug163659() { + runNegativeTest( + new String[] { + "Test.java", + "/**\n" + + " * @see #foo(MyInterface)\n" + + " * @see #foo(MySubInterface)\n" + + " */\n" + + "public class Test {\n" + + " public void foo(MyInterface mi) {\n" + + " }\n" + + "}\n" + + "interface MyInterface {}\n" + + "interface MySubInterface extends MyInterface {} \n" + }, + "----------\n" + + "1. ERROR in Test.java (at line 3)\n" + + " * @see #foo(MySubInterface)\n" + + " ^^^\n" + + "Javadoc: The method foo(MyInterface) in the type Test is not applicable for the arguments (MySubInterface)\n" + + "----------\n" + ); + } + + /** * @bug 165794: [javadoc] Should not report ambiguous on method with parameterized types as parameters * @test Ensure that no warning are raised when ambiguous parameterized methods are present in javadoc comments * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=165794" @@ -5071,4 +5072,123 @@ } runConformTest(testFiles); } + + /** + * @bug 166365: [javadoc] severity level of malformed javadoc comments did not work properly + * @test Ensure that no warning is raised when visibility is lower than the javadoc option one + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=166365" + */ + public void testBug166365() { + String[] testFiles = new String[] { + "X.java", + "public class X {\n" + + " /**\n" + + " * @return\n" + + " */\n" + + " private String getSomePrivate() {\n" + + " return \"SomePrivate\";\n" + + " }\n" + + " /**\n" + + " * @return\n" + + " */\n" + + " protected String getSomeProtected() {\n" + + " return \"SomeProtected\";\n" + + " }\n" + + " /**\n" + + " * @return\n" + + " */\n" + + " String getSomeDefault() {\n" + + " return \"SomeDefault\";\n" + + " }\n" + + " /**\n" + + " * @return\n" + + " */\n" + + " public String getSomePublic() {\n" + + " return \"SomePublic\";\n" + + " }\n" + + "}\n" + }; + this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; + runNegativeTest(testFiles, + "----------\n" + + "1. ERROR in X.java (at line 21)\n" + + " * @return\n" + + " ^^^^^^\n" + + "Javadoc: Missing return type description\n" + + "----------\n" + ); + } + + /** + * @bug 166436: [javadoc] Potentially wrong javadoc warning for unexpected duplicate tag value + * @test Ensure that no duplicate warning is raised for value tag + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=166436" + */ + public void testBug166436() { + String[] testFiles = new String[] { + "X.java", + "public class X {\n" + + " public static final String PUBLIC_CONST = \"public\";\n" + + " protected static final String PROTECTED_CONST = \"protected\";\n" + + " static final String DEFAULT_CONST = \"default\"; \n" + + " private static final String PRIVATE_CONST = \"private\"; \n" + + " /**\n" + + " * Values:\n" + + " * \n" + + " */\n" + + " public X() {\n" + + " }\n" + + "}\n" + }; + this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; + if (complianceLevel.equals(COMPLIANCE_1_3) || complianceLevel.equals(COMPLIANCE_1_4)) { + runNegativeTest(testFiles, + "----------\n" + + "1. ERROR in X.java (at line 9)\n" + + " *
  • {@value #PUBLIC_CONST}
  • \n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + + "----------\n" + + "2. ERROR in X.java (at line 10)\n" + + " *
  • {@value #PROTECTED_CONST}
  • \n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + + "----------\n" + + "3. ERROR in X.java (at line 11)\n" + + " *
  • {@value #DEFAULT_CONST}
  • \n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + + "----------\n" + + "4. ERROR in X.java (at line 12)\n" + + " *
  • {@value #PRIVATE_CONST}
  • \n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + + "----------\n" + ); + } else { + runNegativeTest(testFiles, + "----------\n" + + "1. ERROR in X.java (at line 10)\n" + + " *
  • {@value #PROTECTED_CONST}
  • \n" + + " ^^^^^^^^^^^^^^^^\n" + + "Javadoc: \'public\' visibility for malformed doc comments hides this \'protected\' reference\n" + + "----------\n" + + "2. ERROR in X.java (at line 11)\n" + + " *
  • {@value #DEFAULT_CONST}
  • \n" + + " ^^^^^^^^^^^^^^\n" + + "Javadoc: \'public\' visibility for malformed doc comments hides this \'default\' reference\n" + + "----------\n" + + "3. ERROR in X.java (at line 12)\n" + + " *
  • {@value #PRIVATE_CONST}
  • \n" + + " ^^^^^^^^^^^^^^\n" + + "Javadoc: \'public\' visibility for malformed doc comments hides this \'private\' reference\n" + + "----------\n" + ); + } + } } #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java,v retrieving revision 1.59 diff -u -r1.59 JavadocParser.java --- compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 19 Nov 2006 18:48:50 -0000 1.59 +++ compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 1 Dec 2006 18:03:09 -0000 @@ -558,7 +558,7 @@ } else { if (this.validValuePositions == -1) { if (this.invalidValuePositions != -1) { - if (this.reportProblems) this.sourceParser.problemReporter().javadocDuplicatedTag(tagName, (int) (this.invalidValuePositions>>>32), (int) this.invalidValuePositions); + if (this.reportProblems) this.sourceParser.problemReporter().javadocUnexpectedTag((int) (this.invalidValuePositions>>>32), (int) this.invalidValuePositions); } if (valid) { this.validValuePositions = (((long) this.tagSourceStart) << 32) + this.tagSourceEnd; @@ -567,7 +567,7 @@ this.invalidValuePositions = (((long) this.tagSourceStart) << 32) + this.tagSourceEnd; } } else { - if (this.reportProblems) this.sourceParser.problemReporter().javadocDuplicatedTag(tagName, this.tagSourceStart, this.tagSourceEnd); + if (this.reportProblems) this.sourceParser.problemReporter().javadocUnexpectedTag(this.tagSourceStart, this.tagSourceEnd); } } } else {