### Eclipse Workspace Patch 1.0 #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.74 diff -u -r1.74 JavadocParser.java --- compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 10 Sep 2008 08:43:23 -0000 1.74 +++ compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 11 Sep 2008 14:56:20 -0000 @@ -896,7 +896,7 @@ // Store nodes in arrays while (this.astLengthPtr >= 0) { int ptr = this.astLengthPtr % ORDERED_TAGS_NUMBER; - // Starting with the stack top, so get references (eg. Expression) coming from @see declarations + // Starting with the stack top, so get references (Expression) coming from @see declarations switch(ptr) { case SEE_TAG_EXPECTED_ORDER: int size = this.astLengthStack[this.astLengthPtr--]; @@ -905,7 +905,7 @@ } break; - // Then continuing with class names (eg. TypeReference) coming from @throw/@exception declarations + // Then continuing with class names (TypeReference) coming from @throw/@exception declarations case THROWS_TAG_EXPECTED_ORDER: size = this.astLengthStack[this.astLengthPtr--]; for (int i=0; i= stackLength) { + System.arraycopy( + this.astLengthStack, 0, + this.astLengthStack = new int[stackLength + AST_STACK_INCREMENT], 0, + stackLength); + } + this.astLengthStack[this.astLengthPtr] = 0; return; } #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.51 diff -u -r1.51 JavadocBugsTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 10 Sep 2008 08:43:22 -0000 1.51 +++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 11 Sep 2008 14:56:21 -0000 @@ -4126,3107 +4126,3381 @@ } /** - * Bug 87404: [javadoc] Unexpected not defined warning on constructor - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=87404" - */ -public void testBug87404() { - runConformTest( - new String[] { - "p/A.java", - "package p;\n" + - "class A {\n" + - " A(char c) {}\n" + - " class B {\n" + - " B(Exception ex) {}\n" + - " }\n" + - " void foo() {}\n" + - " /**\n" + - " * Link {@link #A(char)} OK \n" + - " * Link {@link #A(String)} OK\n" + - " * Link {@link #foo()} OK\n" + - " * Link {@link #bar()} OK\n" + - " */\n" + - " public A(String str) {}\n" + - " void bar() {}\n" + - "}" - } - ); -} - -/** - * Bug 90302: [javadoc] {@inheritedDoc} should be inactive for non-overridden method - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=90302" + * Bug 86769: [javadoc] Warn/Error for 'Missing javadoc comments' doesn't recognize private inner classes + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=86769" */ -public void testBug90302() { - this.reportMissingJavadocTags = CompilerOptions.ERROR; +public void testBug86769_Classes1() { + this.reportMissingJavadocComments = CompilerOptions.ERROR; + this.reportMissingJavadocCommentsVisibility = CompilerOptions.PROTECTED; runNegativeTest( new String[] { - "X.java", + "A.java", "/**\n" + - " * @see #foo(String)\n" + + " * Test bug 86769 \n" + " */\n" + - "public class X {\n" + - " /**\n" + - " * Static method\n" + - " * @param str\n" + - " * @return int\n" + - " * @throws NumberFormatException\n" + - " */\n" + - " static int foo(String str) throws NumberFormatException{\n" + - " return Integer.parseInt(str);\n" + + "public class A {\n" + + " private class Level1Private {\n" + + " private class Level2_PrivPriv {}\n" + + " class Level2_PrivDef {}\n" + + " protected class Level2_PrivPro {}\n" + + " public class Level2_PrivPub {}\n" + " }\n" + - "}\n", - "Y.java", - "/**\n" + - " * @see #foo(String)\n" + - " */\n" + - "public class Y extends X { \n" + - " /**\n" + - " * Static method: does not override super\n" + - " * {@inheritDoc}\n" + - " */\n" + - " static int foo(String str) throws NumberFormatException{\n" + - " return Integer.parseInt(str);\n" + + " class Level1Default{\n" + + " private class Level2_DefPriv {}\n" + + " class Level2_DefDef {}\n" + + " protected class Level2_DefPro {}\n" + + " public class Level2_DefPub {}\n" + + " }\n" + + " protected class Level1Protected {\n" + + " private class Level2_ProtPriv {}\n" + + " class Level2_ProDef {}\n" + + " protected class Level2_ProPro {}\n" + + " public class Level2_ProPub {} \n" + + " }\n" + + " public class Level1Public {\n" + + " private class Level2_PubPriv {}\n" + + " class Level2_PubDef {}\n" + + " protected class Level2_PubPro {}\n" + + " public class Level2_PubPub {}\n" + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in Y.java (at line 7)\n" + - " * {@inheritDoc}\n" + - " ^^^^^^^^^^\n" + - "Javadoc: Unexpected tag\n" + + "1. ERROR in A.java (at line 17)\n" + + " protected class Level1Protected {\n" + + " ^^^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for protected declaration\n" + "----------\n" + - "2. ERROR in Y.java (at line 9)\n" + - " static int foo(String str) throws NumberFormatException{\n" + - " ^^^\n" + - "Javadoc: Missing tag for return type\n" + + "2. ERROR in A.java (at line 20)\n" + + " protected class Level2_ProPro {}\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for protected declaration\n" + "----------\n" + - "3. ERROR in Y.java (at line 9)\n" + - " static int foo(String str) throws NumberFormatException{\n" + - " ^^^\n" + - "Javadoc: Missing tag for parameter str\n" + + "3. ERROR in A.java (at line 21)\n" + + " public class Level2_ProPub {} \n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for protected declaration\n" + "----------\n" + - "4. ERROR in Y.java (at line 9)\n" + - " static int foo(String str) throws NumberFormatException{\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Missing tag for declared exception NumberFormatException\n" + + "4. ERROR in A.java (at line 23)\n" + + " public class Level1Public {\n" + + " ^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for public declaration\n" + + "----------\n" + + "5. ERROR in A.java (at line 26)\n" + + " protected class Level2_PubPro {}\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for protected declaration\n" + + "----------\n" + + "6. ERROR in A.java (at line 27)\n" + + " public class Level2_PubPub {}\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for public declaration\n" + "----------\n", JavacTestOptions.Excuse.EclipseWarningConfiguredAsError ); } -public void testBug90302b() { - this.reportMissingJavadocTags = CompilerOptions.ERROR; +public void testBug86769_Classes2() { + this.reportMissingJavadocComments = CompilerOptions.ERROR; + this.reportMissingJavadocCommentsVisibility = CompilerOptions.DEFAULT; runNegativeTest( new String[] { - "X.java", - "/** */\n" + - "public class X {\n" + - "}\n", - "Y.java", + "B.java", "/**\n" + - " * @see #foo(String)\n" + + " * Test bug 86769\n" + " */\n" + - "public class Y extends X { \n" + - " /**\n" + - " * Simple method: does not override super\n" + - " * {@inheritDoc}\n" + - " */\n" + - " static int foo(String str) throws NumberFormatException{\n" + - " return Integer.parseInt(str);\n" + + "public class B {\n" + + " class Level0_Default {\n" + + " private class Level1Private {\n" + + " private class Level2_PrivPriv {}\n" + + " class Level2_PrivDef {}\n" + + " protected class Level2_PrivPro {}\n" + + " public class Level2_PrivPub {}\n" + + " }\n" + + " }\n" + + " public class Level0_Public {\n" + + " class Level1Default{\n" + + " private class Level2_DefPriv {}\n" + + " class Level2_DefDef {}\n" + + " protected class Level2_DefPro {}\n" + + " public class Level2_DefPub {}\n" + + " }\n" + + " }\n" + + " protected class Level0_Protected {\n" + + " protected class Level1Protected {\n" + + " private class Level2_ProtPriv {}\n" + + " class Level2_ProDef {}\n" + + " protected class Level2_ProPro {}\n" + + " public class Level2_ProPub {} \n" + + " }\n" + + " }\n" + + " private class Level0_Private {\n" + + " public class Level1Public {\n" + + " private class Level2_PubPriv {}\n" + + " class Level2_PubDef {}\n" + + " protected class Level2_PubPro {}\n" + + " public class Level2_PubPub {}\n" + + " }\n" + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in Y.java (at line 7)\n" + - " * {@inheritDoc}\n" + - " ^^^^^^^^^^\n" + - "Javadoc: Unexpected tag\n" + + "1. ERROR in B.java (at line 5)\n" + + " class Level0_Default {\n" + + " ^^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for default declaration\n" + "----------\n" + - "2. ERROR in Y.java (at line 9)\n" + - " static int foo(String str) throws NumberFormatException{\n" + - " ^^^\n" + - "Javadoc: Missing tag for return type\n" + + "2. ERROR in B.java (at line 13)\n" + + " public class Level0_Public {\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for public declaration\n" + "----------\n" + - "3. ERROR in Y.java (at line 9)\n" + - " static int foo(String str) throws NumberFormatException{\n" + - " ^^^\n" + - "Javadoc: Missing tag for parameter str\n" + + "3. ERROR in B.java (at line 14)\n" + + " class Level1Default{\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for default declaration\n" + "----------\n" + - "4. ERROR in Y.java (at line 9)\n" + - " static int foo(String str) throws NumberFormatException{\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Missing tag for declared exception NumberFormatException\n" + + "4. ERROR in B.java (at line 16)\n" + + " class Level2_DefDef {}\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for default declaration\n" + + "----------\n" + + "5. ERROR in B.java (at line 17)\n" + + " protected class Level2_DefPro {}\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for default declaration\n" + + "----------\n" + + "6. ERROR in B.java (at line 18)\n" + + " public class Level2_DefPub {}\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for default declaration\n" + + "----------\n" + + "7. ERROR in B.java (at line 21)\n" + + " protected class Level0_Protected {\n" + + " ^^^^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for protected declaration\n" + + "----------\n" + + "8. ERROR in B.java (at line 22)\n" + + " protected class Level1Protected {\n" + + " ^^^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for protected declaration\n" + + "----------\n" + + "9. ERROR in B.java (at line 24)\n" + + " class Level2_ProDef {}\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for default declaration\n" + + "----------\n" + + "10. ERROR in B.java (at line 25)\n" + + " protected class Level2_ProPro {}\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for protected declaration\n" + + "----------\n" + + "11. ERROR in B.java (at line 26)\n" + + " public class Level2_ProPub {} \n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for protected declaration\n" + "----------\n", JavacTestOptions.Excuse.EclipseWarningConfiguredAsError ); } - -/** - * Bug 103304: [Javadoc] Wrong reference proposal for inner classes. - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=103304" - */ -public void testBug103304a_public() { - String[] units = new String[] { - "boden/IAFAState.java", - "package boden;\n" + - "public interface IAFAState {\n" + - " public class ValidationException extends Exception {\n" + - " public ValidationException(String variableName, IAFAState subformula) {\n" + - " super(\"Variable \'\"+variableName+\"\' may be unbound in \'\"+subformula+\"\'\");\n" + - " }\n" + - " public void method() {}\n" + - " }\n" + - " /**\n" + - " * Validates a formula for consistent bindings. Bindings are consistent, when at each point in time,\n" + - " * the set of povided variables can be guaranteed to be a superset of the set of required variables.\n" + - " * @throws ValidationException Thrown if a variable is unbound. \n" + - " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + - " * @see IAFAState.ValidationException#method()\n" + - " * @see ValidationException\n" + - " * {@link ValidationException}\n" + - " */\n" + - " public void validate() throws ValidationException;\n" + - "}\n", - "boden/TestValid.java", - "package boden;\n" + - "import boden.IAFAState.ValidationException;\n" + +public void testBug86769_Field1() { + this.reportMissingJavadocComments = CompilerOptions.ERROR; + this.reportMissingJavadocCommentsVisibility = CompilerOptions.PUBLIC; + runNegativeTest( + new String[] { + "A.java", "/**\n" + - " * @see ValidationException\n" + - " * @see IAFAState.ValidationException\n" + + " * Test bug 86769\n" + " */\n" + - "public class TestValid {\n" + - " /** \n" + - " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + - " */\n" + - " IAFAState.ValidationException valid1;\n" + - " /**\n" + - " * @see IAFAState.ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + - " */\n" + - " IAFAState.ValidationException valid2;\n" + + "public class A {\n" + + " private class InnerPrivate {\n" + + " private int pri_pri;\n" + + " int pri_def;\n" + + " protected int pri_pro;\n" + + " public int pri_pub;\n" + + " }\n" + + " class InnerDefault{\n" + + " private int def_pri;\n" + + " int def_def;\n" + + " protected int def_pro;\n" + + " public int def_pub;\n" + + " }\n" + + " protected class InnerProtected {\n" + + " private int pro_pri;\n" + + " int pro_def;\n" + + " protected int pro_pro;\n" + + " public int pro_pub; \n" + + " }\n" + + " public class InnerPublic {\n" + + " private int pub_pri;\n" + + " int pub_def;\n" + + " protected int pub_pro;\n" + + " public int pub_pub;\n" + + " }\n" + "}\n" - }; - if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units, - //boden\TestValid.java:8: warning - Tag @see: reference not found: ValidationException - "----------\n" + - "1. ERROR in boden\\TestValid.java (at line 4)\n" + - " * @see ValidationException\n" + - " ^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "2. ERROR in boden\\TestValid.java (at line 9)\n" + - " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + - " ^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); - } else { - runConformTest(units); - } + }, + "----------\n" + + "1. ERROR in A.java (at line 23)\n" + + " public class InnerPublic {\n" + + " ^^^^^^^^^^^\n" + + "Javadoc: Missing comment for public declaration\n" + + "----------\n" + + "2. ERROR in A.java (at line 27)\n" + + " public int pub_pub;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for public declaration\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); } - -public void testBug103304a_private() { - String[] units = new String[] { - "boden/IAFAState.java", - "package boden;\n" + - "public interface IAFAState {\n" + - " public class ValidationException extends Exception {\n" + - " public ValidationException(String variableName, IAFAState subformula) {\n" + - " super(\"Variable \'\"+variableName+\"\' may be unbound in \'\"+subformula+\"\'\");\n" + - " }\n" + - " public void method() {}\n" + - " }\n" + - " /**\n" + - " * Validates a formula for consistent bindings. Bindings are consistent, when at each point in time,\n" + - " * the set of povided variables can be guaranteed to be a superset of the set of required variables.\n" + - " * @throws ValidationException Thrown if a variable is unbound. \n" + - " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + - " * @see IAFAState.ValidationException#method()\n" + - " * @see ValidationException\n" + - " * {@link ValidationException}\n" + - " */\n" + - " public void validate() throws ValidationException;\n" + - "}\n", - "boden/TestValid.java", - "package boden;\n" + - "import boden.IAFAState.ValidationException;\n" + +public void testBug86769_Fields2() { + this.reportMissingJavadocComments = CompilerOptions.ERROR; + this.reportMissingJavadocCommentsVisibility = CompilerOptions.PRIVATE; + runNegativeTest( + new String[] { + "B.java", "/**\n" + - " * @see ValidationException\n" + - " * @see IAFAState.ValidationException\n" + + " * Test bug 86769\n" + " */\n" + - "public class TestValid {\n" + - " /** \n" + - " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + - " */\n" + - " IAFAState.ValidationException valid1;\n" + - " /**\n" + - " * @see IAFAState.ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + - " */\n" + - " IAFAState.ValidationException valid2;\n" + - "}\n" - }; - if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units, - //boden\TestValid.java:8: warning - Tag @see: reference not found: ValidationException - //boden\TestValid.java:12: warning - Tag @see: reference not found: ValidationException#IAFAState.ValidationException(String, IAFAState) - "----------\n" + - "1. ERROR in boden\\TestValid.java (at line 4)\n" + - " * @see ValidationException\n" + - " ^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "2. ERROR in boden\\TestValid.java (at line 9)\n" + - " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + - " ^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); - } else { - runConformTest(units); - } -} - -public void testBug103304b() { - this.reportInvalidJavadocVisibility = CompilerOptions.PRIVATE; - String[] units = new String[] { - "boden/IAFAState.java", - "package boden;\n" + - "public interface IAFAState {\n" + - " public class ValidationException extends Exception {\n" + - " public ValidationException(String variableName, IAFAState subformula) {\n" + - " super(\"Variable \'\"+variableName+\"\' may be unbound in \'\"+subformula+\"\'\");\n" + - " }\n" + - " public void method() {}\n" + - " }\n" + - "}\n", - "boden/TestInvalid1.java", - "package boden;\n" + - "import boden.IAFAState.ValidationException;\n" + - "public class TestInvalid1 {\n" + - " /** \n" + - " * @see ValidationException#ValidationException(String, IAFAState)\n" + - " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + - " */ \n" + - " IAFAState.ValidationException invalid;\n" + - "}\n", - "boden/TestInvalid2.java", - "package boden;\n" + - "public class TestInvalid2 {\n" + - " /**\n" + - " * @see IAFAState.ValidationException#ValidationException(String, IAFAState)\n" + - " */\n" + - " IAFAState.ValidationException invalid;\n" + - "}\n", - "boden/TestInvalid3.java", - "package boden;\n" + - "import boden.IAFAState.ValidationException;\n" + - "public class TestInvalid3 {\n" + - " /**\n" + - " * @see IAFAState.ValidationException#IAFA.State.ValidationException(String, IAFAState)\n" + - " */\n" + - " IAFAState.ValidationException invalid;\n" + - "}\n", - "boden/TestInvalid4.java", - "package boden;\n" + - "import boden.IAFAState.ValidationException;\n" + - "public class TestInvalid4 {\n" + - " /**\n" + - " * @see IAFAState.ValidationException#IAFAState .ValidationException(String, IAFAState)\n" + - " */\n" + - " IAFAState.ValidationException invalid;\n" + + "public class B {\n" + + " private class Level1 {\n" + + " private class InnerPrivate {\n" + + " private int pri_pri;\n" + + " int pri_def;\n" + + " protected int pri_pro;\n" + + " public int pri_pub;\n" + + " }\n" + + " class InnerDefault{\n" + + " private int def_pri;\n" + + " int def_def;\n" + + " protected int def_pro;\n" + + " public int def_pub;\n" + + " }\n" + + " protected class InnerProtected {\n" + + " private int pro_pri;\n" + + " int pro_def;\n" + + " protected int pro_pro;\n" + + " public int pro_pub; \n" + + " }\n" + + " public class InnerPublic {\n" + + " private int pub_pri;\n" + + " int pub_def;\n" + + " protected int pub_pro;\n" + + " public int pub_pub;\n" + + " }\n" + + " }\n" + "}\n" - }; - String errors_14 = new String ( - //boden\TestInvalid1.java:7: warning - Tag @see: reference not found: ValidationException#ValidationException(String, IAFAState) - //boden\TestInvalid1.java:8: warning - Tag @see: reference not found: ValidationException#IAFAState.ValidationException(String, IAFAState) - //boden\TestInvalid2.java:6: warning - Tag @see: can't find ValidationException(String, IAFAState) in boden.IAFAState.ValidationException => bug ID: 4288720 - //boden\TestInvalid3.java:6: warning - Tag @see: can't find IAFA.State.ValidationException(String, IAFAState) in boden.IAFAState.ValidationException - //boden\TestInvalid4.java:6: warning - Tag @see: can't find IAFAState in boden.IAFAState.ValidationException - "----------\n" + - "1. ERROR in boden\\TestInvalid1.java (at line 5)\n" + - " * @see ValidationException#ValidationException(String, IAFAState)\n" + - " ^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "2. ERROR in boden\\TestInvalid1.java (at line 6)\n" + - " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + - " ^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "----------\n" + - "1. ERROR in boden\\TestInvalid3.java (at line 5)\n" + - " * @see IAFAState.ValidationException#IAFA.State.ValidationException(String, IAFAState)\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "----------\n" + - "1. ERROR in boden\\TestInvalid4.java (at line 5)\n" + - " * @see IAFAState.ValidationException#IAFAState .ValidationException(String, IAFAState)\n" + - " ^^^^^^^^^\n" + - "Javadoc: IAFAState cannot be resolved or is not a field\n" + - "----------\n" - ); - String errors_50 = new String ( - //boden\TestInvalid1.java:7: warning - Tag @see: reference not found: ValidationException#ValidationException(String, IAFAState) - //boden\TestInvalid2.java:6: warning - Tag @see: can't find ValidationException(String, IAFAState) in boden.IAFAState.ValidationException => bug ID: 4288720 - //boden\TestInvalid3.java:6: warning - Tag @see: can't find IAFA.State.ValidationException(String, IAFAState) in boden.IAFAState.ValidationException - //boden\TestInvalid4.java:6: warning - Tag @see: can't find IAFAState in boden.IAFAState.ValidationException - "----------\n" + - "1. ERROR in boden\\TestInvalid3.java (at line 5)\n" + - " * @see IAFAState.ValidationException#IAFA.State.ValidationException(String, IAFAState)\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "----------\n" + - "1. ERROR in boden\\TestInvalid4.java (at line 5)\n" + - " * @see IAFAState.ValidationException#IAFAState .ValidationException(String, IAFAState)\n" + - " ^^^^^^^^^\n" + - "Javadoc: IAFAState cannot be resolved or is not a field\n" + - "----------\n" + }, + "----------\n" + + "1. ERROR in B.java (at line 5)\n" + + " private class Level1 {\n" + + " ^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "2. ERROR in B.java (at line 6)\n" + + " private class InnerPrivate {\n" + + " ^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "3. ERROR in B.java (at line 7)\n" + + " private int pri_pri;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "4. ERROR in B.java (at line 8)\n" + + " int pri_def;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "5. ERROR in B.java (at line 9)\n" + + " protected int pri_pro;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "6. ERROR in B.java (at line 10)\n" + + " public int pri_pub;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "7. ERROR in B.java (at line 12)\n" + + " class InnerDefault{\n" + + " ^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "8. ERROR in B.java (at line 13)\n" + + " private int def_pri;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "9. ERROR in B.java (at line 14)\n" + + " int def_def;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "10. ERROR in B.java (at line 15)\n" + + " protected int def_pro;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "11. ERROR in B.java (at line 16)\n" + + " public int def_pub;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "12. ERROR in B.java (at line 18)\n" + + " protected class InnerProtected {\n" + + " ^^^^^^^^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "13. ERROR in B.java (at line 19)\n" + + " private int pro_pri;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "14. ERROR in B.java (at line 20)\n" + + " int pro_def;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "15. ERROR in B.java (at line 21)\n" + + " protected int pro_pro;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "16. ERROR in B.java (at line 22)\n" + + " public int pro_pub; \n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "17. ERROR in B.java (at line 24)\n" + + " public class InnerPublic {\n" + + " ^^^^^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "18. ERROR in B.java (at line 25)\n" + + " private int pub_pri;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "19. ERROR in B.java (at line 26)\n" + + " int pub_def;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "20. ERROR in B.java (at line 27)\n" + + " protected int pub_pro;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n" + + "21. ERROR in B.java (at line 28)\n" + + " public int pub_pub;\n" + + " ^^^^^^^\n" + + "Javadoc: Missing comment for private declaration\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError ); - if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units, errors_14); - } else { - runNegativeTest(units, errors_50, JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); - } - } -public void testBug103304c() { - runConformTest( +public void testBug86769_Metthods1() { + this.reportMissingJavadocComments = CompilerOptions.ERROR; + this.reportMissingJavadocCommentsVisibility = CompilerOptions.PUBLIC; + runNegativeTest( new String[] { - "test/Test.java", - "package test;\n" + - "public interface Test {\n" + - " public class Level0 {\n" + - " public Level0() {}\n" + + "A.java", + "/**\n" + + " * Test bug 86769\n" + + " */\n" + + "public class A {\n" + + " private class InnerPrivate {\n" + + " private void pri_pri() {}\n" + + " void pri_def() {}\n" + + " protected void pri_pro() {}\n" + + " public void pri_pub() {}\n" + " }\n" + - " public interface Member {\n" + - " public class Level1 {\n" + - " public Level1() {}\n" + - " }\n" + + " class InnerDefault{\n" + + " private void def_pri() {}\n" + + " void def_def() {}\n" + + " protected void def_pro() {}\n" + + " public void def_pub() {}\n" + " }\n" + - "}\n", - "test/C.java", - "package test;\n" + - "public class C {\n" + - " /**\n" + - " * @see Test.Level0#Test.Level0()\n" + - " */\n" + - " Test.Level0 valid = new Test.Level0();\n" + - " /**\n" + - " * @see Test.Level0#Level0()\n" + - " */\n" + - " Test.Level0 invalid = new Test.Level0();\n" + - "}\n" - } - //test\C.java:10: warning - Tag @see: can't find Level0() in test.Test.Level0 => bug ID: 4288720 - ); -} -public void testBug103304d() { - runNegativeTest( - new String[] { - "test/Test.java", - "package test;\n" + - "public interface Test {\n" + - " public class Level0 {\n" + - " public Level0() {}\n" + + " protected class InnerProtected {\n" + + " private void pro_pri() {}\n" + + " void pro_def() {}\n" + + " protected void pro_pro() {}\n" + + " public void pro_pub() {} \n" + " }\n" + - " public interface Member {\n" + - " public class Level1 {\n" + - " public Level1() {}\n" + - " }\n" + + " public class InnerPublic {\n" + + " private void pub_pri() {}\n" + + " void pub_def() {}\n" + + " protected void pub_pro() {}\n" + + " public void pub_pub() {}\n" + " }\n" + - "}\n", - "test/C2.java", - "package test;\n" + - "public class C2 {\n" + - " /**\n" + - " * @see Test.Member.Level1#Test.Member.Level1()\n" + - " */\n" + - " Test.Member.Level1 valid = new Test.Member.Level1();\n" + - " /**\n" + - " * @see Test.Member.Level1#Level1()\n" + - " */\n" + - " Test.Member.Level1 invalid = new Test.Member.Level1();\n" + - " /**\n" + - " * @see Test.Member.Level1#Test.Level1()\n" + - " */\n" + - " Test.Member.Level1 wrong = new Test.Member.Level1();\n" + "}\n" }, - //test\C2.java:10: warning - Tag @see: can't find Level1() in test.Test.Member.Level1 => Bug ID: 4288720 - //test\C2.java:14: warning - Tag @see: can't find Test.Level1() in test.Test.Member.Level1 "----------\n" + - "1. ERROR in test\\C2.java (at line 12)\n" + - " * @see Test.Member.Level1#Test.Level1()\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + + "1. ERROR in A.java (at line 23)\n" + + " public class InnerPublic {\n" + + " ^^^^^^^^^^^\n" + + "Javadoc: Missing comment for public declaration\n" + + "----------\n" + + "2. ERROR in A.java (at line 27)\n" + + " public void pub_pub() {}\n" + + " ^^^^^^^^^\n" + + "Javadoc: Missing comment for public declaration\n" + "----------\n", JavacTestOptions.Excuse.EclipseWarningConfiguredAsError ); } -public void testBug103304e() { +public void testBug86769_Methods2() { + this.reportMissingJavadocComments = CompilerOptions.ERROR; + this.reportMissingJavadocCommentsVisibility = CompilerOptions.PROTECTED; runConformTest( new String[] { - "implicit/Valid.java", - "package implicit;\n" + - "public interface Valid {\n" + - " public class Level0 {\n" + - " /**\n" + - " * @see #Valid.Level0() Valid\n" + - " */\n" + - " public Level0() {}\n" + - " /**\n" + - " * @see #Valid.Level0(String) Valid\n" + - " */\n" + - " public Level0(String str) {}\n" + - " }\n" + - " public interface Member {\n" + - " public class Level1 {\n" + - " /**\n" + - " * @see #Valid.Member.Level1() Valid\n" + - " */\n" + - " public Level1() {}\n" + - " /**\n" + - " * @see #Valid.Member.Level1(int) Valid\n" + - " */\n" + - " public Level1(int x) {}\n" + + "B.java", + "/**\n" + + " * Test bug 86769\n" + + " */\n" + + "public class B {\n" + + " private class Level1 {\n" + + " private class InnerPrivate {\n" + + " private void pri_pri() {}\n" + + " void pri_def() {}\n" + + " protected void pri_pro() {}\n" + + " public void pri_pub() {}\n" + " }\n" + - " }\n" + - "}\n" - } - ); -} -public void testBug103304f() { - runNegativeTest( - new String[] { - "implicit/Invalid.java", - "package implicit;\n" + - "public interface Invalid {\n" + - " public class Level0 {\n" + - " /**\n" + - " * @see #Level0() Invalid\n" + - " */\n" + - " public Level0() {}\n" + - " /**\n" + - " * @see #Level0(String) Invalid\n" + - " */\n" + - " public Level0(String str) {}\n" + - " }\n" + - " public interface Member {\n" + - " public class Level1 {\n" + - " /**\n" + - " * @see #Level1() Invalid\n" + - " * @see #Member.Level1() Invalid\n" + - " * @see #Invalid.Level1() Invalid\n" + - " */\n" + - " public Level1() {}\n" + - " /**\n" + - " * @see #Level1(int) Invalid\n" + - " * @see #Invalid.Level1(int) Invalid\n" + - " * @see #Member.Level1(int) Invalid\n" + - " */\n" + - " public Level1(int x) {}\n" + + " class InnerDefault{\n" + + " private void def_pri() {}\n" + + " void def_def() {}\n" + + " protected void def_pro() {}\n" + + " public void def_pub() {}\n" + + " }\n" + + " protected class InnerProtected {\n" + + " private void pro_pri() {}\n" + + " void pro_def() {}\n" + + " protected void pro_pro() {}\n" + + " public void pro_pub() {} \n" + + " }\n" + + " public class InnerPublic {\n" + + " private void pub_pri() {}\n" + + " void pub_def() {}\n" + + " protected void pub_pro() {}\n" + + " public void pub_pub() {}\n" + " }\n" + " }\n" + "}\n" - }, - //implicit\Invalid.java:7: warning - Tag @see: can't find Level0() in implicit.Invalid.Level0 => bug ID: 4288720 - //implicit\Invalid.java:11: warning - Tag @see: can't find Level0(String) in implicit.Invalid.Level0 => bug ID: 4288720 - //implicit\Invalid.java:20: warning - Tag @see: can't find Level1() in implicit.Invalid.Member.Level1 => bug ID: 4288720 - //implicit\Invalid.java:20: warning - Tag @see: can't find Member.Level1() in implicit.Invalid.Member.Level1 - //implicit\Invalid.java:20: warning - Tag @see: can't find Invalid.Level1() in implicit.Invalid.Member.Level1 - //implicit\Invalid.java:26: warning - Tag @see: can't find Level1(int) in implicit.Invalid.Member.Level1 => bug ID: 4288720 - //implicit\Invalid.java:26: warning - Tag @see: can't find Invalid.Level1(int) in implicit.Invalid.Member.Level1 - //implicit\Invalid.java:26: warning - Tag @see: can't find Member.Level1(int) in implicit.Invalid.Member.Level1 - "----------\n" + - "1. ERROR in implicit\\Invalid.java (at line 17)\n" + - " * @see #Member.Level1() Invalid\n" + - " ^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "2. ERROR in implicit\\Invalid.java (at line 18)\n" + - " * @see #Invalid.Level1() Invalid\n" + - " ^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "3. ERROR in implicit\\Invalid.java (at line 23)\n" + - " * @see #Invalid.Level1(int) Invalid\n" + - " ^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "4. ERROR in implicit\\Invalid.java (at line 24)\n" + - " * @see #Member.Level1(int) Invalid\n" + - " ^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + } ); } /** - * Bug 116464: [javadoc] Unicode tag name are not correctly parsed - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=116464" + * Bug 87404: [javadoc] Unexpected not defined warning on constructor + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=87404" */ -public void testBug116464() { - this.reportMissingJavadocTags = CompilerOptions.ERROR; +public void testBug87404() { runConformTest( new String[] { - "X.java", - "public class X {\n" + - " /**\n" + - " * @\\u0070\\u0061\\u0072\\u0061\\u006d str xxx\n" + - " */\n" + - " void foo(String str) {}\n" + - "}\n" + "p/A.java", + "package p;\n" + + "class A {\n" + + " A(char c) {}\n" + + " class B {\n" + + " B(Exception ex) {}\n" + + " }\n" + + " void foo() {}\n" + + " /**\n" + + " * Link {@link #A(char)} OK \n" + + " * Link {@link #A(String)} OK\n" + + " * Link {@link #foo()} OK\n" + + " * Link {@link #bar()} OK\n" + + " */\n" + + " public A(String str) {}\n" + + " void bar() {}\n" + + "}" } ); } /** - * Bug 125903: [javadoc] Treat whitespace in javadoc tags as invalid tags - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=125903" + * Bug 90302: [javadoc] {@inheritedDoc} should be inactive for non-overridden method + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=90302" */ -public void testBug125903() { +public void testBug90302() { this.reportMissingJavadocTags = CompilerOptions.ERROR; runNegativeTest( new String[] { "X.java", "/**\n" + - " * {@ link java.lang.String}\n" + - " * @ since 2.1\n" + + " * @see #foo(String)\n" + " */\n" + "public class X {\n" + + " /**\n" + + " * Static method\n" + + " * @param str\n" + + " * @return int\n" + + " * @throws NumberFormatException\n" + + " */\n" + + " static int foo(String str) throws NumberFormatException{\n" + + " return Integer.parseInt(str);\n" + + " }\n" + + "}\n", + "Y.java", + "/**\n" + + " * @see #foo(String)\n" + + " */\n" + + "public class Y extends X { \n" + + " /**\n" + + " * Static method: does not override super\n" + + " * {@inheritDoc}\n" + + " */\n" + + " static int foo(String str) throws NumberFormatException{\n" + + " return Integer.parseInt(str);\n" + + " }\n" + "}\n" }, "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " * {@ link java.lang.String}\n" + - " ^^\n" + - "Javadoc: Invalid tag\n" + + "1. ERROR in Y.java (at line 7)\n" + + " * {@inheritDoc}\n" + + " ^^^^^^^^^^\n" + + "Javadoc: Unexpected tag\n" + "----------\n" + - "2. ERROR in X.java (at line 3)\n" + - " * @ since 2.1\n" + - " ^^\n" + - "Javadoc: Invalid tag\n" + + "2. ERROR in Y.java (at line 9)\n" + + " static int foo(String str) throws NumberFormatException{\n" + + " ^^^\n" + + "Javadoc: Missing tag for return type\n" + + "----------\n" + + "3. ERROR in Y.java (at line 9)\n" + + " static int foo(String str) throws NumberFormatException{\n" + + " ^^^\n" + + "Javadoc: Missing tag for parameter str\n" + + "----------\n" + + "4. ERROR in Y.java (at line 9)\n" + + " static int foo(String str) throws NumberFormatException{\n" + + " ^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Missing tag for declared exception NumberFormatException\n" + "----------\n", JavacTestOptions.Excuse.EclipseWarningConfiguredAsError ); } - -/** - * Bug 128954: Javadoc problems with category CAT_INTERNAL - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=128954" - */ -public void testBug128954() { - this.reportInvalidJavadoc = CompilerOptions.WARNING; - this.reportDeprecation = CompilerOptions.WARNING; +public void testBug90302b() { + this.reportMissingJavadocTags = CompilerOptions.ERROR; runNegativeTest( new String[] { - "X.java", //======================== + "X.java", + "/** */\n" + "public class X {\n" + + "}\n", + "Y.java", + "/**\n" + + " * @see #foo(String)\n" + + " */\n" + + "public class Y extends X { \n" + " /**\n" + - " * @see p.A#bar()\n" + + " * Simple method: does not override super\n" + + " * {@inheritDoc}\n" + " */\n" + - " void foo() {\n" + - " Zork z;\n" + - " }\n" + - "}\n", - "p/A.java", //======================== - "package p;\n" + - "public class A {\n" + - " /** @deprecated */\n" + - " public void bar() {\n" + + " static int foo(String str) throws NumberFormatException{\n" + + " return Integer.parseInt(str);\n" + " }\n" + "}\n" }, "----------\n" + - "1. WARNING in X.java (at line 3)\n" + - " * @see p.A#bar()\n" + - " ^^^^^\n" + - "[@cat:javadoc] Javadoc: The method bar() from the type A is deprecated\n" + + "1. ERROR in Y.java (at line 7)\n" + + " * {@inheritDoc}\n" + + " ^^^^^^^^^^\n" + + "Javadoc: Unexpected tag\n" + "----------\n" + - "2. ERROR in X.java (at line 6)\n" + - " Zork z;\n" + - " ^^^^\n" + - "[@cat:type] Zork cannot be resolved to a type\n" + - "----------\n", - null, - true, - null, - false, - true, - true); -} - -/** - * Bug 128954: Javadoc problems with category CAT_INTERNAL - variation - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=128954" - */ -public void testBug128954a() { - this.reportInvalidJavadoc = CompilerOptions.WARNING; - this.reportDeprecation = CompilerOptions.WARNING; - runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " \n" + - " /**\n" + - " * @see p.A#bar()\n" + - " */\n" + - " void foo() {\n" + - " Zork z;\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. WARNING in X.java (at line 4)\n" + - " * @see p.A#bar()\n" + + "2. ERROR in Y.java (at line 9)\n" + + " static int foo(String str) throws NumberFormatException{\n" + " ^^^\n" + - "[@cat:javadoc] Javadoc: p cannot be resolved to a type\n" + + "Javadoc: Missing tag for return type\n" + "----------\n" + - "2. ERROR in X.java (at line 7)\n" + - " Zork z;\n" + - " ^^^^\n" + - "[@cat:type] Zork cannot be resolved to a type\n" + + "3. ERROR in Y.java (at line 9)\n" + + " static int foo(String str) throws NumberFormatException{\n" + + " ^^^\n" + + "Javadoc: Missing tag for parameter str\n" + + "----------\n" + + "4. ERROR in Y.java (at line 9)\n" + + " static int foo(String str) throws NumberFormatException{\n" + + " ^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Missing tag for declared exception NumberFormatException\n" + "----------\n", - null, - true, - null, - false, - true, - true); + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); } /** - * Bug 129241: [Javadoc] deprecation warning wrongly reported when ignoring Malformed Javadoc comments - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=129241" + * Bug 103304: [Javadoc] Wrong reference proposal for inner classes. + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=103304" */ -public void testBug129241a() { - runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " /**\n" + - " * @see p.A#bar\n" + - " */\n" + - " void foo() {}\n" + +public void testBug103304a_public() { + String[] units = new String[] { + "boden/IAFAState.java", + "package boden;\n" + + "public interface IAFAState {\n" + + " public class ValidationException extends Exception {\n" + + " public ValidationException(String variableName, IAFAState subformula) {\n" + + " super(\"Variable \'\"+variableName+\"\' may be unbound in \'\"+subformula+\"\'\");\n" + + " }\n" + + " public void method() {}\n" + + " }\n" + + " /**\n" + + " * Validates a formula for consistent bindings. Bindings are consistent, when at each point in time,\n" + + " * the set of povided variables can be guaranteed to be a superset of the set of required variables.\n" + + " * @throws ValidationException Thrown if a variable is unbound. \n" + + " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + + " * @see IAFAState.ValidationException#method()\n" + + " * @see ValidationException\n" + + " * {@link ValidationException}\n" + + " */\n" + + " public void validate() throws ValidationException;\n" + "}\n", - "p/A.java", - "package p;\n" + - "/** @deprecated */\n" + - "public class A {\n" + - " void bar() {}\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " * @see p.A#bar\n" + - " ^^^\n" + - "Javadoc: The type A is deprecated\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); -} -public void testBug129241b() { - this.reportDeprecation = CompilerOptions.IGNORE; - runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " /**\n" + - " * @see p.A#bar\n" + + "boden/TestValid.java", + "package boden;\n" + + "import boden.IAFAState.ValidationException;\n" + + "/**\n" + + " * @see ValidationException\n" + + " * @see IAFAState.ValidationException\n" + + " */\n" + + "public class TestValid {\n" + + " /** \n" + + " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + " */\n" + - " void foo() {}\n" + - "}\n", - "p/A.java", - "package p;\n" + - "/** @deprecated */\n" + - "public class A {\n" + - " void bar() {}\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " * @see p.A#bar\n" + - " ^^^\n" + - "Javadoc: The type A is deprecated\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); -} -public void testBug129241c() { - this.reportJavadocDeprecation = CompilerOptions.DISABLED; - runConformTest( - new String[] { - "X.java", - "public class X {\n" + + " IAFAState.ValidationException valid1;\n" + " /**\n" + - " * @see p.A#bar\n" + + " * @see IAFAState.ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + " */\n" + - " void foo() {}\n" + - "}\n", - "p/A.java", - "package p;\n" + - "/** @deprecated */\n" + - "public class A {\n" + - " void bar() {}\n" + + " IAFAState.ValidationException valid2;\n" + "}\n" - } - ); + }; + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(units, + //boden\TestValid.java:8: warning - Tag @see: reference not found: ValidationException + "----------\n" + + "1. ERROR in boden\\TestValid.java (at line 4)\n" + + " * @see ValidationException\n" + + " ^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "2. ERROR in boden\\TestValid.java (at line 9)\n" + + " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + + " ^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); + } else { + runConformTest(units); + } } -public void testBug129241d() { - this.reportInvalidJavadoc = CompilerOptions.IGNORE; - runConformTest( - new String[] { - "X.java", - "public class X {\n" + + +public void testBug103304a_private() { + String[] units = new String[] { + "boden/IAFAState.java", + "package boden;\n" + + "public interface IAFAState {\n" + + " public class ValidationException extends Exception {\n" + + " public ValidationException(String variableName, IAFAState subformula) {\n" + + " super(\"Variable \'\"+variableName+\"\' may be unbound in \'\"+subformula+\"\'\");\n" + + " }\n" + + " public void method() {}\n" + + " }\n" + + " /**\n" + + " * Validates a formula for consistent bindings. Bindings are consistent, when at each point in time,\n" + + " * the set of povided variables can be guaranteed to be a superset of the set of required variables.\n" + + " * @throws ValidationException Thrown if a variable is unbound. \n" + + " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + + " * @see IAFAState.ValidationException#method()\n" + + " * @see ValidationException\n" + + " * {@link ValidationException}\n" + + " */\n" + + " public void validate() throws ValidationException;\n" + + "}\n", + "boden/TestValid.java", + "package boden;\n" + + "import boden.IAFAState.ValidationException;\n" + + "/**\n" + + " * @see ValidationException\n" + + " * @see IAFAState.ValidationException\n" + + " */\n" + + "public class TestValid {\n" + + " /** \n" + + " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + + " */\n" + + " IAFAState.ValidationException valid1;\n" + " /**\n" + - " * @see p.A#bar\n" + + " * @see IAFAState.ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + " */\n" + - " void foo() {}\n" + - "}\n", - "p/A.java", - "package p;\n" + - "/** @deprecated */\n" + - "public class A {\n" + - " void bar() {}\n" + + " IAFAState.ValidationException valid2;\n" + "}\n" - } - ); + }; + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(units, + //boden\TestValid.java:8: warning - Tag @see: reference not found: ValidationException + //boden\TestValid.java:12: warning - Tag @see: reference not found: ValidationException#IAFAState.ValidationException(String, IAFAState) + "----------\n" + + "1. ERROR in boden\\TestValid.java (at line 4)\n" + + " * @see ValidationException\n" + + " ^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "2. ERROR in boden\\TestValid.java (at line 9)\n" + + " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + + " ^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); + } else { + runConformTest(units); + } } -/** - * Bug 132813: NPE in Javadoc.resolve(Javadoc.java:196) + log swamped - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=132813" - */ -public void testBug132813() { - runNegativeTest( - new String[] { - "Test.java", - "public class X { \n" + - " /** */ \n" + - " public Test() {}\n" + - " /** */\n" + - " public test() {}\n" + - "}\n" }, - "----------\n" + - "1. ERROR in Test.java (at line 1)\n" + - " public class X { \n" + - " ^\n" + - "The public type X must be defined in its own file\n" + - "----------\n" + - "2. ERROR in Test.java (at line 3)\n" + - " public Test() {}\n" + - " ^^^^^^\n" + - "Return type for the method is missing\n" + - "----------\n" + - "3. ERROR in Test.java (at line 5)\n" + - " public test() {}\n" + - " ^^^^^^\n" + - "Return type for the method is missing\n" + - "----------\n" +public void testBug103304b() { + this.reportInvalidJavadocVisibility = CompilerOptions.PRIVATE; + String[] units = new String[] { + "boden/IAFAState.java", + "package boden;\n" + + "public interface IAFAState {\n" + + " public class ValidationException extends Exception {\n" + + " public ValidationException(String variableName, IAFAState subformula) {\n" + + " super(\"Variable \'\"+variableName+\"\' may be unbound in \'\"+subformula+\"\'\");\n" + + " }\n" + + " public void method() {}\n" + + " }\n" + + "}\n", + "boden/TestInvalid1.java", + "package boden;\n" + + "import boden.IAFAState.ValidationException;\n" + + "public class TestInvalid1 {\n" + + " /** \n" + + " * @see ValidationException#ValidationException(String, IAFAState)\n" + + " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + + " */ \n" + + " IAFAState.ValidationException invalid;\n" + + "}\n", + "boden/TestInvalid2.java", + "package boden;\n" + + "public class TestInvalid2 {\n" + + " /**\n" + + " * @see IAFAState.ValidationException#ValidationException(String, IAFAState)\n" + + " */\n" + + " IAFAState.ValidationException invalid;\n" + + "}\n", + "boden/TestInvalid3.java", + "package boden;\n" + + "import boden.IAFAState.ValidationException;\n" + + "public class TestInvalid3 {\n" + + " /**\n" + + " * @see IAFAState.ValidationException#IAFA.State.ValidationException(String, IAFAState)\n" + + " */\n" + + " IAFAState.ValidationException invalid;\n" + + "}\n", + "boden/TestInvalid4.java", + "package boden;\n" + + "import boden.IAFAState.ValidationException;\n" + + "public class TestInvalid4 {\n" + + " /**\n" + + " * @see IAFAState.ValidationException#IAFAState .ValidationException(String, IAFAState)\n" + + " */\n" + + " IAFAState.ValidationException invalid;\n" + + "}\n" + }; + String errors_14 = new String ( + //boden\TestInvalid1.java:7: warning - Tag @see: reference not found: ValidationException#ValidationException(String, IAFAState) + //boden\TestInvalid1.java:8: warning - Tag @see: reference not found: ValidationException#IAFAState.ValidationException(String, IAFAState) + //boden\TestInvalid2.java:6: warning - Tag @see: can't find ValidationException(String, IAFAState) in boden.IAFAState.ValidationException => bug ID: 4288720 + //boden\TestInvalid3.java:6: warning - Tag @see: can't find IAFA.State.ValidationException(String, IAFAState) in boden.IAFAState.ValidationException + //boden\TestInvalid4.java:6: warning - Tag @see: can't find IAFAState in boden.IAFAState.ValidationException + "----------\n" + + "1. ERROR in boden\\TestInvalid1.java (at line 5)\n" + + " * @see ValidationException#ValidationException(String, IAFAState)\n" + + " ^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "2. ERROR in boden\\TestInvalid1.java (at line 6)\n" + + " * @see ValidationException#IAFAState.ValidationException(String, IAFAState)\n" + + " ^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "----------\n" + + "1. ERROR in boden\\TestInvalid3.java (at line 5)\n" + + " * @see IAFAState.ValidationException#IAFA.State.ValidationException(String, IAFAState)\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "----------\n" + + "1. ERROR in boden\\TestInvalid4.java (at line 5)\n" + + " * @see IAFAState.ValidationException#IAFAState .ValidationException(String, IAFAState)\n" + + " ^^^^^^^^^\n" + + "Javadoc: IAFAState cannot be resolved or is not a field\n" + + "----------\n" ); -} + String errors_50 = new String ( + //boden\TestInvalid1.java:7: warning - Tag @see: reference not found: ValidationException#ValidationException(String, IAFAState) + //boden\TestInvalid2.java:6: warning - Tag @see: can't find ValidationException(String, IAFAState) in boden.IAFAState.ValidationException => bug ID: 4288720 + //boden\TestInvalid3.java:6: warning - Tag @see: can't find IAFA.State.ValidationException(String, IAFAState) in boden.IAFAState.ValidationException + //boden\TestInvalid4.java:6: warning - Tag @see: can't find IAFAState in boden.IAFAState.ValidationException + "----------\n" + + "1. ERROR in boden\\TestInvalid3.java (at line 5)\n" + + " * @see IAFAState.ValidationException#IAFA.State.ValidationException(String, IAFAState)\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "----------\n" + + "1. ERROR in boden\\TestInvalid4.java (at line 5)\n" + + " * @see IAFAState.ValidationException#IAFAState .ValidationException(String, IAFAState)\n" + + " ^^^^^^^^^\n" + + "Javadoc: IAFAState cannot be resolved or is not a field\n" + + "----------\n" + ); + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(units, errors_14); + } else { + runNegativeTest(units, errors_50, JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); + } -/** - * Bug 149013: [javadoc] In latest 3.3 build, there is a javadoc error in org.eclipse.core.resources - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=149013" - */ -public void testBug149013_Private01() { - this.reportMissingJavadocTags = CompilerOptions.IGNORE; +} +public void testBug103304c() { runConformTest( new String[] { - "test1/X.java", - "package test1;\n" + - "public class X {\n" + - " class Inner {\n" + - " class Level2 {\n" + - " class Level3 {}\n" + + "test/Test.java", + "package test;\n" + + "public interface Test {\n" + + " public class Level0 {\n" + + " public Level0() {}\n" + + " }\n" + + " public interface Member {\n" + + " public class Level1 {\n" + + " public Level1() {}\n" + " }\n" + " }\n" + "}\n", - "test1/Test.java", - "package test1;\n" + - "/**\n" + - " * @see X.Inner\n" + - " * @see X.Inner.Level2\n" + - " * @see X.Inner.Level2.Level3\n" + - " */\n" + - "public class Test {}\n", + "test/C.java", + "package test;\n" + + "public class C {\n" + + " /**\n" + + " * @see Test.Level0#Test.Level0()\n" + + " */\n" + + " Test.Level0 valid = new Test.Level0();\n" + + " /**\n" + + " * @see Test.Level0#Level0()\n" + + " */\n" + + " Test.Level0 invalid = new Test.Level0();\n" + + "}\n" } + //test\C.java:10: warning - Tag @see: can't find Level0() in test.Test.Level0 => bug ID: 4288720 ); } -public void testBug149013_Public01() { - this.reportMissingJavadocTags = CompilerOptions.DISABLED; - this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; +public void testBug103304d() { runNegativeTest( new String[] { - "test1/X.java", - "package test1;\n" + - "public class X {\n" + - " class Inner {\n" + - " class Level2 {\n" + - " class Level3 {}\n" + + "test/Test.java", + "package test;\n" + + "public interface Test {\n" + + " public class Level0 {\n" + + " public Level0() {}\n" + + " }\n" + + " public interface Member {\n" + + " public class Level1 {\n" + + " public Level1() {}\n" + " }\n" + " }\n" + "}\n", - "test1/Test.java", - "package test1;\n" + - "/**\n" + - " * @see X.Inner\n" + - " * @see X.Inner.Level2\n" + - " * @see X.Inner.Level2.Level3\n" + - " */\n" + - "public class Test {\n" + + "test/C2.java", + "package test;\n" + + "public class C2 {\n" + + " /**\n" + + " * @see Test.Member.Level1#Test.Member.Level1()\n" + + " */\n" + + " Test.Member.Level1 valid = new Test.Member.Level1();\n" + + " /**\n" + + " * @see Test.Member.Level1#Level1()\n" + + " */\n" + + " Test.Member.Level1 invalid = new Test.Member.Level1();\n" + + " /**\n" + + " * @see Test.Member.Level1#Test.Level1()\n" + + " */\n" + + " Test.Member.Level1 wrong = new Test.Member.Level1();\n" + "}\n" }, - //test1\Test.java:7: warning - Tag @see: reference not found: X.Inner - //test1\Test.java:7: warning - Tag @see: reference not found: X.Inner.Level2 - //test1\Test.java:7: warning - Tag @see: reference not found: X.Inner.Level2.Level3 - "----------\n" + - "1. ERROR in test1\\Test.java (at line 3)\n" + - " * @see X.Inner\n" + - " ^^^^^^^\n" + - "Javadoc: \'public\' visibility for malformed doc comments hides this \'default\' reference\n" + - "----------\n" + - "2. ERROR in test1\\Test.java (at line 4)\n" + - " * @see X.Inner.Level2\n" + - " ^^^^^^^^^^^^^^\n" + - "Javadoc: \'public\' visibility for malformed doc comments hides this \'default\' reference\n" + + //test\C2.java:10: warning - Tag @see: can't find Level1() in test.Test.Member.Level1 => Bug ID: 4288720 + //test\C2.java:14: warning - Tag @see: can't find Test.Level1() in test.Test.Member.Level1 "----------\n" + - "3. ERROR in test1\\Test.java (at line 5)\n" + - " * @see X.Inner.Level2.Level3\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: \'public\' visibility for malformed doc comments hides this \'default\' reference\n" + + "1. ERROR in test\\C2.java (at line 12)\n" + + " * @see Test.Member.Level1#Test.Level1()\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + "----------\n", JavacTestOptions.Excuse.EclipseWarningConfiguredAsError ); } -public void testBug149013_Private02() { - this.reportMissingJavadocTags = CompilerOptions.IGNORE; - runNegativeTest( +public void testBug103304e() { + runConformTest( new String[] { - "test1/X.java", - "package test1;\n" + - "public class X {\n" + - " class Inner {\n" + - " class Level2 {\n" + - " class Level3 {}\n" + - " }\n" + + "implicit/Valid.java", + "package implicit;\n" + + "public interface Valid {\n" + + " public class Level0 {\n" + + " /**\n" + + " * @see #Valid.Level0() Valid\n" + + " */\n" + + " public Level0() {}\n" + + " /**\n" + + " * @see #Valid.Level0(String) Valid\n" + + " */\n" + + " public Level0(String str) {}\n" + " }\n" + - "}\n", - "test2/Test.java", - "package test2;\n" + - "import test1.X;\n" + - "/**\n" + - " * @see X.Inner\n" + - " * @see X.Inner.Level2\n" + - " * @see X.Inner.Level2.Level3\n" + - " */\n" + - "public class Test {}\n", - }, - //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner - //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner.Level2 - //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner.Level2.Level3 - "----------\n" + - "1. ERROR in test2\\Test.java (at line 4)\r\n" + - " * @see X.Inner\r\n" + - " ^^^^^^^\n" + - "Javadoc: The type X.Inner is not visible\n" + - "----------\n" + - "2. ERROR in test2\\Test.java (at line 5)\r\n" + - " * @see X.Inner.Level2\r\n" + - " ^^^^^^^^^^^^^^\n" + - "Javadoc: The type X.Inner is not visible\n" + - "----------\n" + - "3. ERROR in test2\\Test.java (at line 6)\r\n" + - " * @see X.Inner.Level2.Level3\r\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: The type X.Inner is not visible\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); -} -public void testBug149013_Public02() { - this.reportMissingJavadocTags = CompilerOptions.DISABLED; - this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; - runNegativeTest( - new String[] { - "test1/X.java", - "package test1;\n" + - "public class X {\n" + - " class Inner {\n" + - " class Level2 {\n" + - " class Level3 {}\n" + + " public interface Member {\n" + + " public class Level1 {\n" + + " /**\n" + + " * @see #Valid.Member.Level1() Valid\n" + + " */\n" + + " public Level1() {}\n" + + " /**\n" + + " * @see #Valid.Member.Level1(int) Valid\n" + + " */\n" + + " public Level1(int x) {}\n" + " }\n" + " }\n" + - "}\n", - "test2/Test.java", - "package test2;\n" + - "import test1.X;\n" + - "/**\n" + - " * @see X.Inner\n" + - " * @see X.Inner.Level2\n" + - " * @see X.Inner.Level2.Level3\n" + - " */\n" + - "public class Test {}\n", - }, - //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner - //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner.Level2 - //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner.Level2.Level3 - "----------\n" + - "1. ERROR in test2\\Test.java (at line 4)\r\n" + - " * @see X.Inner\r\n" + - " ^^^^^^^\n" + - "Javadoc: The type X.Inner is not visible\n" + - "----------\n" + - "2. ERROR in test2\\Test.java (at line 5)\r\n" + - " * @see X.Inner.Level2\r\n" + - " ^^^^^^^^^^^^^^\n" + - "Javadoc: The type X.Inner is not visible\n" + - "----------\n" + - "3. ERROR in test2\\Test.java (at line 6)\r\n" + - " * @see X.Inner.Level2.Level3\r\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: The type X.Inner is not visible\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + "}\n" + } ); } -public void testBug149013_Private03() { - this.reportMissingJavadocTags = CompilerOptions.IGNORE; +public void testBug103304f() { runNegativeTest( new String[] { - "test1/X.java", - "package test1;\n" + - "public class X {\n" + - " class Inner {\n" + - " class Level2 {\n" + - " class Level3 {}\n" + + "implicit/Invalid.java", + "package implicit;\n" + + "public interface Invalid {\n" + + " public class Level0 {\n" + + " /**\n" + + " * @see #Level0() Invalid\n" + + " */\n" + + " public Level0() {}\n" + + " /**\n" + + " * @see #Level0(String) Invalid\n" + + " */\n" + + " public Level0(String str) {}\n" + + " }\n" + + " public interface Member {\n" + + " public class Level1 {\n" + + " /**\n" + + " * @see #Level1() Invalid\n" + + " * @see #Member.Level1() Invalid\n" + + " * @see #Invalid.Level1() Invalid\n" + + " */\n" + + " public Level1() {}\n" + + " /**\n" + + " * @see #Level1(int) Invalid\n" + + " * @see #Invalid.Level1(int) Invalid\n" + + " * @see #Member.Level1(int) Invalid\n" + + " */\n" + + " public Level1(int x) {}\n" + " }\n" + " }\n" + - "}\n", - "test3/Test.java", - "package test3;\n" + - "/**\n" + - " * @see test1.X.Inner\n" + - " * @see test1.X.Inner.Level2\n" + - " * @see test1.X.Inner.Level2.Level3\n" + - " */\n" + - "public class Test {}\n" + "}\n" }, - // no warning + //implicit\Invalid.java:7: warning - Tag @see: can't find Level0() in implicit.Invalid.Level0 => bug ID: 4288720 + //implicit\Invalid.java:11: warning - Tag @see: can't find Level0(String) in implicit.Invalid.Level0 => bug ID: 4288720 + //implicit\Invalid.java:20: warning - Tag @see: can't find Level1() in implicit.Invalid.Member.Level1 => bug ID: 4288720 + //implicit\Invalid.java:20: warning - Tag @see: can't find Member.Level1() in implicit.Invalid.Member.Level1 + //implicit\Invalid.java:20: warning - Tag @see: can't find Invalid.Level1() in implicit.Invalid.Member.Level1 + //implicit\Invalid.java:26: warning - Tag @see: can't find Level1(int) in implicit.Invalid.Member.Level1 => bug ID: 4288720 + //implicit\Invalid.java:26: warning - Tag @see: can't find Invalid.Level1(int) in implicit.Invalid.Member.Level1 + //implicit\Invalid.java:26: warning - Tag @see: can't find Member.Level1(int) in implicit.Invalid.Member.Level1 "----------\n" + - "1. ERROR in test3\\Test.java (at line 3)\r\n" + - " * @see test1.X.Inner\r\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: The type test1.X.Inner is not visible\n" + + "1. ERROR in implicit\\Invalid.java (at line 17)\n" + + " * @see #Member.Level1() Invalid\n" + + " ^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + "----------\n" + - "2. ERROR in test3\\Test.java (at line 4)\r\n" + - " * @see test1.X.Inner.Level2\r\n" + - " ^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: The type test1.X.Inner is not visible\n" + + "2. ERROR in implicit\\Invalid.java (at line 18)\n" + + " * @see #Invalid.Level1() Invalid\n" + + " ^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + "----------\n" + - "3. ERROR in test3\\Test.java (at line 5)\r\n" + - " * @see test1.X.Inner.Level2.Level3\r\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: The type test1.X.Inner is not visible\n" + + "3. ERROR in implicit\\Invalid.java (at line 23)\n" + + " * @see #Invalid.Level1(int) Invalid\n" + + " ^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "4. ERROR in implicit\\Invalid.java (at line 24)\n" + + " * @see #Member.Level1(int) Invalid\n" + + " ^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + "----------\n", JavacTestOptions.Excuse.EclipseWarningConfiguredAsError ); } -public void testBug149013_Public03() { - this.reportMissingJavadocTags = CompilerOptions.DISABLED; - this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; - runNegativeTest( + +/** + * Bug 116464: [javadoc] Unicode tag name are not correctly parsed + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=116464" + */ +public void testBug116464() { + this.reportMissingJavadocTags = CompilerOptions.ERROR; + runConformTest( new String[] { - "test1/X.java", - "package test1;\n" + + "X.java", "public class X {\n" + - " class Inner {\n" + - " class Level2 {\n" + - " class Level3 {}\n" + - " }\n" + - " }\n" + - "}\n", - "test3/Test.java", - "package test3;\n" + - "/**\n" + - " * @see test1.X.Inner\n" + - " * @see test1.X.Inner.Level2\n" + - " * @see test1.X.Inner.Level2.Level3\n" + - " */\n" + - "public class Test {}\n" - }, - // no warning - "----------\n" + - "1. ERROR in test3\\Test.java (at line 3)\r\n" + - " * @see test1.X.Inner\r\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: The type test1.X.Inner is not visible\n" + - "----------\n" + - "2. ERROR in test3\\Test.java (at line 4)\r\n" + - " * @see test1.X.Inner.Level2\r\n" + - " ^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: The type test1.X.Inner is not visible\n" + - "----------\n" + - "3. ERROR in test3\\Test.java (at line 5)\r\n" + - " * @see test1.X.Inner.Level2.Level3\r\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: The type test1.X.Inner is not visible\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + " /**\n" + + " * @\\u0070\\u0061\\u0072\\u0061\\u006d str xxx\n" + + " */\n" + + " void foo(String str) {}\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" + * @bug 125518: [javadoc] Embedding html in a link placed in a @see JavaDoc tag causes a warning + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=125518" */ -public void testBug153399a() { - String[] testFiles = new String[] { - "X.java", - "public class X { \n" + - " /**\n" + - " * {@value #MY_VALUE}\n" + - " */\n" + - " public final static int MY_VALUE = 0; \n" + - " /**\n" + - " * {@value #MY_VALUE}\n" + - " */\n" + - " public void foo() {}\n" + +public void testBug125518a() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + " /**\n" + - " * {@value #MY_VALUE}\n" + + " * @see invalid>invalid>invalid>invalid>invalid>\n" + " */\n" + - " boolean get() {\n" + - " return false;\n" + + " public void foo() { \n" + + " \n" + " }\n" + "}\n" }; - runConformTest(testFiles); + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(true, units, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 5)\n" + + " * @see invalid>\n" + + " ^^^\n" + + "Javadoc: Malformed link reference\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); } -public void testBug153399d() { - String[] testFiles = new String[] { - "X.java", - "public class X { \n" + + +public void testBug125518d() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + " /**\n" + - " * {@value #MY_VALUE}\n" + - " * {@value}\n" + - " * {@value Invalid}\n" + + " * @see invalid>\n" + " */\n" + - " public final static int MY_VALUE = 0; \n" + + " public void foo() { \n" + + " \n" + + " }\n" + "}\n" }; - if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(testFiles, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " * {@value #MY_VALUE}\n" + - " ^^^^^\n" + - "Javadoc: Unexpected tag\n" + - "----------\n" + - "2. ERROR in X.java (at line 4)\n" + - " * {@value}\n" + - " ^^^^^\n" + - "Javadoc: Unexpected tag\n" + - "----------\n" - ); - } else { - runNegativeTest(testFiles, + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(true, units, "----------\n" + - "1. ERROR in X.java (at line 5)\n" + - " * {@value Invalid}\n" + - " ^^^^^^^^\n" + - "Javadoc: Invalid reference\n" + + "1. WARNING in pkg\\X.java (at line 5)\n" + + " * @see invalid>\n" + + " ^^^^^\n" + + "Javadoc: Malformed link reference\n" + "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); - } + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); } -public void testBug153399e() { - String[] testFiles = new String[] { - "X.java", - "public class X { \n" + + +public void testBug125518e() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + " /**\n" + - " * {@value Invalid}\n" + - " * {@value #MY_VALUE}\n" + + " * @see value\n" + " */\n" + - " public final static int MY_VALUE = 0; \n" + + " public void foo() { \n" + + " \n" + + " }\n" + "}\n" - }; - if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(testFiles, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " * {@value Invalid}\n" + - " ^^^^^\n" + - "Javadoc: Unexpected tag\n" + - "----------\n" - ); - } else { - runNegativeTest(testFiles, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " * {@value Invalid}\n" + - " ^^^^^^^^\n" + - "Javadoc: Invalid reference\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); - } + }; + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(units); } /** - * @bug 160015: [1.5][javadoc] Missing warning on autoboxing compatible methods - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=160015" + * Bug 125903: [javadoc] Treat whitespace in javadoc tags as invalid tags + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=125903" */ -public void testBug160015() { - runNegativeTest(new String[] { - "Test.java", +public void testBug125903() { + this.reportMissingJavadocTags = CompilerOptions.ERROR; + runNegativeTest( + new String[] { + "X.java", "/**\n" + - " * @see #method(Long) Warning!\n" + + " * {@ link java.lang.String}\n" + + " * @ since 2.1\n" + " */\n" + - "public class Test {\n" + - " public void method(long l) {}\n" + - " /**\n" + - " * @see #method(Long) Warning!\n" + - " */\n" + - " void bar() {}\n" + + "public class X {\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" + + "1. ERROR in X.java (at line 2)\n" + + " * {@ link java.lang.String}\n" + + " ^^\n" + + "Javadoc: Invalid tag\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" + + "2. ERROR in X.java (at line 3)\n" + + " * @ since 2.1\n" + + " ^^\n" + + "Javadoc: Invalid tag\n" + "----------\n", JavacTestOptions.Excuse.EclipseWarningConfiguredAsError ); } /** - * @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" + * Bug 128954: Javadoc problems with category CAT_INTERNAL + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=128954" */ -public void testBug163659() { +public void testBug128954() { + this.reportInvalidJavadoc = CompilerOptions.WARNING; + this.reportDeprecation = CompilerOptions.WARNING; 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" + + "X.java", //======================== + "public class X {\n" + + " /**\n" + + " * @see p.A#bar()\n" + + " */\n" + + " void foo() {\n" + + " Zork z;\n" + " }\n" + - "}\n" + - "interface MyInterface {}\n" + - "interface MySubInterface extends MyInterface {} \n" - }, + "}\n", + "p/A.java", //======================== + "package p;\n" + + "public class A {\n" + + " /** @deprecated */\n" + + " public void bar() {\n" + + " }\n" + + "}\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" + + "1. WARNING in X.java (at line 3)\n" + + " * @see p.A#bar()\n" + + " ^^^^^\n" + + "[@cat:javadoc] Javadoc: The method bar() from the type A is deprecated\n" + + "----------\n" + + "2. ERROR in X.java (at line 6)\n" + + " Zork z;\n" + + " ^^^^\n" + + "[@cat:type] Zork cannot be resolved to a type\n" + "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); + null, + true, + null, + false, + true, + true); } /** - * @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" + * Bug 128954: Javadoc problems with category CAT_INTERNAL - variation + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=128954" */ -public void testBug165794() { - String[] testFiles = new String[] { - "X.java", - "/**\n" + - " * No reasonable hint for resolving the {@link #getMax(A)}.\n" + - " */\n" + - "public class X {\n" + - " /**\n" + - " * Extends Number method.\n" + - " * @see #getMax(A ipZ)\n" + - " */\n" + - " public T getMax(final A ipY) {\n" + - " return ipY.t();\n" + - " }\n" + - " \n" + - " /**\n" + - " * Extends Exception method.\n" + - " * @see #getMax(A ipY)\n" + - " */\n" + - " public T getMax(final A ipZ) {\n" + - " return ipZ.t();\n" + - " }\n" + - "}\n" + - "class A {\n" + - " T t() { return null; }\n" + - "}\n" + - "class Y {}\n" + - "class Z {}" - }; - if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - return; - } - runConformTest(testFiles); +public void testBug128954a() { + this.reportInvalidJavadoc = CompilerOptions.WARNING; + this.reportDeprecation = CompilerOptions.WARNING; + runNegativeTest( + new String[] { + "X.java", + "public class X {\n" + + " \n" + + " /**\n" + + " * @see p.A#bar()\n" + + " */\n" + + " void foo() {\n" + + " Zork z;\n" + + " }\n" + + "}\n", + }, + "----------\n" + + "1. WARNING in X.java (at line 4)\n" + + " * @see p.A#bar()\n" + + " ^^^\n" + + "[@cat:javadoc] Javadoc: p cannot be resolved to a type\n" + + "----------\n" + + "2. ERROR in X.java (at line 7)\n" + + " Zork z;\n" + + " ^^^^\n" + + "[@cat:type] Zork cannot be resolved to a type\n" + + "----------\n", + null, + true, + null, + false, + true, + true); } /** - * @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" + * Bug 129241: [Javadoc] deprecation warning wrongly reported when ignoring Malformed Javadoc comments + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=129241" */ -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, +public void testBug129241a() { + runNegativeTest( + new String[] { + "X.java", + "public class X {\n" + + " /**\n" + + " * @see p.A#bar\n" + + " */\n" + + " void foo() {}\n" + + "}\n", + "p/A.java", + "package p;\n" + + "/** @deprecated */\n" + + "public class A {\n" + + " void bar() {}\n" + + "}\n" + }, "----------\n" + - "1. ERROR in X.java (at line 21)\n" + - " * @return\n" + - " ^^^^^^\n" + - "Javadoc: Description expected after @return\n" + + "1. ERROR in X.java (at line 3)\n" + + " * @see p.A#bar\n" + + " ^^^\n" + + "Javadoc: The type A is deprecated\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); +} +public void testBug129241b() { + this.reportDeprecation = CompilerOptions.IGNORE; + runNegativeTest( + new String[] { + "X.java", + "public class X {\n" + + " /**\n" + + " * @see p.A#bar\n" + + " */\n" + + " void foo() {}\n" + + "}\n", + "p/A.java", + "package p;\n" + + "/** @deprecated */\n" + + "public class A {\n" + + " void bar() {}\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in X.java (at line 3)\n" + + " * @see p.A#bar\n" + + " ^^^\n" + + "Javadoc: The type A is deprecated\n" + "----------\n", JavacTestOptions.Excuse.EclipseWarningConfiguredAsError ); } +public void testBug129241c() { + this.reportJavadocDeprecation = CompilerOptions.DISABLED; + runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " /**\n" + + " * @see p.A#bar\n" + + " */\n" + + " void foo() {}\n" + + "}\n", + "p/A.java", + "package p;\n" + + "/** @deprecated */\n" + + "public class A {\n" + + " void bar() {}\n" + + "}\n" + } + ); +} +public void testBug129241d() { + this.reportInvalidJavadoc = CompilerOptions.IGNORE; + runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " /**\n" + + " * @see p.A#bar\n" + + " */\n" + + " void foo() {}\n" + + "}\n", + "p/A.java", + "package p;\n" + + "/** @deprecated */\n" + + "public class A {\n" + + " void bar() {}\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" + * Bug 132813: NPE in Javadoc.resolve(Javadoc.java:196) + log swamped + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=132813" */ -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" + - " *
  • {@value #PUBLIC_CONST}
  • \n" + - " *
  • {@value #PROTECTED_CONST}
  • \n" + - " *
  • {@value #DEFAULT_CONST}
  • \n" + - " *
  • {@value #PRIVATE_CONST}
  • \n" + - " *
\n" + - " */\n" + - " public X() {\n" + - " }\n" + - "}\n" - }; - this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; - if (this.complianceLevel <= ClassFileConstants.JDK1_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", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); - } +public void testBug132813() { + runNegativeTest( + new String[] { + "Test.java", + "public class X { \n" + + " /** */ \n" + + " public Test() {}\n" + + " /** */\n" + + " public test() {}\n" + + "}\n" }, + "----------\n" + + "1. ERROR in Test.java (at line 1)\n" + + " public class X { \n" + + " ^\n" + + "The public type X must be defined in its own file\n" + + "----------\n" + + "2. ERROR in Test.java (at line 3)\n" + + " public Test() {}\n" + + " ^^^^^^\n" + + "Return type for the method is missing\n" + + "----------\n" + + "3. ERROR in Test.java (at line 5)\n" + + " public test() {}\n" + + " ^^^^^^\n" + + "Return type for the method is missing\n" + + "----------\n" + ); } /** - * Bug 176027: [javadoc] @link to member type handled incorrectly - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=176027" + * Bug 149013: [javadoc] In latest 3.3 build, there is a javadoc error in org.eclipse.core.resources + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=149013" */ -public void testBug176027a() { - // case1 class X static class Inner - String[] units = new String[] { - "otherpkg/C.java", - "package otherpkg;\n" + - "public class C {\n" + - " public static class Inner { }\n" + - "}\n" - , - "somepkg/MemberTypeDocTest.java", - "package somepkg;\n" + - "import otherpkg.C.Inner;\n" + - "/**\n" + - " * {@link Inner} -- error/warning \n" + - " */\n" + - "public class MemberTypeDocTest {\n" + - " void m() { }\n" + - "}\n" - }; - if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units, - //somepkg/MemberTypeDocTest.java:6: warning - Tag @link: reference not found: Inner - "----------\n" + - "1. ERROR in somepkg\\MemberTypeDocTest.java (at line 4)\n" + - " * {@link Inner} -- error/warning \n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" - ); - } - else { - runConformTest(units); - } -} - -public void testBug176027b() { - // case3 class X class Inner - String[] units = new String[] { - "otherpkg/C.java", - "package otherpkg;\n" + - "public class C {\n" + - " public class Inner { }\n" + - "}\n" - , - "somepkg/MemberTypeDocTest.java", - "package somepkg;\n" + - "import otherpkg.C.Inner;\n" + - "/**\n" + - " * {@link Inner} -- error/warning \n" + - " */\n" + - "public class MemberTypeDocTest {\n" + - " void m() { }\n" + - "}\n" - }; - if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units, - //somepkg/MemberTypeDocTest.java:6: warning - Tag @link: reference not found: Inner - "----------\n" + - "1. ERROR in somepkg\\MemberTypeDocTest.java (at line 4)\n" + - " * {@link Inner} -- error/warning \n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" - ); - } - else { - runConformTest(units); - } +public void testBug149013_Private01() { + this.reportMissingJavadocTags = CompilerOptions.IGNORE; + runConformTest( + new String[] { + "test1/X.java", + "package test1;\n" + + "public class X {\n" + + " class Inner {\n" + + " class Level2 {\n" + + " class Level3 {}\n" + + " }\n" + + " }\n" + + "}\n", + "test1/Test.java", + "package test1;\n" + + "/**\n" + + " * @see X.Inner\n" + + " * @see X.Inner.Level2\n" + + " * @see X.Inner.Level2.Level3\n" + + " */\n" + + "public class Test {}\n", + } + ); } - -public void testBug176027c() { - // case3 class X interface Inner - String[] units = new String[] { - "otherpkg/C.java", - "package otherpkg;\n" + - "public class C {\n" + - " public interface Inner { }\n" + - "}\n" - , - "somepkg/MemberTypeDocTest.java", - "package somepkg;\n" + - "import otherpkg.C.Inner;\n" + - "/**\n" + - " * {@link Inner} -- error/warning \n" + - " */\n" + - "public class MemberTypeDocTest {\n" + - " void m() { }\n" + - "}\n" - }; - if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units, - //somepkg/MemberTypeDocTest.java:6: warning - Tag @link: reference not found: Inner - "----------\n" + - "1. ERROR in somepkg\\MemberTypeDocTest.java (at line 4)\n" + - " * {@link Inner} -- error/warning \n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" - ); - } - else { - runConformTest(units); - } +public void testBug149013_Public01() { + this.reportMissingJavadocTags = CompilerOptions.DISABLED; + this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; + runNegativeTest( + new String[] { + "test1/X.java", + "package test1;\n" + + "public class X {\n" + + " class Inner {\n" + + " class Level2 {\n" + + " class Level3 {}\n" + + " }\n" + + " }\n" + + "}\n", + "test1/Test.java", + "package test1;\n" + + "/**\n" + + " * @see X.Inner\n" + + " * @see X.Inner.Level2\n" + + " * @see X.Inner.Level2.Level3\n" + + " */\n" + + "public class Test {\n" + + "}\n" + }, + //test1\Test.java:7: warning - Tag @see: reference not found: X.Inner + //test1\Test.java:7: warning - Tag @see: reference not found: X.Inner.Level2 + //test1\Test.java:7: warning - Tag @see: reference not found: X.Inner.Level2.Level3 + "----------\n" + + "1. ERROR in test1\\Test.java (at line 3)\n" + + " * @see X.Inner\n" + + " ^^^^^^^\n" + + "Javadoc: \'public\' visibility for malformed doc comments hides this \'default\' reference\n" + + "----------\n" + + "2. ERROR in test1\\Test.java (at line 4)\n" + + " * @see X.Inner.Level2\n" + + " ^^^^^^^^^^^^^^\n" + + "Javadoc: \'public\' visibility for malformed doc comments hides this \'default\' reference\n" + + "----------\n" + + "3. ERROR in test1\\Test.java (at line 5)\n" + + " * @see X.Inner.Level2.Level3\n" + + " ^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: \'public\' visibility for malformed doc comments hides this \'default\' reference\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); } - -public void testBug176027d() { - // case4 interface X static class Inner - String[] units = new String[] { - "otherpkg/C.java", - "package otherpkg;\n" + - "public interface C {\n" + - " public static class Inner { }\n" + - "}\n" - , - "somepkg/MemberTypeDocTest.java", - "package somepkg;\n" + - "import otherpkg.C.Inner;\n" + - "/**\n" + - " * {@link Inner} -- error/warning \n" + - " */\n" + - "public class MemberTypeDocTest {\n" + - " void m() { }\n" + - "}\n" - }; - if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units, - //somepkg/MemberTypeDocTest.java:6: warning - Tag @link: reference not found: Inner - "----------\n" + - "1. ERROR in somepkg\\MemberTypeDocTest.java (at line 4)\n" + - " * {@link Inner} -- error/warning \n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" - ); - } - else { - runConformTest(units); - } +public void testBug149013_Private02() { + this.reportMissingJavadocTags = CompilerOptions.IGNORE; + runNegativeTest( + new String[] { + "test1/X.java", + "package test1;\n" + + "public class X {\n" + + " class Inner {\n" + + " class Level2 {\n" + + " class Level3 {}\n" + + " }\n" + + " }\n" + + "}\n", + "test2/Test.java", + "package test2;\n" + + "import test1.X;\n" + + "/**\n" + + " * @see X.Inner\n" + + " * @see X.Inner.Level2\n" + + " * @see X.Inner.Level2.Level3\n" + + " */\n" + + "public class Test {}\n", + }, + //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner + //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner.Level2 + //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner.Level2.Level3 + "----------\n" + + "1. ERROR in test2\\Test.java (at line 4)\r\n" + + " * @see X.Inner\r\n" + + " ^^^^^^^\n" + + "Javadoc: The type X.Inner is not visible\n" + + "----------\n" + + "2. ERROR in test2\\Test.java (at line 5)\r\n" + + " * @see X.Inner.Level2\r\n" + + " ^^^^^^^^^^^^^^\n" + + "Javadoc: The type X.Inner is not visible\n" + + "----------\n" + + "3. ERROR in test2\\Test.java (at line 6)\r\n" + + " * @see X.Inner.Level2.Level3\r\n" + + " ^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: The type X.Inner is not visible\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); +} +public void testBug149013_Public02() { + this.reportMissingJavadocTags = CompilerOptions.DISABLED; + this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; + runNegativeTest( + new String[] { + "test1/X.java", + "package test1;\n" + + "public class X {\n" + + " class Inner {\n" + + " class Level2 {\n" + + " class Level3 {}\n" + + " }\n" + + " }\n" + + "}\n", + "test2/Test.java", + "package test2;\n" + + "import test1.X;\n" + + "/**\n" + + " * @see X.Inner\n" + + " * @see X.Inner.Level2\n" + + " * @see X.Inner.Level2.Level3\n" + + " */\n" + + "public class Test {}\n", + }, + //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner + //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner.Level2 + //test2\Test.java:10: warning - Tag @see: reference not found: X.Inner.Level2.Level3 + "----------\n" + + "1. ERROR in test2\\Test.java (at line 4)\r\n" + + " * @see X.Inner\r\n" + + " ^^^^^^^\n" + + "Javadoc: The type X.Inner is not visible\n" + + "----------\n" + + "2. ERROR in test2\\Test.java (at line 5)\r\n" + + " * @see X.Inner.Level2\r\n" + + " ^^^^^^^^^^^^^^\n" + + "Javadoc: The type X.Inner is not visible\n" + + "----------\n" + + "3. ERROR in test2\\Test.java (at line 6)\r\n" + + " * @see X.Inner.Level2.Level3\r\n" + + " ^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: The type X.Inner is not visible\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); +} +public void testBug149013_Private03() { + this.reportMissingJavadocTags = CompilerOptions.IGNORE; + runNegativeTest( + new String[] { + "test1/X.java", + "package test1;\n" + + "public class X {\n" + + " class Inner {\n" + + " class Level2 {\n" + + " class Level3 {}\n" + + " }\n" + + " }\n" + + "}\n", + "test3/Test.java", + "package test3;\n" + + "/**\n" + + " * @see test1.X.Inner\n" + + " * @see test1.X.Inner.Level2\n" + + " * @see test1.X.Inner.Level2.Level3\n" + + " */\n" + + "public class Test {}\n" + }, + // no warning + "----------\n" + + "1. ERROR in test3\\Test.java (at line 3)\r\n" + + " * @see test1.X.Inner\r\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: The type test1.X.Inner is not visible\n" + + "----------\n" + + "2. ERROR in test3\\Test.java (at line 4)\r\n" + + " * @see test1.X.Inner.Level2\r\n" + + " ^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: The type test1.X.Inner is not visible\n" + + "----------\n" + + "3. ERROR in test3\\Test.java (at line 5)\r\n" + + " * @see test1.X.Inner.Level2.Level3\r\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: The type test1.X.Inner is not visible\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); +} +public void testBug149013_Public03() { + this.reportMissingJavadocTags = CompilerOptions.DISABLED; + this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; + runNegativeTest( + new String[] { + "test1/X.java", + "package test1;\n" + + "public class X {\n" + + " class Inner {\n" + + " class Level2 {\n" + + " class Level3 {}\n" + + " }\n" + + " }\n" + + "}\n", + "test3/Test.java", + "package test3;\n" + + "/**\n" + + " * @see test1.X.Inner\n" + + " * @see test1.X.Inner.Level2\n" + + " * @see test1.X.Inner.Level2.Level3\n" + + " */\n" + + "public class Test {}\n" + }, + // no warning + "----------\n" + + "1. ERROR in test3\\Test.java (at line 3)\r\n" + + " * @see test1.X.Inner\r\n" + + " ^^^^^^^^^^^^^\n" + + "Javadoc: The type test1.X.Inner is not visible\n" + + "----------\n" + + "2. ERROR in test3\\Test.java (at line 4)\r\n" + + " * @see test1.X.Inner.Level2\r\n" + + " ^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: The type test1.X.Inner is not visible\n" + + "----------\n" + + "3. ERROR in test3\\Test.java (at line 5)\r\n" + + " * @see test1.X.Inner.Level2.Level3\r\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: The type test1.X.Inner is not visible\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); } -public void testBug176027f() { - // case5 interface X class Inner - String[] units = new String[] { - "otherpkg/C.java", - "package otherpkg;\n" + - "public interface C {\n" + - " public class Inner { }\n" + - "}\n" - , - "somepkg/MemberTypeDocTest.java", - "package somepkg;\n" + - "import otherpkg.C.Inner;\n" + - "/**\n" + - " * {@link Inner} -- error/warning \n" + - " */\n" + - "public class MemberTypeDocTest {\n" + - " void m() { }\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" + */ +public void testBug153399a() { + String[] testFiles = new String[] { + "X.java", + "public class X { \n" + + " /**\n" + + " * {@value #MY_VALUE}\n" + + " */\n" + + " public final static int MY_VALUE = 0; \n" + + " /**\n" + + " * {@value #MY_VALUE}\n" + + " */\n" + + " public void foo() {}\n" + + " /**\n" + + " * {@value #MY_VALUE}\n" + + " */\n" + + " class Sub {} \n" + "}\n" }; if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units, - //somepkg/MemberTypeDocTest.java:6: warning - Tag @link: reference not found: Inner + runNegativeTest(testFiles, "----------\n" + - "1. ERROR in somepkg\\MemberTypeDocTest.java (at line 4)\n" + - " * {@link Inner} -- error/warning \n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + + "1. ERROR in X.java (at line 7)\n" + + " * {@value #MY_VALUE}\n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + + "----------\n" + + "2. ERROR in X.java (at line 11)\n" + + " * {@value #MY_VALUE}\n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + "----------\n" ); + } else { + runConformTest(testFiles); } - else { - runConformTest(units); +} +public void testBug153399b() { + String[] testFiles = new String[] { + "X.java", + "public class X { \n" + + " /**\n" + + " * {@value}\n" + + " */\n" + + " public final static int MY_VALUE = 0; \n" + + " /**\n" + + " * {@value}\n" + + " */\n" + + " public void foo() {}\n" + + " /**\n" + + " * {@value}\n" + + " */\n" + + " class Sub {} \n" + + "}\n" + }; + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(testFiles, + "----------\n" + + "1. ERROR in X.java (at line 7)\n" + + " * {@value}\n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + + "----------\n" + + "2. ERROR in X.java (at line 11)\n" + + " * {@value}\n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + + "----------\n" + ); + } else { + runConformTest(testFiles); } } - -public void testBug176027g() { - // case6 interface X interface Inner - String[] units = new String[] { - "otherpkg/C.java", - "package otherpkg;\n" + - "public interface C {\n" + - " public interface Inner { }\n" + +public void testBug153399c() { + String[] testFiles = new String[] { + "p1/X.java", + "package p1;\n" + + "public class X {\n" + + " /**\n" + + " * @return a\n" + + " */\n" + + " boolean get() {\n" + + " return false;\n" + + " }\n" + "}\n" - , - "somepkg/MemberTypeDocTest.java", - "package somepkg;\n" + - "import otherpkg.C.Inner;\n" + - "/**\n" + - " * {@link Inner} -- error/warning \n" + - " */\n" + - "public class MemberTypeDocTest {\n" + - " void m() { }\n" + + }; + runConformTest(testFiles); +} +public void testBug153399d() { + String[] testFiles = new String[] { + "X.java", + "public class X { \n" + + " /**\n" + + " * {@value #MY_VALUE}\n" + + " * {@value}\n" + + " * {@value Invalid}\n" + + " */\n" + + " public final static int MY_VALUE = 0; \n" + "}\n" }; if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units, - //somepkg/MemberTypeDocTest.java:6: warning - Tag @link: reference not found: Inner + runNegativeTest(testFiles, "----------\n" + - "1. ERROR in somepkg\\MemberTypeDocTest.java (at line 4)\n" + - " * {@link Inner} -- error/warning \n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + + "1. ERROR in X.java (at line 3)\n" + + " * {@value #MY_VALUE}\n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + + "----------\n" + + "2. ERROR in X.java (at line 4)\n" + + " * {@value}\n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + "----------\n" ); - } - else { - runConformTest(units); + } else { + runNegativeTest(testFiles, + "----------\n" + + "1. ERROR in X.java (at line 5)\n" + + " * {@value Invalid}\n" + + " ^^^^^^^^\n" + + "Javadoc: Invalid reference\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); } } - -public void testBug176027h_public() { - // test embedded inner classes - String[] units = new String[] { - "mainpkg/Outer.java", - "package mainpkg;\n" + - "public class Outer {\n" + - " public class Inner {\n" + - " public class MostInner{\n" + - " \n" + - " }\n" + - " } \n" + - "}\n" - , - "pkg1/Valid1.java", - "package pkg1; \n" + - "import mainpkg.Outer.Inner.MostInner;\n" + - "// valid import - no error in 5.0\n" + - "\n" + - "/** \n" + - " * {@link MostInner}\n" + - " * \n" + - " */ \n" + - "public class Valid1 { \n" + - " /** \n" + - " * {@link MostInner} \n" + - " * \n" + - " */ \n" + - " void m() { } \n" + - "}\n" - , - "pkg2/Valid2.java", - "package pkg2; \n" + - "import mainpkg.Outer.Inner.*;\n" + - "//valid import - no error in 5.0\n" + - "\n" + - "/** \n" + - " * {@link MostInner}\n" + - " * \n" + - " */ \n" + - "public class Valid2 { \n" + - " void m() { } \n" + - "}\n" - , - "pkg3/Invalid3.java", - "package pkg3; \n" + - "import mainpkg.Outer.*;\n" + - "//invalid import: expecting warning / error\n" + - "\n" + - "/** \n" + - " * {@link MostInner} -- error/warning \n" + - " * \n" + - " */ \n" + - "public class Invalid3 { \n" + - " void m() { } \n" + - "}\n" +public void testBug153399e() { + String[] testFiles = new String[] { + "X.java", + "public class X { \n" + + " /**\n" + + " * {@value Invalid}\n" + + " * {@value #MY_VALUE}\n" + + " */\n" + + " public final static int MY_VALUE = 0; \n" + + "}\n" }; - - String error14 = new String ( - //pkg1\Valid1.java:12: warning - Tag @link: reference not found: MostInner - //pkg2\Valid2.java:12: warning - Tag @link: reference not found: MostInner - //pkg3\Invalid3.java:12: warning - Tag @link: reference not found: MostInner - "----------\n" + - "1. ERROR in pkg1\\Valid1.java (at line 6)\n" + - " * {@link MostInner}\n" + - " ^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "----------\n" + - "1. ERROR in pkg2\\Valid2.java (at line 6)\n" + - " * {@link MostInner}\n" + - " ^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "----------\n" + - "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + - " * {@link MostInner} -- error/warning \n" + - " ^^^^^^^^^\n" + - "Javadoc: MostInner cannot be resolved to a type\n" + - "----------\n"); - - String error50 = new String ( - //pkg3\Invalid3.java:12: warning - Tag @link: reference not found: MostInner - "----------\n" + - "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + - " * {@link MostInner} -- error/warning \n" + - " ^^^^^^^^^\n" + - "Javadoc: MostInner cannot be resolved to a type\n" + - "----------\n"); - - this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units,error14); - } - else { - runNegativeTest(units,error50, JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); + runNegativeTest(testFiles, + "----------\n" + + "1. ERROR in X.java (at line 3)\n" + + " * {@value Invalid}\n" + + " ^^^^^\n" + + "Javadoc: Unexpected tag\n" + + "----------\n" + ); + } else { + runNegativeTest(testFiles, + "----------\n" + + "1. ERROR in X.java (at line 3)\n" + + " * {@value Invalid}\n" + + " ^^^^^^^^\n" + + "Javadoc: Invalid reference\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); } } -public void testBug176027h_private() { - // test embedded inner classes - String[] units = new String[] { - "mainpkg/Outer.java", - "package mainpkg;\n" + - "public class Outer {\n" + - " public class Inner {\n" + - " public class MostInner{\n" + - " \n" + - " }\n" + - " } \n" + +/** + * @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" - , - "pkg1/Valid1.java", - "package pkg1; \n" + - "import mainpkg.Outer.Inner.MostInner;\n" + - "// valid import - no error in 5.0\n" + - "\n" + - "/** \n" + - " * {@link MostInner}\n" + - " * \n" + - " */ \n" + - "public class Valid1 { \n" + - " /** \n" + - " * {@link MostInner} \n" + - " * \n" + - " */ \n" + - " void m() { } \n" + - "}\n" - , - "pkg2/Valid2.java", - "package pkg2; \n" + - "import mainpkg.Outer.Inner.*;\n" + - "//valid import - no error in 5.0\n" + - "\n" + - "/** \n" + - " * {@link MostInner}\n" + - " * \n" + - " */ \n" + - "public class Valid2 { \n" + - " void m() { } \n" + - "}\n" - , - "pkg3/Invalid3.java", - "package pkg3; \n" + - "import mainpkg.Outer.*;\n" + - "//invalid import: expecting warning / error\n" + - "\n" + - "/** \n" + - " * {@link MostInner} -- error/warning \n" + - " * \n" + - " */ \n" + - "public class Invalid3 { \n" + - " void m() { } \n" + - "}\n" - }; - - String error14 = new String( - //pkg1\Valid1.java:12: warning - Tag @link: reference not found: MostInner - //pkg1\Valid1.java:17: warning - Tag @link: reference not found: MostInner - //pkg2\Valid2.java:12: warning - Tag @link: reference not found: MostInner - //pkg3\Invalid3.java:12: warning - Tag @link: reference not found: MostInner - "----------\n" + - "1. ERROR in pkg1\\Valid1.java (at line 6)\n" + - " * {@link MostInner}\n" + - " ^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "2. ERROR in pkg1\\Valid1.java (at line 11)\n" + - " * {@link MostInner} \n" + - " ^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "----------\n" + - "1. ERROR in pkg2\\Valid2.java (at line 6)\n" + - " * {@link MostInner}\n" + - " ^^^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "----------\n" + - "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + - " * {@link MostInner} -- error/warning \n" + - " ^^^^^^^^^\n" + - "Javadoc: MostInner cannot be resolved to a type\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", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); +} - String error50 = new String( - //pkg3\Invalid3.java:12: warning - Tag @link: reference not found: MostInner - "----------\n" + - "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + - " * {@link MostInner} -- error/warning \n" + - " ^^^^^^^^^\n" + - "Javadoc: MostInner cannot be resolved to a type\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", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); +} - this.reportInvalidJavadocVisibility = CompilerOptions.PRIVATE; +/** + * @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" + */ +public void testBug165794() { + String[] testFiles = new String[] { + "X.java", + "/**\n" + + " * No reasonable hint for resolving the {@link #getMax(A)}.\n" + + " */\n" + + "public class X {\n" + + " /**\n" + + " * Extends Number method.\n" + + " * @see #getMax(A ipZ)\n" + + " */\n" + + " public T getMax(final A ipY) {\n" + + " return ipY.t();\n" + + " }\n" + + " \n" + + " /**\n" + + " * Extends Exception method.\n" + + " * @see #getMax(A ipY)\n" + + " */\n" + + " public T getMax(final A ipZ) {\n" + + " return ipZ.t();\n" + + " }\n" + + "}\n" + + "class A {\n" + + " T t() { return null; }\n" + + "}\n" + + "class Y {}\n" + + "class Z {}" + }; if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units,error14); - } - else { - runNegativeTest(units,error50, JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); + return; } + runConformTest(testFiles); } /** - * @bug 177009: [javadoc] Missing Javadoc tag not reported - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=177009" + * @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 testBug177009a() { - String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + +public void testBug166365() { + String[] testFiles = new String[] { + "X.java", "public class X {\n" + - " public X(String str, int anInt) {\n" + - " }\n" + - "}\n", - "pkg/Y.java", - "package pkg;\n" + - "\n" + - "public class Y extends X {\n" + - " private static int myInt = 0;\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: Description expected after @return\n" + + "----------\n", + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); +} + +/** + * @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" + - " * @see X#X(String, int)\n" + // case1 potential AIOOBE + " * Values:\n" + + " *
      \n" + + " *
    • {@value #PUBLIC_CONST}
    • \n" + + " *
    • {@value #PROTECTED_CONST}
    • \n" + + " *
    • {@value #DEFAULT_CONST}
    • \n" + + " *
    • {@value #PRIVATE_CONST}
    • \n" + + " *
    \n" + " */\n" + - " public Y(String str) {\n" + - " super(str, myInt);\n" + + " public X() {\n" + " }\n" + "}\n" }; - this.reportMissingJavadocTags = CompilerOptions.WARNING; - runConformTest( - true, - units, + this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(testFiles, "----------\n" + - "1. WARNING in pkg\\Y.java (at line 8)\n" + - " public Y(String str) {\n" + - " ^^^\n" + - "Javadoc: Missing tag for parameter str\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", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); + JavacTestOptions.Excuse.EclipseWarningConfiguredAsError + ); + } } -public void testBug177009b() { +/** + * @bug 168849: [javadoc] Javadoc warning on @see reference in class level docs. + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=168849" + */ +public void testBug168849a() { String[] units = new String[] { "pkg/X.java", "package pkg;\n" + "\n" + "public class X {\n" + - " public X(String str, int anInt) {\n" + + " /**\n" + + " * @see http://www.eclipse.org/\n" + + " */\n" + + " public void foo() { \n" + + " \n" + " }\n" + - "}\n", - "pkg/Y.java", + "}\n" + }; + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(true, units, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 5)\n" + + " * @see http://www.eclipse.org/\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); +} + +public void testBug168849b() { + String[] units = new String[] { + "pkg/X.java", "package pkg;\n" + "\n" + - "public class Y extends X {\n" + + "public class X {\n" + " /**\n" + - " * @param str\n" + - " * @param anInt\n" + - " * @see X#X(String, int)\n" + // case2 find super ref + " * @see http://ftp.eclipse.org/\n" + " */\n" + - " public Y(String str, int anInt, int anotherInt) {\n" + - " super(str, anInt);\n" + + " public void foo() { \n" + + " \n" + " }\n" + "}\n" }; - this.reportMissingJavadocTags = CompilerOptions.WARNING; + this.reportInvalidJavadoc = CompilerOptions.WARNING; runConformTest(true, units, "----------\n" + - "1. WARNING in pkg\\Y.java (at line 9)\n" + - " public Y(String str, int anInt, int anotherInt) {\n" + - " ^^^^^^^^^^\n" + - "Javadoc: Missing tag for parameter anotherInt\n" + + "1. WARNING in pkg\\X.java (at line 5)\n" + + " * @see http://ftp.eclipse.org/\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + "----------\n", null, null, JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); } -/** - * @bug 190970: [javadoc] "field never read locally" analysis should not consider javadoc - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=190970" - */ -public void testBug190970a() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING); - this.runConformTest( - true, - new String[] { - "pkg/X.java", - "public class X {\n" + - "private int unused1;\n" + - "\n" + - "/**\n" + - " * Same value as {@link #unused1}\n" + - " */\n" + - "private int unused2;\n" + - "}\n", - }, - null, - customOptions, - "----------\n" + - "1. WARNING in pkg\\X.java (at line 2)\n" + - " private int unused1;\n" + - " ^^^^^^^\n" + - "The field X.unused1 is never read locally\n" + - "----------\n" + - "2. WARNING in pkg\\X.java (at line 7)\n" + - " private int unused2;\n" + - " ^^^^^^^\n" + - "The field X.unused2 is never read locally\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings - ); -} -// test unused methods -public void testBug190970b() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING); - this.runConformTest( - true, - new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - "private void unused1() {}\n" + - "/**\n" + - " * Same value as {@link #unused1()}\n" + - " */\n" + - "private void unused2() {}\n" + - "}\n", - }, - null, - customOptions, - "----------\n" + - "1. WARNING in pkg\\X.java (at line 4)\n" + - " private void unused1() {}\n" + - " ^^^^^^^^^\n" + - "The method unused1() from the type X is never used locally\n" + - "----------\n" + - "2. WARNING in pkg\\X.java (at line 8)\n" + - " private void unused2() {}\n" + - " ^^^^^^^^^\n" + - "The method unused2() from the type X is never used locally\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings - ); -} -// test unused types -public void testBug190970c() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING); +public void testBug168849c() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + " /**\n" + + " * @see ://\n" + + " */\n" + + " public void foo() { \n" + + " \n" + + " }\n" + + "}\n" + }; + this.reportInvalidJavadoc = CompilerOptions.WARNING; runConformTest( - true, - new String[] { + true, units, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 5)\n" + + " * @see ://\n" + + " ^^^\n" + + "Javadoc: Missing reference\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); +} + +public void testBug168849d() { + String[] units = new String[] { "pkg/X.java", "package pkg;\n" + "\n" + "public class X {\n" + - "private class unused1 {}\n" + - "/**\n" + - " * {@link X.unused1}\n" + - " */\n" + - "private class unused2 {}\n" + - "}\n", - }, - null, - customOptions, - "----------\n" + - "1. WARNING in pkg\\X.java (at line 4)\n" + - " private class unused1 {}\n" + - " ^^^^^^^\n" + - "The type X.unused1 is never used locally\n" + - "----------\n" + - "2. WARNING in pkg\\X.java (at line 8)\n" + - " private class unused2 {}\n" + - " ^^^^^^^\n" + - "The type X.unused2 is never used locally\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings - ); + " /**\n" + + " * @see http\u003A\u002F\u002Fwww.eclipse.org\n" + + " */\n" + + " public void foo() { \n" + + " \n" + + " }\n" + + "}\n" + }; + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(true, units, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 5)\n" + + " * @see http://www.eclipse.org\n" + + " ^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); } -// static { TESTS_PREFIX = "testBug191322"; } -/** - * @bug 191322: [javadoc] @see or @link reference to method without signature fails to resolve to base class method - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=191322" - */ -public void testBug191322() { - runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {}\n" + - " /**\n" + - " * {@link #foo}.\n" + - " * @see #foo\n" + - " */\n" + - " void goo() {}\n" + - "}\n", - "Y.java", - "class Y extends X {\n" + - " /**\n" + - " * {@link #foo}\n" + - " * @see #foo\n" + - " */\n" + - " void hoo() {}\n" + - "}" - } - ); +public void testBug168849e() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + " /**\n" + + " * @see \"http\u003A\u002F\u002Fwww.eclipse.org\"\n" + + " */\n" + + " public void foo() { \n" + + " \n" + + " }\n" + + "}\n" + }; + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(units); } -public void testBug191322b() { - runConformTest( - new String[] { - "b/X.java", - "package b;\n" + - "public class X {\n" + - " void foo() {}\n" + - "}\n" + - "class Y extends X {}\n" + - "class W extends Y {}\n" + - "class Z extends W {\n" + - " /**\n" + - " * {@link #foo}\n" + - " * @see #foo\n" + - " */\n" + - " void hoo() {}\n" + - "}\n" - } - ); + +public void testBug168849f() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + " /**\n" + + " * @see \"http://www.eclipse.org/\"\n" + + " */\n" + + " public void foo() { \n" + + " \n" + + " }\n" + + "}\n" + }; + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(units); } -public void testBug191322c() { - runConformTest( - new String[] { - "c/X.java", - "package c;\n" + - "public interface X {\n" + - " void foo();\n" + - "}\n" + - "interface Y extends X {\n" + - " /**\n" + - " * {@link #foo}\n" + - " * @see #foo\n" + - " */\n" + - " void hoo();\n" + - "}\n" - } - ); + +public void testBug168849g() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + " /**\n" + + " * @see http:/ invalid reference\n" + + " */\n" + + " public void foo() { \n" + + " \n" + + " }\n" + + "}\n" + }; + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(true, units, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 5)\n" + + " * @see http:/ invalid reference\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Malformed reference (missing end space separator)\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); } -public void testBug191322d() { - runConformTest( - new String[] { - "d/X.java", - "package d;\n" + - "public interface X {\n" + - " void foo();\n" + - "}\n" + - "interface Y extends X {}\n" + - "abstract class W implements Y {}\n" + - "abstract class Z extends W {\n" + - " /**\n" + - " * {@link #foo}\n" + - " * @see #foo\n" + - " */\n" + - " void hoo() {}\n" + - "}\n" - } - ); + +public void testBug168849h() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + " /**\n" + + " * @see Object:/ invalid reference\n" + + " */\n" + + " public void foo() { \n" + + " \n" + + " }\n" + + "}\n" + }; + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(true, units, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 5)\n" + + " * @see Object:/ invalid reference\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Malformed reference (missing end space separator)\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); } -public void testBug191322e() { - runConformTest( - new String[] { - "e/X.java", - "package e;\n" + - "public class X {\n" + - " void foo() {}\n" + - " class Y {\n" + - " /**\n" + - " * {@link #foo}\n" + - " * @see #foo\n" + - " */\n" + - " void hoo() {}\n" + - " }\n" + - "}\n" - } - ); + +public void testBug168849i() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + " /**\n" + + " * @see http\u003A\u002F invalid reference\n" + + " */\n" + + " public void foo() { \n" + + " \n" + + " }\n" + + "}\n" + }; + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(true, units, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 5)\n" + + " * @see http:/ invalid reference\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Malformed reference (missing end space separator)\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); } -public void testBug191322f() { + +public void testBug168849j() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + " /**\n" + + " * @see Object\u003A\u002F invalid reference\n" + + " */\n" + + " public void foo() { \n" + + " \n" + + " }\n" + + "}\n" + }; + this.reportInvalidJavadoc = CompilerOptions.WARNING; + runConformTest(true, units, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 5)\n" + + " * @see Object:/ invalid reference\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Javadoc: Malformed reference (missing end space separator)\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); +} + +/** + * @bug 170637: [javadoc] incorrect warning about missing parameter javadoc when using many links + * @test Verify that javadoc parser is not blown-up when there's a lot of inline tags + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=170637" + */ +public void testBug170637() { + this.reportMissingJavadocTags = CompilerOptions.ERROR; runConformTest( new String[] { - "f/X.java", - "package f;\n" + - "public class X {\n" + - " void foo() {}\n" + - " void foo(String str) {}\n" + - "}\n" + - "class Y extends X {\n" + - " /**\n" + - " * {@link #foo}\n" + - " * @see #foo\n" + - " */\n" + - " void hoo() {}\n" + + "src/JavaDocTest.java", + "public interface JavaDocTest\n" + + "{\n" + + " /**\n" + + " * This is some stupid test...\n" + + " * \n" + + " * {@link JavaDocTest}\n" + + " * \n" + + " * @param bar1 {@link JavaDocTest}\n" + + " * @param bar2 {@link JavaDocTest}\n" + + " * @param bar3 {@link JavaDocTest}\n" + + " * @param bar4 {@link JavaDocTest}\n" + + " * @param bar5 {@link JavaDocTest}\n" + + " * @param bar6 {@link JavaDocTest}\n" + + " * @param bar7 {@link JavaDocTest}\n" + + " * @param bar8 {@link JavaDocTest}\n" + + " * @param bar9 {@link JavaDocTest}\n" + + " * @param bar10 {@link JavaDocTest}\n" + + " * @param bar11 {@link JavaDocTest}\n" + + " * @param bar12 {@link JavaDocTest}\n" + + " * @param bar13 {@link JavaDocTest}\n" + + " * \n" + + " * @return A string!\n" + + " */\n" + + " public String foo(String bar1,\n" + + " String bar2,\n" + + " String bar3,\n" + + " String bar4,\n" + + " String bar5,\n" + + " String bar6,\n" + + " String bar7,\n" + + " String bar8,\n" + + " String bar9,\n" + + " String bar10,\n" + + " String bar11,\n" + + " String bar12,\n" + + " String bar13\n" + + " );\n" + + "\n" + + " /**\n" + + " * This is some more stupid test...\n" + + " * \n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * {@link JavaDocTest}\n" + + " * \n" + + " * @param bar1 \n" + + " * @param bar2 \n" + + " * @param bar3 \n" + + " * @param bar4 \n" + + " * @param bar5 \n" + + " * @param bar6 \n" + + " * @param bar7 \n" + + " * @param bar8 \n" + + " * @param bar9 \n" + + " * @param bar10 \n" + + " * @param bar11 \n" + + " * @param bar12 \n" + + " * @param bar13 \n" + + " * \n" + + " * @return A string!\n" + + " */\n" + + " public String foo2(String bar1,\n" + + " String bar2,\n" + + " String bar3,\n" + + " String bar4,\n" + + " String bar5,\n" + + " String bar6,\n" + + " String bar7,\n" + + " String bar8,\n" + + " String bar9,\n" + + " String bar10,\n" + + " String bar11,\n" + + " String bar12,\n" + + " String bar13\n" + + " );\n" + "}\n" } ); } -public void testBug191322g() { - runConformTest( - new String[] { - "g/X.java", - "package g;\n" + - "public class X {\n" + - " void foo(String str) {}\n" + - " void foo(int x) {}\n" + - "}\n" + - "class Y extends X {\n" + - " /**\n" + - " * {@link #foo}\n" + - " * @see #foo\n" + - " */\n" + - " void hoo() {}\n" + - "}\n" - } - ); -} -public void testBug191322h() { - runConformTest( - new String[] { - "h/X.java", - "package h;\n" + - "public class X {\n" + - " void foo(String str) {}\n" + - "}\n" + - "class Y extends X {\n" + - " /**\n" + - " * {@link #foo}\n" + - " * @see #foo\n" + - " */\n" + - " void hoo() {}\n" + - "}\n" - } - ); +public void testBug170637a() { + // conform test: verify we can handle a large number of tags + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "public interface X\n" + + "{\n" + + " /**\n" + + " * Test for bug {@link \"https://bugs.eclipse.org/bugs/show_bug.cgi?id=170637\"}\n" + + " * \n" + + " * \n" + + " * @param bar1 {@link X}\n" + + " * @param bar2 {@link X}\n" + + " * @param bar3 {@link X}\n" + + " * @param bar4 {@link X}\n" + + " * @param bar5 {@link X}\n" + + " * @param bar6 {@link X}\n" + + " * @param bar7 {@link X}\n" + + " * @param bar8 {@link X}\n" + + " * @param bar9 {@link X}\n" + + " * @param bar10 {@link X}\n" + + " * @param bar11 {@link X}\n" + + " * @param bar12 {@link X}\n" + + " * @param bar13 {@link X}\n" + + " * @param bar14 {@link X}\n" + + " * @param bar15 {@link X}\n" + + " * @param bar16 {@link X}\n" + + " * @param bar17 {@link X}\n" + + " * @param bar18 {@link X}\n" + + " * @param bar19 {@link X}\n" + + " * @param bar20 {@link X}\n" + + " * @param bar21 {@link X}\n" + + " * @param bar22 {@link X}\n" + + " * @param bar23 {@link X}\n" + + " * @param bar24 {@link X}\n" + + " * @param bar25 {@link X}\n" + + " * @param bar26 {@link X}\n" + + " * @param bar27 {@link X}\n" + + " * @param bar28 {@link X}\n" + + " * @param bar29 {@link X}\n" + + " * @param bar30 {@link X}\n" + + " * \n" + + " * @return A string\n" + + " */\n" + + " public String foo(String bar1,\n" + + " String bar2,\n" + + " String bar3,\n" + + " String bar4,\n" + + " String bar5,\n" + + " String bar6,\n" + + " String bar7,\n" + + " String bar8,\n" + + " String bar9,\n" + + " String bar10,\n" + + " String bar11,\n" + + " String bar12,\n" + + " String bar13,\n" + + " String bar14,\n" + + " String bar15,\n" + + " String bar16,\n" + + " String bar17,\n" + + " String bar18,\n" + + " String bar19,\n" + + " String bar20,\n" + + " String bar21,\n" + + " String bar22,\n" + + " String bar23,\n" + + " String bar24,\n" + + " String bar25,\n" + + " String bar26,\n" + + " String bar27,\n" + + " String bar28,\n" + + " String bar29,\n" + + " String bar30\n" + + " );\n" + + "}\n" + }; + this.reportMissingJavadocTags = CompilerOptions.ERROR; + runConformTest(units); } -public void testBug191322i() { - runConformTest( - new String[] { - "i/X.java", - "package i;\n" + - "interface X {\n" + - " void foo();\n" + - "}\n" + - "interface Y {\n" + - " void foo(int i);\n" + - "}\n" + - "abstract class Z implements X, Y {\n" + - " /**\n" + - " * @see #foo\n" + - " */\n" + - " void bar() {\n" + - " }\n" + - "}" - } - ); +public void testBug170637b() { + // conform test: verify we are able to raise warnings when dealing with a large number of tags + String[] units = new String[] { + "X.java", + "public interface X\n" + + "{\n" + + " /**\n" + + " * Test for bug {@link \"https://bugs.eclipse.org/bugs/show_bug.cgi?id=170637\"}\n" + + " * \n" + + " * \n" + + " * @param bar1 {@link X}\n" + + " * @param bar2 {@link X}\n" + + " * @param bar3 {@link X}\n" + + " * @param bar4 {@link X}\n" + + " * @param bar5 {@link X}\n" + + " * @param bar6 {@link X}\n" + + " * @param bar7 {@link X}\n" + + " * @param bar8 {@link X}\n" + + " * @param bar9 {@link X}\n" + + " * @param bar10 {@link X}\n" + + " * @param bar11 {@link X}\n" + + " * @param bar12 {@link X}\n" + + " * @param bar13 {@link X}\n" + + " * @param bar14 {@link X}\n" + + " * @param bar15 {@link X}\n" + + " * @param bar16 {@link X}\n" + + " * @param bar17 {@link X}\n" + + " * @param bar18 {@link X}\n" + + " * @param bar19 {@link X}\n" + + " * @param bar20 {@link X}\n" + + " * @param bar21 {@link X}\n" + + " * @param bar22 {@link X}\n" + + " * @param bar23 {@link X}\n" + + " * @param bar24 {@link X}\n" + + " * @param bar25 {@link X}\n" + + " * @param bar26 {@link X}\n" + + " * @param bar27 {@link X}\n" + + " * @param bar28 {@link X}\n" + + " * @param bar29 {@link X}\n" + + " * @param bar30 {@link X}\n" + + " * \n" + + " * @return A string\n" + + " */\n" + + " public String foo(String bar1,\n" + + " String bar2,\n" + + " String bar3,\n" + + " String bar4,\n" + + " String bar5,\n" + + " String bar6,\n" + + " String bar7,\n" + + " String bar8,\n" + + " String bar9,\n" + + " String bar10,\n" + + " String bar11,\n" + + " String bar12,\n" + + " String bar13,\n" + + " String bar14,\n" + + " String bar15,\n" + + " String bar16,\n" + + " String bar17,\n" + + " String bar18,\n" + + " String bar19,\n" + + " String bar20,\n" + + " String bar21,\n" + + " String bar22,\n" + + " String bar23,\n" + + " String bar24,\n" + + " String bar25,\n" + + " String bar26,\n" + + " String bar27,\n" + + " String bar28,\n" + + " String bar29,\n" + + " String bar30,\n" + + " String bar31\n" + + " );\n" + + "}\n" + }; + this.reportMissingJavadocTags = CompilerOptions.ERROR; + runNegativeTest(units, + "----------\n" + + "1. ERROR in X.java (at line 70)\n" + + " String bar31\n" + + " ^^^^^\n" + + "Javadoc: Missing tag for parameter bar31\n" + + "----------\n"); } /** - * @bug 195374: [javadoc] Missing Javadoc warning for required qualification for inner types at 1.4 level - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=195374" + * Bug 176027: [javadoc] @link to member type handled incorrectly + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=176027" */ -public void testBug195374() { +public void testBug176027a() { + // case1 class X static class Inner String[] units = new String[] { - "X.java", - "public class X {\n" + - " public static class Param {\n" + - " /**\n" + - " * warning expected when compliance < 1.5 {@link X#setParams(Param[])}\n" + - " * no warning expected {@link X#setParams(X.Param[])}\n" + - " */\n" + - " public int getIndex() {\n" + - " return 0;\n" + - " }\n" + - " }\n" + - " public void setParams(Param[] params) {\n" + - " }\n" + + "otherpkg/C.java", + "package otherpkg;\n" + + "public class C {\n" + + " public static class Inner { }\n" + + "}\n" + , + "somepkg/MemberTypeDocTest.java", + "package somepkg;\n" + + "import otherpkg.C.Inner;\n" + + "/**\n" + + " * {@link Inner} -- error/warning \n" + + " */\n" + + "public class MemberTypeDocTest {\n" + + " void m() { }\n" + "}\n" }; - - String error14 = new String( - // warning - Tag @link: can't find setParams(Param[]) in X - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " * warning expected when compliance < 1.5 {@link X#setParams(Param[])}\n" + - " ^^^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n"); - this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; if (this.complianceLevel <= ClassFileConstants.JDK1_4) { - runNegativeTest(units,error14); + runNegativeTest(units, + //somepkg/MemberTypeDocTest.java:6: warning - Tag @link: reference not found: Inner + "----------\n" + + "1. ERROR in somepkg\\MemberTypeDocTest.java (at line 4)\n" + + " * {@link Inner} -- error/warning \n" + + " ^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + ); } else { runConformTest(units); } } -/** - * Bug 86769: [javadoc] Warn/Error for 'Missing javadoc comments' doesn't recognize private inner classes - * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=86769" - */ -public void testBug86769_Classes1() { - this.reportMissingJavadocComments = CompilerOptions.ERROR; - this.reportMissingJavadocCommentsVisibility = CompilerOptions.PROTECTED; - runNegativeTest( - new String[] { - "A.java", - "/**\n" + - " * Test bug 86769 \n" + - " */\n" + - "public class A {\n" + - " private class Level1Private {\n" + - " private class Level2_PrivPriv {}\n" + - " class Level2_PrivDef {}\n" + - " protected class Level2_PrivPro {}\n" + - " public class Level2_PrivPub {}\n" + - " }\n" + - " class Level1Default{\n" + - " private class Level2_DefPriv {}\n" + - " class Level2_DefDef {}\n" + - " protected class Level2_DefPro {}\n" + - " public class Level2_DefPub {}\n" + - " }\n" + - " protected class Level1Protected {\n" + - " private class Level2_ProtPriv {}\n" + - " class Level2_ProDef {}\n" + - " protected class Level2_ProPro {}\n" + - " public class Level2_ProPub {} \n" + - " }\n" + - " public class Level1Public {\n" + - " private class Level2_PubPriv {}\n" + - " class Level2_PubDef {}\n" + - " protected class Level2_PubPro {}\n" + - " public class Level2_PubPub {}\n" + - " }\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in A.java (at line 17)\n" + - " protected class Level1Protected {\n" + - " ^^^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for protected declaration\n" + - "----------\n" + - "2. ERROR in A.java (at line 20)\n" + - " protected class Level2_ProPro {}\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for protected declaration\n" + - "----------\n" + - "3. ERROR in A.java (at line 21)\n" + - " public class Level2_ProPub {} \n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for protected declaration\n" + - "----------\n" + - "4. ERROR in A.java (at line 23)\n" + - " public class Level1Public {\n" + - " ^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for public declaration\n" + - "----------\n" + - "5. ERROR in A.java (at line 26)\n" + - " protected class Level2_PubPro {}\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for protected declaration\n" + - "----------\n" + - "6. ERROR in A.java (at line 27)\n" + - " public class Level2_PubPub {}\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for public declaration\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); +public void testBug176027b() { + // case3 class X class Inner + String[] units = new String[] { + "otherpkg/C.java", + "package otherpkg;\n" + + "public class C {\n" + + " public class Inner { }\n" + + "}\n" + , + "somepkg/MemberTypeDocTest.java", + "package somepkg;\n" + + "import otherpkg.C.Inner;\n" + + "/**\n" + + " * {@link Inner} -- error/warning \n" + + " */\n" + + "public class MemberTypeDocTest {\n" + + " void m() { }\n" + + "}\n" + }; + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(units, + //somepkg/MemberTypeDocTest.java:6: warning - Tag @link: reference not found: Inner + "----------\n" + + "1. ERROR in somepkg\\MemberTypeDocTest.java (at line 4)\n" + + " * {@link Inner} -- error/warning \n" + + " ^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + ); + } + else { + runConformTest(units); + } } -public void testBug86769_Classes2() { - this.reportMissingJavadocComments = CompilerOptions.ERROR; - this.reportMissingJavadocCommentsVisibility = CompilerOptions.DEFAULT; - runNegativeTest( - new String[] { - "B.java", - "/**\n" + - " * Test bug 86769\n" + - " */\n" + - "public class B {\n" + - " class Level0_Default {\n" + - " private class Level1Private {\n" + - " private class Level2_PrivPriv {}\n" + - " class Level2_PrivDef {}\n" + - " protected class Level2_PrivPro {}\n" + - " public class Level2_PrivPub {}\n" + - " }\n" + - " }\n" + - " public class Level0_Public {\n" + - " class Level1Default{\n" + - " private class Level2_DefPriv {}\n" + - " class Level2_DefDef {}\n" + - " protected class Level2_DefPro {}\n" + - " public class Level2_DefPub {}\n" + - " }\n" + - " }\n" + - " protected class Level0_Protected {\n" + - " protected class Level1Protected {\n" + - " private class Level2_ProtPriv {}\n" + - " class Level2_ProDef {}\n" + - " protected class Level2_ProPro {}\n" + - " public class Level2_ProPub {} \n" + - " }\n" + - " }\n" + - " private class Level0_Private {\n" + - " public class Level1Public {\n" + - " private class Level2_PubPriv {}\n" + - " class Level2_PubDef {}\n" + - " protected class Level2_PubPro {}\n" + - " public class Level2_PubPub {}\n" + - " }\n" + - " }\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in B.java (at line 5)\n" + - " class Level0_Default {\n" + - " ^^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for default declaration\n" + - "----------\n" + - "2. ERROR in B.java (at line 13)\n" + - " public class Level0_Public {\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for public declaration\n" + - "----------\n" + - "3. ERROR in B.java (at line 14)\n" + - " class Level1Default{\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for default declaration\n" + - "----------\n" + - "4. ERROR in B.java (at line 16)\n" + - " class Level2_DefDef {}\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for default declaration\n" + - "----------\n" + - "5. ERROR in B.java (at line 17)\n" + - " protected class Level2_DefPro {}\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for default declaration\n" + - "----------\n" + - "6. ERROR in B.java (at line 18)\n" + - " public class Level2_DefPub {}\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for default declaration\n" + - "----------\n" + - "7. ERROR in B.java (at line 21)\n" + - " protected class Level0_Protected {\n" + - " ^^^^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for protected declaration\n" + - "----------\n" + - "8. ERROR in B.java (at line 22)\n" + - " protected class Level1Protected {\n" + - " ^^^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for protected declaration\n" + - "----------\n" + - "9. ERROR in B.java (at line 24)\n" + - " class Level2_ProDef {}\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for default declaration\n" + - "----------\n" + - "10. ERROR in B.java (at line 25)\n" + - " protected class Level2_ProPro {}\n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for protected declaration\n" + - "----------\n" + - "11. ERROR in B.java (at line 26)\n" + - " public class Level2_ProPub {} \n" + - " ^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for protected declaration\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); -} -public void testBug86769_Field1() { - this.reportMissingJavadocComments = CompilerOptions.ERROR; - this.reportMissingJavadocCommentsVisibility = CompilerOptions.PUBLIC; - runNegativeTest( - new String[] { - "A.java", - "/**\n" + - " * Test bug 86769\n" + - " */\n" + - "public class A {\n" + - " private class InnerPrivate {\n" + - " private int pri_pri;\n" + - " int pri_def;\n" + - " protected int pri_pro;\n" + - " public int pri_pub;\n" + - " }\n" + - " class InnerDefault{\n" + - " private int def_pri;\n" + - " int def_def;\n" + - " protected int def_pro;\n" + - " public int def_pub;\n" + - " }\n" + - " protected class InnerProtected {\n" + - " private int pro_pri;\n" + - " int pro_def;\n" + - " protected int pro_pro;\n" + - " public int pro_pub; \n" + - " }\n" + - " public class InnerPublic {\n" + - " private int pub_pri;\n" + - " int pub_def;\n" + - " protected int pub_pro;\n" + - " public int pub_pub;\n" + - " }\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in A.java (at line 23)\n" + - " public class InnerPublic {\n" + - " ^^^^^^^^^^^\n" + - "Javadoc: Missing comment for public declaration\n" + - "----------\n" + - "2. ERROR in A.java (at line 27)\n" + - " public int pub_pub;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for public declaration\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); -} -public void testBug86769_Fields2() { - this.reportMissingJavadocComments = CompilerOptions.ERROR; - this.reportMissingJavadocCommentsVisibility = CompilerOptions.PRIVATE; - runNegativeTest( - new String[] { - "B.java", - "/**\n" + - " * Test bug 86769\n" + - " */\n" + - "public class B {\n" + - " private class Level1 {\n" + - " private class InnerPrivate {\n" + - " private int pri_pri;\n" + - " int pri_def;\n" + - " protected int pri_pro;\n" + - " public int pri_pub;\n" + - " }\n" + - " class InnerDefault{\n" + - " private int def_pri;\n" + - " int def_def;\n" + - " protected int def_pro;\n" + - " public int def_pub;\n" + - " }\n" + - " protected class InnerProtected {\n" + - " private int pro_pri;\n" + - " int pro_def;\n" + - " protected int pro_pro;\n" + - " public int pro_pub; \n" + - " }\n" + - " public class InnerPublic {\n" + - " private int pub_pri;\n" + - " int pub_def;\n" + - " protected int pub_pro;\n" + - " public int pub_pub;\n" + - " }\n" + - " }\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in B.java (at line 5)\n" + - " private class Level1 {\n" + - " ^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "2. ERROR in B.java (at line 6)\n" + - " private class InnerPrivate {\n" + - " ^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "3. ERROR in B.java (at line 7)\n" + - " private int pri_pri;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "4. ERROR in B.java (at line 8)\n" + - " int pri_def;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "5. ERROR in B.java (at line 9)\n" + - " protected int pri_pro;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "6. ERROR in B.java (at line 10)\n" + - " public int pri_pub;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "7. ERROR in B.java (at line 12)\n" + - " class InnerDefault{\n" + - " ^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "8. ERROR in B.java (at line 13)\n" + - " private int def_pri;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "9. ERROR in B.java (at line 14)\n" + - " int def_def;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "10. ERROR in B.java (at line 15)\n" + - " protected int def_pro;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "11. ERROR in B.java (at line 16)\n" + - " public int def_pub;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "12. ERROR in B.java (at line 18)\n" + - " protected class InnerProtected {\n" + - " ^^^^^^^^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "13. ERROR in B.java (at line 19)\n" + - " private int pro_pri;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "14. ERROR in B.java (at line 20)\n" + - " int pro_def;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "15. ERROR in B.java (at line 21)\n" + - " protected int pro_pro;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "16. ERROR in B.java (at line 22)\n" + - " public int pro_pub; \n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "17. ERROR in B.java (at line 24)\n" + - " public class InnerPublic {\n" + - " ^^^^^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "18. ERROR in B.java (at line 25)\n" + - " private int pub_pri;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "19. ERROR in B.java (at line 26)\n" + - " int pub_def;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "20. ERROR in B.java (at line 27)\n" + - " protected int pub_pro;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n" + - "21. ERROR in B.java (at line 28)\n" + - " public int pub_pub;\n" + - " ^^^^^^^\n" + - "Javadoc: Missing comment for private declaration\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); -} -public void testBug86769_Metthods1() { - this.reportMissingJavadocComments = CompilerOptions.ERROR; - this.reportMissingJavadocCommentsVisibility = CompilerOptions.PUBLIC; - runNegativeTest( - new String[] { - "A.java", - "/**\n" + - " * Test bug 86769\n" + - " */\n" + - "public class A {\n" + - " private class InnerPrivate {\n" + - " private void pri_pri() {}\n" + - " void pri_def() {}\n" + - " protected void pri_pro() {}\n" + - " public void pri_pub() {}\n" + - " }\n" + - " class InnerDefault{\n" + - " private void def_pri() {}\n" + - " void def_def() {}\n" + - " protected void def_pro() {}\n" + - " public void def_pub() {}\n" + - " }\n" + - " protected class InnerProtected {\n" + - " private void pro_pri() {}\n" + - " void pro_def() {}\n" + - " protected void pro_pro() {}\n" + - " public void pro_pub() {} \n" + - " }\n" + - " public class InnerPublic {\n" + - " private void pub_pri() {}\n" + - " void pub_def() {}\n" + - " protected void pub_pro() {}\n" + - " public void pub_pub() {}\n" + - " }\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in A.java (at line 23)\n" + - " public class InnerPublic {\n" + - " ^^^^^^^^^^^\n" + - "Javadoc: Missing comment for public declaration\n" + - "----------\n" + - "2. ERROR in A.java (at line 27)\n" + - " public void pub_pub() {}\n" + - " ^^^^^^^^^\n" + - "Javadoc: Missing comment for public declaration\n" + - "----------\n", - JavacTestOptions.Excuse.EclipseWarningConfiguredAsError - ); + +public void testBug176027c() { + // case3 class X interface Inner + String[] units = new String[] { + "otherpkg/C.java", + "package otherpkg;\n" + + "public class C {\n" + + " public interface Inner { }\n" + + "}\n" + , + "somepkg/MemberTypeDocTest.java", + "package somepkg;\n" + + "import otherpkg.C.Inner;\n" + + "/**\n" + + " * {@link Inner} -- error/warning \n" + + " */\n" + + "public class MemberTypeDocTest {\n" + + " void m() { }\n" + + "}\n" + }; + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(units, + //somepkg/MemberTypeDocTest.java:6: warning - Tag @link: reference not found: Inner + "----------\n" + + "1. ERROR in somepkg\\MemberTypeDocTest.java (at line 4)\n" + + " * {@link Inner} -- error/warning \n" + + " ^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + ); + } + else { + runConformTest(units); + } } -public void testBug86769_Methods2() { - this.reportMissingJavadocComments = CompilerOptions.ERROR; - this.reportMissingJavadocCommentsVisibility = CompilerOptions.PROTECTED; - runConformTest( - new String[] { - "B.java", - "/**\n" + - " * Test bug 86769\n" + - " */\n" + - "public class B {\n" + - " private class Level1 {\n" + - " private class InnerPrivate {\n" + - " private void pri_pri() {}\n" + - " void pri_def() {}\n" + - " protected void pri_pro() {}\n" + - " public void pri_pub() {}\n" + - " }\n" + - " class InnerDefault{\n" + - " private void def_pri() {}\n" + - " void def_def() {}\n" + - " protected void def_pro() {}\n" + - " public void def_pub() {}\n" + - " }\n" + - " protected class InnerProtected {\n" + - " private void pro_pri() {}\n" + - " void pro_def() {}\n" + - " protected void pro_pro() {}\n" + - " public void pro_pub() {} \n" + - " }\n" + - " public class InnerPublic {\n" + - " private void pub_pri() {}\n" + - " void pub_def() {}\n" + - " protected void pub_pro() {}\n" + - " public void pub_pub() {}\n" + - " }\n" + - " }\n" + - "}\n" - } - ); + +public void testBug176027d() { + // case4 interface X static class Inner + String[] units = new String[] { + "otherpkg/C.java", + "package otherpkg;\n" + + "public interface C {\n" + + " public static class Inner { }\n" + + "}\n" + , + "somepkg/MemberTypeDocTest.java", + "package somepkg;\n" + + "import otherpkg.C.Inner;\n" + + "/**\n" + + " * {@link Inner} -- error/warning \n" + + " */\n" + + "public class MemberTypeDocTest {\n" + + " void m() { }\n" + + "}\n" + }; + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(units, + //somepkg/MemberTypeDocTest.java:6: warning - Tag @link: reference not found: Inner + "----------\n" + + "1. ERROR in somepkg\\MemberTypeDocTest.java (at line 4)\n" + + " * {@link Inner} -- error/warning \n" + + " ^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + ); + } + else { + runConformTest(units); + } } -/** - * @bug 125518: [javadoc] Embedding html in a link placed in a @see JavaDoc tag causes a warning - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=125518" - */ -public void testBug125518a() { +public void testBug176027f() { + // case5 interface X class Inner String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - " /**\n" + - " * @see invalid>invalid>invalid>invalid>invalid>\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + - "}\n" - }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(true, units, - "----------\n" + - "1. WARNING in pkg\\X.java (at line 5)\n" + - " * @see invalid>\n" + - " ^^^\n" + - "Javadoc: Malformed link reference\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); -} + String error14 = new String ( + //pkg1\Valid1.java:12: warning - Tag @link: reference not found: MostInner + //pkg2\Valid2.java:12: warning - Tag @link: reference not found: MostInner + //pkg3\Invalid3.java:12: warning - Tag @link: reference not found: MostInner + "----------\n" + + "1. ERROR in pkg1\\Valid1.java (at line 6)\n" + + " * {@link MostInner}\n" + + " ^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "----------\n" + + "1. ERROR in pkg2\\Valid2.java (at line 6)\n" + + " * {@link MostInner}\n" + + " ^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "----------\n" + + "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + + " * {@link MostInner} -- error/warning \n" + + " ^^^^^^^^^\n" + + "Javadoc: MostInner cannot be resolved to a type\n" + + "----------\n"); -public void testBug125518d() { - String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - " /**\n" + - " * @see invalid>\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + - "}\n" - }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(true, units, + String error50 = new String ( + //pkg3\Invalid3.java:12: warning - Tag @link: reference not found: MostInner "----------\n" + - "1. WARNING in pkg\\X.java (at line 5)\n" + - " * @see invalid>\n" + - " ^^^^^\n" + - "Javadoc: Malformed link reference\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); -} + "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + + " * {@link MostInner} -- error/warning \n" + + " ^^^^^^^^^\n" + + "Javadoc: MostInner cannot be resolved to a type\n" + + "----------\n"); -public void testBug125518e() { - String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - " /**\n" + - " * @see value\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + - "}\n" - }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(units); + this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(units,error14); + } + else { + runNegativeTest(units,error50, JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); + } } -/** - * @bug 168849: [javadoc] Javadoc warning on @see reference in class level docs. - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=168849" - */ -public void testBug168849a() { +public void testBug176027h_private() { + // test embedded inner classes String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - " /**\n" + - " * @see http://www.eclipse.org/\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + - "}\n" + "mainpkg/Outer.java", + "package mainpkg;\n" + + "public class Outer {\n" + + " public class Inner {\n" + + " public class MostInner{\n" + + " \n" + + " }\n" + + " } \n" + + "}\n" + , + "pkg1/Valid1.java", + "package pkg1; \n" + + "import mainpkg.Outer.Inner.MostInner;\n" + + "// valid import - no error in 5.0\n" + + "\n" + + "/** \n" + + " * {@link MostInner}\n" + + " * \n" + + " */ \n" + + "public class Valid1 { \n" + + " /** \n" + + " * {@link MostInner} \n" + + " * \n" + + " */ \n" + + " void m() { } \n" + + "}\n" + , + "pkg2/Valid2.java", + "package pkg2; \n" + + "import mainpkg.Outer.Inner.*;\n" + + "//valid import - no error in 5.0\n" + + "\n" + + "/** \n" + + " * {@link MostInner}\n" + + " * \n" + + " */ \n" + + "public class Valid2 { \n" + + " void m() { } \n" + + "}\n" + , + "pkg3/Invalid3.java", + "package pkg3; \n" + + "import mainpkg.Outer.*;\n" + + "//invalid import: expecting warning / error\n" + + "\n" + + "/** \n" + + " * {@link MostInner} -- error/warning \n" + + " * \n" + + " */ \n" + + "public class Invalid3 { \n" + + " void m() { } \n" + + "}\n" }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(true, units, + + String error14 = new String( + //pkg1\Valid1.java:12: warning - Tag @link: reference not found: MostInner + //pkg1\Valid1.java:17: warning - Tag @link: reference not found: MostInner + //pkg2\Valid2.java:12: warning - Tag @link: reference not found: MostInner + //pkg3\Invalid3.java:12: warning - Tag @link: reference not found: MostInner "----------\n" + - "1. WARNING in pkg\\X.java (at line 5)\n" + - " * @see http://www.eclipse.org/\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); -} + "1. ERROR in pkg1\\Valid1.java (at line 6)\n" + + " * {@link MostInner}\n" + + " ^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "2. ERROR in pkg1\\Valid1.java (at line 11)\n" + + " * {@link MostInner} \n" + + " ^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "----------\n" + + "1. ERROR in pkg2\\Valid2.java (at line 6)\n" + + " * {@link MostInner}\n" + + " ^^^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n" + + "----------\n" + + "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + + " * {@link MostInner} -- error/warning \n" + + " ^^^^^^^^^\n" + + "Javadoc: MostInner cannot be resolved to a type\n" + + "----------\n"); -public void testBug168849b() { - String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - " /**\n" + - " * @see http://ftp.eclipse.org/\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + - "}\n" - }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(true, units, + String error50 = new String( + //pkg3\Invalid3.java:12: warning - Tag @link: reference not found: MostInner "----------\n" + - "1. WARNING in pkg\\X.java (at line 5)\n" + - " * @see http://ftp.eclipse.org/\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); + "1. ERROR in pkg3\\Invalid3.java (at line 6)\n" + + " * {@link MostInner} -- error/warning \n" + + " ^^^^^^^^^\n" + + "Javadoc: MostInner cannot be resolved to a type\n" + + "----------\n"); + + this.reportInvalidJavadocVisibility = CompilerOptions.PRIVATE; + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(units,error14); + } + else { + runNegativeTest(units,error50, JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); + } } -public void testBug168849c() { +/** + * @bug 177009: [javadoc] Missing Javadoc tag not reported + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=177009" + */ +public void testBug177009a() { String[] units = new String[] { "pkg/X.java", "package pkg;\n" + "\n" + "public class X {\n" + + " public X(String str, int anInt) {\n" + + " }\n" + + "}\n", + "pkg/Y.java", + "package pkg;\n" + + "\n" + + "public class Y extends X {\n" + + " private static int myInt = 0;\n" + " /**\n" + - " * @see ://\n" + + " * @see X#X(String, int)\n" + // case1 potential AIOOBE " */\n" + - " public void foo() { \n" + - " \n" + + " public Y(String str) {\n" + + " super(str, myInt);\n" + " }\n" + "}\n" }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; + this.reportMissingJavadocTags = CompilerOptions.WARNING; runConformTest( - true, units, + true, + units, "----------\n" + - "1. WARNING in pkg\\X.java (at line 5)\n" + - " * @see ://\n" + - " ^^^\n" + - "Javadoc: Missing reference\n" + + "1. WARNING in pkg\\Y.java (at line 8)\n" + + " public Y(String str) {\n" + + " ^^^\n" + + "Javadoc: Missing tag for parameter str\n" + "----------\n", null, null, JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); } -public void testBug168849d() { +public void testBug177009b() { String[] units = new String[] { "pkg/X.java", "package pkg;\n" + "\n" + "public class X {\n" + + " public X(String str, int anInt) {\n" + + " }\n" + + "}\n", + "pkg/Y.java", + "package pkg;\n" + + "\n" + + "public class Y extends X {\n" + " /**\n" + - " * @see http\u003A\u002F\u002Fwww.eclipse.org\n" + + " * @param str\n" + + " * @param anInt\n" + + " * @see X#X(String, int)\n" + // case2 find super ref " */\n" + - " public void foo() { \n" + - " \n" + + " public Y(String str, int anInt, int anotherInt) {\n" + + " super(str, anInt);\n" + " }\n" + "}\n" }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; + this.reportMissingJavadocTags = CompilerOptions.WARNING; runConformTest(true, units, "----------\n" + - "1. WARNING in pkg\\X.java (at line 5)\n" + - " * @see http://www.eclipse.org\n" + - " ^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Invalid URL reference. Double quote the reference or use the href syntax\n" + + "1. WARNING in pkg\\Y.java (at line 9)\n" + + " public Y(String str, int anInt, int anotherInt) {\n" + + " ^^^^^^^^^^\n" + + "Javadoc: Missing tag for parameter anotherInt\n" + "----------\n", null, null, JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); } - -public void testBug168849e() { - String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - " /**\n" + - " * @see \"http\u003A\u002F\u002Fwww.eclipse.org\"\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + - "}\n" - }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(units); + +/** + * @bug 190970: [javadoc] "field never read locally" analysis should not consider javadoc + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=190970" + */ +public void testBug190970a() { + Map customOptions = getCompilerOptions(); + customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING); + this.runConformTest( + true, + new String[] { + "pkg/X.java", + "public class X {\n" + + "private int unused1;\n" + + "\n" + + "/**\n" + + " * Same value as {@link #unused1}\n" + + " */\n" + + "private int unused2;\n" + + "}\n", + }, + null, + customOptions, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 2)\n" + + " private int unused1;\n" + + " ^^^^^^^\n" + + "The field X.unused1 is never read locally\n" + + "----------\n" + + "2. WARNING in pkg\\X.java (at line 7)\n" + + " private int unused2;\n" + + " ^^^^^^^\n" + + "The field X.unused2 is never read locally\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings + ); +} +// test unused methods +public void testBug190970b() { + Map customOptions = getCompilerOptions(); + customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING); + this.runConformTest( + true, + new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + "private void unused1() {}\n" + + "/**\n" + + " * Same value as {@link #unused1()}\n" + + " */\n" + + "private void unused2() {}\n" + + "}\n", + }, + null, + customOptions, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 4)\n" + + " private void unused1() {}\n" + + " ^^^^^^^^^\n" + + "The method unused1() from the type X is never used locally\n" + + "----------\n" + + "2. WARNING in pkg\\X.java (at line 8)\n" + + " private void unused2() {}\n" + + " ^^^^^^^^^\n" + + "The method unused2() from the type X is never used locally\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings + ); +} +// test unused types +public void testBug190970c() { + Map customOptions = getCompilerOptions(); + customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING); + runConformTest( + true, + new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + "private class unused1 {}\n" + + "/**\n" + + " * {@link X.unused1}\n" + + " */\n" + + "private class unused2 {}\n" + + "}\n", + }, + null, + customOptions, + "----------\n" + + "1. WARNING in pkg\\X.java (at line 4)\n" + + " private class unused1 {}\n" + + " ^^^^^^^\n" + + "The type X.unused1 is never used locally\n" + + "----------\n" + + "2. WARNING in pkg\\X.java (at line 8)\n" + + " private class unused2 {}\n" + + " ^^^^^^^\n" + + "The type X.unused2 is never used locally\n" + + "----------\n", + null, null, + JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings + ); +} + +// static { TESTS_PREFIX = "testBug191322"; } +/** + * @bug 191322: [javadoc] @see or @link reference to method without signature fails to resolve to base class method + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=191322" + */ +public void testBug191322() { + runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " void foo() {}\n" + + " /**\n" + + " * {@link #foo}.\n" + + " * @see #foo\n" + + " */\n" + + " void goo() {}\n" + + "}\n", + "Y.java", + "class Y extends X {\n" + + " /**\n" + + " * {@link #foo}\n" + + " * @see #foo\n" + + " */\n" + + " void hoo() {}\n" + + "}" + } + ); +} +public void testBug191322b() { + runConformTest( + new String[] { + "b/X.java", + "package b;\n" + + "public class X {\n" + + " void foo() {}\n" + + "}\n" + + "class Y extends X {}\n" + + "class W extends Y {}\n" + + "class Z extends W {\n" + + " /**\n" + + " * {@link #foo}\n" + + " * @see #foo\n" + + " */\n" + + " void hoo() {}\n" + + "}\n" + } + ); +} +public void testBug191322c() { + runConformTest( + new String[] { + "c/X.java", + "package c;\n" + + "public interface X {\n" + + " void foo();\n" + + "}\n" + + "interface Y extends X {\n" + + " /**\n" + + " * {@link #foo}\n" + + " * @see #foo\n" + + " */\n" + + " void hoo();\n" + + "}\n" + } + ); +} +public void testBug191322d() { + runConformTest( + new String[] { + "d/X.java", + "package d;\n" + + "public interface X {\n" + + " void foo();\n" + + "}\n" + + "interface Y extends X {}\n" + + "abstract class W implements Y {}\n" + + "abstract class Z extends W {\n" + + " /**\n" + + " * {@link #foo}\n" + + " * @see #foo\n" + + " */\n" + + " void hoo() {}\n" + + "}\n" + } + ); +} +public void testBug191322e() { + runConformTest( + new String[] { + "e/X.java", + "package e;\n" + + "public class X {\n" + + " void foo() {}\n" + + " class Y {\n" + + " /**\n" + + " * {@link #foo}\n" + + " * @see #foo\n" + + " */\n" + + " void hoo() {}\n" + + " }\n" + + "}\n" + } + ); } - -public void testBug168849f() { - String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - " /**\n" + - " * @see \"http://www.eclipse.org/\"\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + - "}\n" - }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(units); +public void testBug191322f() { + runConformTest( + new String[] { + "f/X.java", + "package f;\n" + + "public class X {\n" + + " void foo() {}\n" + + " void foo(String str) {}\n" + + "}\n" + + "class Y extends X {\n" + + " /**\n" + + " * {@link #foo}\n" + + " * @see #foo\n" + + " */\n" + + " void hoo() {}\n" + + "}\n" + } + ); } - -public void testBug168849g() { - String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - " /**\n" + - " * @see http:/ invalid reference\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + - "}\n" - }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(true, units, - "----------\n" + - "1. WARNING in pkg\\X.java (at line 5)\n" + - " * @see http:/ invalid reference\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Malformed reference (missing end space separator)\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); +public void testBug191322g() { + runConformTest( + new String[] { + "g/X.java", + "package g;\n" + + "public class X {\n" + + " void foo(String str) {}\n" + + " void foo(int x) {}\n" + + "}\n" + + "class Y extends X {\n" + + " /**\n" + + " * {@link #foo}\n" + + " * @see #foo\n" + + " */\n" + + " void hoo() {}\n" + + "}\n" + } + ); } - -public void testBug168849h() { - String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - " /**\n" + - " * @see Object:/ invalid reference\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + - "}\n" - }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(true, units, - "----------\n" + - "1. WARNING in pkg\\X.java (at line 5)\n" + - " * @see Object:/ invalid reference\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Malformed reference (missing end space separator)\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); +public void testBug191322h() { + runConformTest( + new String[] { + "h/X.java", + "package h;\n" + + "public class X {\n" + + " void foo(String str) {}\n" + + "}\n" + + "class Y extends X {\n" + + " /**\n" + + " * {@link #foo}\n" + + " * @see #foo\n" + + " */\n" + + " void hoo() {}\n" + + "}\n" + } + ); } - -public void testBug168849i() { - String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + - "public class X {\n" + - " /**\n" + - " * @see http\u003A\u002F invalid reference\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + - "}\n" - }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(true, units, - "----------\n" + - "1. WARNING in pkg\\X.java (at line 5)\n" + - " * @see http:/ invalid reference\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Malformed reference (missing end space separator)\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); +public void testBug191322i() { + runConformTest( + new String[] { + "i/X.java", + "package i;\n" + + "interface X {\n" + + " void foo();\n" + + "}\n" + + "interface Y {\n" + + " void foo(int i);\n" + + "}\n" + + "abstract class Z implements X, Y {\n" + + " /**\n" + + " * @see #foo\n" + + " */\n" + + " void bar() {\n" + + " }\n" + + "}" + } + ); } -public void testBug168849j() { +/** + * @bug 195374: [javadoc] Missing Javadoc warning for required qualification for inner types at 1.4 level + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=195374" + */ +public void testBug195374() { String[] units = new String[] { - "pkg/X.java", - "package pkg;\n" + - "\n" + + "X.java", "public class X {\n" + - " /**\n" + - " * @see Object\u003A\u002F invalid reference\n" + - " */\n" + - " public void foo() { \n" + - " \n" + - " }\n" + + " public static class Param {\n" + + " /**\n" + + " * warning expected when compliance < 1.5 {@link X#setParams(Param[])}\n" + + " * no warning expected {@link X#setParams(X.Param[])}\n" + + " */\n" + + " public int getIndex() {\n" + + " return 0;\n" + + " }\n" + + " }\n" + + " public void setParams(Param[] params) {\n" + + " }\n" + "}\n" }; - this.reportInvalidJavadoc = CompilerOptions.WARNING; - runConformTest(true, units, - "----------\n" + - "1. WARNING in pkg\\X.java (at line 5)\n" + - " * @see Object:/ invalid reference\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Javadoc: Malformed reference (missing end space separator)\n" + - "----------\n", - null, null, - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); + + String error14 = new String( + // warning - Tag @link: can't find setParams(Param[]) in X + "----------\n" + + "1. ERROR in X.java (at line 4)\n" + + " * warning expected when compliance < 1.5 {@link X#setParams(Param[])}\n" + + " ^^^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n"); + this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; + if (this.complianceLevel <= ClassFileConstants.JDK1_4) { + runNegativeTest(units,error14); + } + else { + runConformTest(units); + } } /**