8272374: doclint should report missing "body" comments
Reviewed-by: kcr, hannesw
This commit is contained in:
parent
b2c272d4e2
commit
ae45592d33
@ -23,7 +23,7 @@
|
|||||||
# questions.
|
# questions.
|
||||||
#
|
#
|
||||||
|
|
||||||
DOCLINT += -Xdoclint:all/protected,-reference \
|
DOCLINT += -Xdoclint:all/protected,-reference,-missing \
|
||||||
'-Xdoclint/package:java.*,javax.*'
|
'-Xdoclint/package:java.*,javax.*'
|
||||||
COPY += .gif .png .wav .txt .xml .css .pf
|
COPY += .gif .png .wav .txt .xml .css .pf
|
||||||
CLEAN += iio-plugin.properties cursors.properties
|
CLEAN += iio-plugin.properties cursors.properties
|
||||||
|
@ -182,9 +182,6 @@ public class Checker extends DocTreePathScanner<Void, Void> {
|
|||||||
reportMissing("dc.missing.comment");
|
reportMissing("dc.missing.comment");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (tree == null) {
|
if (tree == null) {
|
||||||
if (isDefaultConstructor()) {
|
if (isDefaultConstructor()) {
|
||||||
@ -195,6 +192,17 @@ public class Checker extends DocTreePathScanner<Void, Void> {
|
|||||||
reportMissing("dc.missing.comment");
|
reportMissing("dc.missing.comment");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
} else if (tree.getFirstSentence().isEmpty() && !isOverridingMethod) {
|
||||||
|
if (tree.getBlockTags().isEmpty()) {
|
||||||
|
reportMissing("dc.empty.comment");
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
// Don't report an empty description if the comment contains @deprecated,
|
||||||
|
// because javadoc will use the content of that tag in summary tables.
|
||||||
|
if (tree.getBlockTags().stream().allMatch(t -> t.getKind() != DocTree.Kind.DEPRECATED)) {
|
||||||
|
env.messages.report(MISSING, Kind.WARNING, tree, "dc.empty.description");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ dc.bad.option = bad option: {0}
|
|||||||
dc.bad.value.for.option = bad value for option: {0} {1}
|
dc.bad.value.for.option = bad value for option: {0} {1}
|
||||||
dc.default.constructor = use of default constructor, which does not provide a comment
|
dc.default.constructor = use of default constructor, which does not provide a comment
|
||||||
dc.empty = no description for @{0}
|
dc.empty = no description for @{0}
|
||||||
|
dc.empty.comment = empty comment
|
||||||
|
dc.empty.description = no initial description
|
||||||
dc.entity.invalid = invalid entity &{0};
|
dc.entity.invalid = invalid entity &{0};
|
||||||
dc.exception.not.thrown = exception not thrown: {0}
|
dc.exception.not.thrown = exception not thrown: {0}
|
||||||
dc.exists.param = @param "{0}" has already been specified
|
dc.exists.param = @param "{0}" has already been specified
|
||||||
|
@ -32,7 +32,6 @@ import java.io.File;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -63,25 +62,21 @@ public class DocLintTest {
|
|||||||
|
|
||||||
final String code =
|
final String code =
|
||||||
/* 01 */ "/** Class comment. */\n" +
|
/* 01 */ "/** Class comment. */\n" +
|
||||||
/* 02 */ "public class Test { /** */ Test() { }\n" +
|
/* 02 */ "public class Test { /** Constructor comment. */ Test() { }\n" +
|
||||||
/* 03 */ " /** Method comment. */\n" +
|
/* 03 */ " /** Method comment. */\n" +
|
||||||
/* 04 */ " public void method() { }\n" +
|
/* 04 */ " public void method() { }\n" +
|
||||||
/* 05 */ "\n" +
|
/* 05 */ "\n" +
|
||||||
/* 06 */ " /** Syntax < error. */\n" +
|
/* 06 */ " /** Syntax < error. */\n" +
|
||||||
/* 07 */ """
|
/* 07 */ " private void syntaxError() { }\n" +
|
||||||
\s private void syntaxError() { }
|
|
||||||
""" +
|
|
||||||
/* 08 */ "\n" +
|
/* 08 */ "\n" +
|
||||||
/* 09 */ " /** @see DoesNotExist */\n" +
|
/* 09 */ " /** Description. \n" +
|
||||||
/* 10 */ """
|
/* 10 */ " * @see DoesNotExist */\n" +
|
||||||
\s protected void referenceError() { }
|
/* 11 */ " protected void referenceError() { }\n" +
|
||||||
""" +
|
/* 12 */ "\n" +
|
||||||
/* 11 */ "\n" +
|
/* 13 */ " /** Description. \n" +
|
||||||
/* 12 */ " /** @return */\n" +
|
/* 14 */ " * @return */\n" +
|
||||||
/* 13 */ """
|
/* 15 */ " public int emptyReturn() { return 0; }\n" +
|
||||||
\s public int emptyReturn() { return 0; }
|
/* 16 */ "}\n";
|
||||||
""" +
|
|
||||||
/* 14 */ "}\n";
|
|
||||||
|
|
||||||
final String p1Code =
|
final String p1Code =
|
||||||
/* 01 */ "package p1;\n" +
|
/* 01 */ "package p1;\n" +
|
||||||
@ -103,8 +98,8 @@ public class DocLintTest {
|
|||||||
private enum Message {
|
private enum Message {
|
||||||
// doclint messages
|
// doclint messages
|
||||||
DL_ERR6(ERROR, "Test.java:6:16: compiler.err.proc.messager: malformed HTML"),
|
DL_ERR6(ERROR, "Test.java:6:16: compiler.err.proc.messager: malformed HTML"),
|
||||||
DL_ERR9(ERROR, "Test.java:9:14: compiler.err.proc.messager: reference not found"),
|
DL_ERR10(ERROR, "Test.java:10:13: compiler.err.proc.messager: reference not found"),
|
||||||
DL_WRN12(WARNING, "Test.java:12:9: compiler.warn.proc.messager: no description for @return"),
|
DL_WRN14(WARNING, "Test.java:14:8: compiler.warn.proc.messager: no description for @return"),
|
||||||
|
|
||||||
DL_ERR_P1TEST(ERROR, "P1Test.java:3:16: compiler.err.proc.messager: malformed HTML"),
|
DL_ERR_P1TEST(ERROR, "P1Test.java:3:16: compiler.err.proc.messager: malformed HTML"),
|
||||||
DL_ERR_P2TEST(ERROR, "P2Test.java:3:16: compiler.err.proc.messager: malformed HTML"),
|
DL_ERR_P2TEST(ERROR, "P2Test.java:3:16: compiler.err.proc.messager: malformed HTML"),
|
||||||
@ -112,12 +107,12 @@ public class DocLintTest {
|
|||||||
DL_WARN_P2TEST(WARNING, "P2Test.java:2:8: compiler.warn.proc.messager: no comment"),
|
DL_WARN_P2TEST(WARNING, "P2Test.java:2:8: compiler.warn.proc.messager: no comment"),
|
||||||
|
|
||||||
// doclint messages when -XDrawDiagnostics is not in effect
|
// doclint messages when -XDrawDiagnostics is not in effect
|
||||||
DL_ERR9A(ERROR, "Test.java:9: error: reference not found"),
|
DL_ERR10A(ERROR, "Test.java:10: error: reference not found"),
|
||||||
DL_WRN12A(WARNING, "Test.java:12: warning: no description for @return"),
|
DL_WRN14A(WARNING, "Test.java:14: warning: no description for @return"),
|
||||||
|
|
||||||
// javadoc messages about bad content: these should only appear when doclint is disabled
|
// javadoc messages about bad content: these should only appear when doclint is disabled
|
||||||
JD_WRN10(WARNING, "Test.java:10: warning: Tag @see: reference not found: DoesNotExist"),
|
JD_WRN10(WARNING, "Test.java:10: warning: Tag @see: reference not found: DoesNotExist"),
|
||||||
JD_WRN13(WARNING, "Test.java:13: warning: @return tag has no arguments."),
|
JD_WRN14(WARNING, "Test.java:14: warning: @return tag has no arguments."),
|
||||||
|
|
||||||
// javadoc messages for bad options
|
// javadoc messages for bad options
|
||||||
OPT_BADARG(ERROR, "error: Invalid argument for -Xdoclint option"),
|
OPT_BADARG(ERROR, "error: Invalid argument for -Xdoclint option"),
|
||||||
@ -156,11 +151,11 @@ public class DocLintTest {
|
|||||||
|
|
||||||
test(List.of(htmlVersion),
|
test(List.of(htmlVersion),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
EnumSet.of(Message.DL_ERR9A, Message.DL_WRN12A));
|
EnumSet.of(Message.DL_ERR10A, Message.DL_WRN14A));
|
||||||
|
|
||||||
test(List.of(htmlVersion, rawDiags),
|
test(List.of(htmlVersion, rawDiags),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
EnumSet.of(Message.DL_ERR9, Message.DL_WRN12));
|
EnumSet.of(Message.DL_ERR10, Message.DL_WRN14));
|
||||||
|
|
||||||
// test(List.of("-Xdoclint:none"),
|
// test(List.of("-Xdoclint:none"),
|
||||||
// Main.Result.OK,
|
// Main.Result.OK,
|
||||||
@ -168,7 +163,7 @@ public class DocLintTest {
|
|||||||
|
|
||||||
test(List.of(htmlVersion, rawDiags, "-Xdoclint"),
|
test(List.of(htmlVersion, rawDiags, "-Xdoclint"),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
EnumSet.of(Message.DL_ERR9, Message.DL_WRN12));
|
EnumSet.of(Message.DL_ERR10, Message.DL_WRN14));
|
||||||
|
|
||||||
test(List.of(htmlVersion, rawDiags, "-Xdoclint:all/public"),
|
test(List.of(htmlVersion, rawDiags, "-Xdoclint:all/public"),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
@ -176,23 +171,23 @@ public class DocLintTest {
|
|||||||
|
|
||||||
test(List.of(htmlVersion, rawDiags, "-Xdoclint:all", "-public"),
|
test(List.of(htmlVersion, rawDiags, "-Xdoclint:all", "-public"),
|
||||||
Main.Result.OK,
|
Main.Result.OK,
|
||||||
EnumSet.of(Message.DL_WRN12));
|
EnumSet.of(Message.DL_WRN14));
|
||||||
|
|
||||||
test(List.of(htmlVersion, rawDiags, "-Xdoclint:missing"),
|
test(List.of(htmlVersion, rawDiags, "-Xdoclint:missing"),
|
||||||
Main.Result.OK,
|
Main.Result.OK,
|
||||||
EnumSet.of(Message.DL_WRN12));
|
EnumSet.of(Message.DL_WRN14));
|
||||||
|
|
||||||
test(List.of(htmlVersion, rawDiags, "-private"),
|
test(List.of(htmlVersion, rawDiags, "-private"),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
EnumSet.of(Message.DL_ERR6, Message.DL_ERR9, Message.DL_WRN12));
|
EnumSet.of(Message.DL_ERR6, Message.DL_ERR10, Message.DL_WRN14));
|
||||||
|
|
||||||
test(List.of(htmlVersion, rawDiags, "-Xdoclint:missing,syntax", "-private"),
|
test(List.of(htmlVersion, rawDiags, "-Xdoclint:missing,syntax", "-private"),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));
|
EnumSet.of(Message.DL_ERR6, Message.DL_WRN14));
|
||||||
|
|
||||||
test(List.of(htmlVersion, rawDiags, "-Xdoclint:reference"),
|
test(List.of(htmlVersion, rawDiags, "-Xdoclint:reference"),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
EnumSet.of(Message.DL_ERR9));
|
EnumSet.of(Message.DL_ERR10));
|
||||||
|
|
||||||
test(List.of(htmlVersion, rawDiags, "-Xdoclint:badarg"),
|
test(List.of(htmlVersion, rawDiags, "-Xdoclint:badarg"),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
* @run main DocLintTester -Xmsgs:all,-syntax/private -ref AccessTest.package.out AccessTest.java
|
* @run main DocLintTester -Xmsgs:all,-syntax/private -ref AccessTest.package.out AccessTest.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
public class AccessTest { /** */ AccessTest() { }
|
public class AccessTest { /** . */ AccessTest() { }
|
||||||
/**
|
/**
|
||||||
* public a < b
|
* public a < b
|
||||||
*/
|
*/
|
||||||
@ -41,8 +41,8 @@ public class AccessTest { /** */ AccessTest() { }
|
|||||||
private void private_syntax_error() { }
|
private void private_syntax_error() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** Class comment. */
|
||||||
class AccessTest2 { /** */ AccessTest2() { }
|
class AccessTest2 { /** Constructor comment. */ AccessTest2() { }
|
||||||
/**
|
/**
|
||||||
* public a < b
|
* public a < b
|
||||||
*/
|
*/
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* @author bpatel
|
* @author bpatel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/** .
|
||||||
* @customTag Text for a custom tag.
|
* @customTag Text for a custom tag.
|
||||||
* @custom.tag Text for another custom tag.
|
* @custom.tag Text for another custom tag.
|
||||||
* @unknownTag Text for an unknown tag.
|
* @unknownTag Text for an unknown tag.
|
||||||
|
@ -8,7 +8,10 @@
|
|||||||
* @run main DocLintTester -Xmsgs:missing -ref EmptyAuthorTest.out EmptyAuthorTest.java
|
* @run main DocLintTester -Xmsgs:missing -ref EmptyAuthorTest.out EmptyAuthorTest.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @author */
|
/**
|
||||||
|
* .
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
public class EmptyAuthorTest {
|
public class EmptyAuthorTest {
|
||||||
/** */ EmptyAuthorTest() { }
|
/** . */ EmptyAuthorTest() { }
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
EmptyAuthorTest.java:11: warning: no description for @author
|
EmptyAuthorTest.java:13: warning: no description for @author
|
||||||
/** @author */
|
* @author
|
||||||
^
|
^
|
||||||
1 warning
|
1 warning
|
||||||
|
|
||||||
|
79
test/langtools/tools/doclint/EmptyDescriptionTest.java
Normal file
79
test/langtools/tools/doclint/EmptyDescriptionTest.java
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* @test /nodynamiccopyright/
|
||||||
|
* @bug 8272374
|
||||||
|
* @summary doclint should report missing "body" comments
|
||||||
|
* @modules jdk.javadoc/jdk.javadoc.internal.doclint
|
||||||
|
* @build DocLintTester
|
||||||
|
* @run main DocLintTester -Xmsgs:-missing EmptyDescriptionTest.java
|
||||||
|
* @run main DocLintTester -Xmsgs:missing -ref EmptyDescriptionTest.out EmptyDescriptionTest.java
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** . */
|
||||||
|
public class EmptyDescriptionTest {
|
||||||
|
// a default constructor triggers its own variant of "no comment"
|
||||||
|
|
||||||
|
// no comment
|
||||||
|
public int f1;
|
||||||
|
|
||||||
|
// empty comment
|
||||||
|
/** */
|
||||||
|
public int f2;
|
||||||
|
|
||||||
|
// empty description
|
||||||
|
/**
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public int f3;
|
||||||
|
|
||||||
|
// deprecated: no diagnostic
|
||||||
|
/**
|
||||||
|
* @deprecated do not use
|
||||||
|
*/
|
||||||
|
public int f4;
|
||||||
|
|
||||||
|
// no comment
|
||||||
|
public int m1() { return 0; }
|
||||||
|
|
||||||
|
// empty comment
|
||||||
|
/** */
|
||||||
|
public int m2() { return 0; }
|
||||||
|
|
||||||
|
// empty description
|
||||||
|
/**
|
||||||
|
* @return 0
|
||||||
|
*/
|
||||||
|
public int m3() { return 0; }
|
||||||
|
|
||||||
|
// deprecated: no diagnostic
|
||||||
|
/**
|
||||||
|
* @deprecated do not use
|
||||||
|
* @return 0
|
||||||
|
*/
|
||||||
|
public int m4() { return 0; };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class containing overriding methods.
|
||||||
|
* Overriding methods with missing/empty comments do not generate messages
|
||||||
|
* since they are presumed to inherit descriptions as needed.
|
||||||
|
*/
|
||||||
|
public static class Nested extends EmptyDescriptionTest {
|
||||||
|
/** . */ Nested() { }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int m1() { return 1; }
|
||||||
|
|
||||||
|
// empty comment
|
||||||
|
/** */
|
||||||
|
@Override
|
||||||
|
public int m2() { return 1; }
|
||||||
|
|
||||||
|
// empty description
|
||||||
|
/**
|
||||||
|
* @return 1
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int m3() { return 1; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
22
test/langtools/tools/doclint/EmptyDescriptionTest.out
Normal file
22
test/langtools/tools/doclint/EmptyDescriptionTest.out
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
EmptyDescriptionTest.java:13: warning: use of default constructor, which does not provide a comment
|
||||||
|
public class EmptyDescriptionTest {
|
||||||
|
^
|
||||||
|
EmptyDescriptionTest.java:17: warning: no comment
|
||||||
|
public int f1;
|
||||||
|
^
|
||||||
|
EmptyDescriptionTest.java:21: warning: empty comment
|
||||||
|
public int f2;
|
||||||
|
^
|
||||||
|
EmptyDescriptionTest.java:25: warning: no initial description
|
||||||
|
* @since 1.0
|
||||||
|
^
|
||||||
|
EmptyDescriptionTest.java:36: warning: no comment
|
||||||
|
public int m1() { return 0; }
|
||||||
|
^
|
||||||
|
EmptyDescriptionTest.java:40: warning: empty comment
|
||||||
|
public int m2() { return 0; }
|
||||||
|
^
|
||||||
|
EmptyDescriptionTest.java:44: warning: no initial description
|
||||||
|
* @return 0
|
||||||
|
^
|
||||||
|
7 warnings
|
@ -9,7 +9,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** . */
|
/** . */
|
||||||
public class EmptyExceptionTest { /** */ EmptyExceptionTest() { }
|
public class EmptyExceptionTest { /** . */ EmptyExceptionTest() { }
|
||||||
/** @exception NullPointerException */
|
/**
|
||||||
|
* .
|
||||||
|
* @exception NullPointerException
|
||||||
|
*/
|
||||||
void emptyException() throws NullPointerException { }
|
void emptyException() throws NullPointerException { }
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
EmptyExceptionTest.java:13: warning: no description for @exception
|
EmptyExceptionTest.java:15: warning: no description for @exception
|
||||||
/** @exception NullPointerException */
|
* @exception NullPointerException
|
||||||
^
|
^
|
||||||
1 warning
|
1 warning
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
|
|
||||||
/** . */
|
/** . */
|
||||||
public class EmptyParamTest { /** . */ EmptyParamTest() { }
|
public class EmptyParamTest { /** . */ EmptyParamTest() { }
|
||||||
/** @param i */
|
/**
|
||||||
|
* .
|
||||||
|
* @param i
|
||||||
|
*/
|
||||||
void emptyParam(int i) { }
|
void emptyParam(int i) { }
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
EmptyParamTest.java:13: warning: no description for @param
|
EmptyParamTest.java:15: warning: no description for @param
|
||||||
/** @param i */
|
* @param i
|
||||||
^
|
^
|
||||||
1 warning
|
1 warning
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
|
|
||||||
/** . */
|
/** . */
|
||||||
public class EmptyReturnTest { /** . */ EmptyReturnTest() { }
|
public class EmptyReturnTest { /** . */ EmptyReturnTest() { }
|
||||||
/** @return */
|
/**
|
||||||
|
* .
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
int emptyReturn() { return 0; }
|
int emptyReturn() { return 0; }
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
EmptyReturnTest.java:13: warning: no description for @return
|
EmptyReturnTest.java:15: warning: no description for @return
|
||||||
/** @return */
|
* @return
|
||||||
^
|
^
|
||||||
1 warning
|
1 warning
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import java.io.Serializable;
|
|||||||
public class EmptySerialFieldTest implements Serializable { /** . */ EmptySerialFieldTest() { }
|
public class EmptySerialFieldTest implements Serializable { /** . */ EmptySerialFieldTest() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @serialField empty String
|
* @serialField empty String
|
||||||
*/
|
*/
|
||||||
private static final ObjectStreamField[] serialPersistentFields = {
|
private static final ObjectStreamField[] serialPersistentFields = {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
EmptySerialFieldTest.java:18: warning: no description for @serialField
|
EmptySerialFieldTest.java:19: warning: no description for @serialField
|
||||||
* @serialField empty String
|
* @serialField empty String
|
||||||
^
|
^
|
||||||
1 warning
|
1 warning
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
|
|
||||||
/** . */
|
/** . */
|
||||||
public class EmptySinceTest { /** . */ EmptySinceTest() { }
|
public class EmptySinceTest { /** . */ EmptySinceTest() { }
|
||||||
/** @since */
|
/**
|
||||||
|
* .
|
||||||
|
* @since
|
||||||
|
*/
|
||||||
void emptySince() { }
|
void emptySince() { }
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
EmptySinceTest.java:13: warning: no description for @since
|
EmptySinceTest.java:15: warning: no description for @since
|
||||||
/** @since */
|
* @since
|
||||||
^
|
^
|
||||||
1 warning
|
1 warning
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
|
|
||||||
/** . */
|
/** . */
|
||||||
public class EmptyVersionTest { /** . */ EmptyVersionTest() { }
|
public class EmptyVersionTest { /** . */ EmptyVersionTest() { }
|
||||||
/** @version */
|
/**
|
||||||
|
* .
|
||||||
|
* @version
|
||||||
|
*/
|
||||||
void missingVersion() { }
|
void missingVersion() { }
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
EmptyVersionTest.java:13: warning: no description for @version
|
EmptyVersionTest.java:15: warning: no description for @version
|
||||||
/** @version */
|
* @version
|
||||||
^
|
^
|
||||||
1 warning
|
1 warning
|
||||||
|
@ -9,13 +9,17 @@
|
|||||||
* @author jlahoda
|
* @author jlahoda
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**@deprecated*/
|
/**
|
||||||
|
* .
|
||||||
|
* @deprecated*/
|
||||||
public class EndWithIdentifierTest {
|
public class EndWithIdentifierTest {
|
||||||
|
|
||||||
/**{@link*/
|
/**{@link*/
|
||||||
private void unfinishedInlineTagName() {}
|
private void unfinishedInlineTagName() {}
|
||||||
|
|
||||||
/**@see List*/
|
/**
|
||||||
|
* .
|
||||||
|
* @see List*/
|
||||||
private void endsWithIdentifier() {}
|
private void endsWithIdentifier() {}
|
||||||
|
|
||||||
/**&*/
|
/**&*/
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
EndWithIdentifierTest.java:15: error: syntax error in reference
|
EndWithIdentifierTest.java:17: error: syntax error in reference
|
||||||
/**{@link*/
|
/**{@link*/
|
||||||
^
|
^
|
||||||
EndWithIdentifierTest.java:18: error: reference not found
|
EndWithIdentifierTest.java:22: error: reference not found
|
||||||
/**@see List*/
|
* @see List*/
|
||||||
^
|
^
|
||||||
EndWithIdentifierTest.java:21: error: semicolon missing
|
EndWithIdentifierTest.java:25: error: semicolon missing
|
||||||
/**&*/
|
/**&*/
|
||||||
^
|
^
|
||||||
EndWithIdentifierTest.java:24: error: malformed HTML
|
EndWithIdentifierTest.java:28: error: malformed HTML
|
||||||
/**<a*/
|
/**<a*/
|
||||||
^
|
^
|
||||||
EndWithIdentifierTest.java:27: error: malformed HTML
|
EndWithIdentifierTest.java:31: error: malformed HTML
|
||||||
/**</a*/
|
/**</a*/
|
||||||
^
|
^
|
||||||
EndWithIdentifierTest.java:30: error: malformed HTML
|
EndWithIdentifierTest.java:34: error: malformed HTML
|
||||||
/**<a name*/
|
/**<a name*/
|
||||||
^
|
^
|
||||||
6 errors
|
6 errors
|
||||||
|
@ -41,7 +41,7 @@ import java.util.function.Function;
|
|||||||
*/
|
*/
|
||||||
public final class LambdaTest
|
public final class LambdaTest
|
||||||
{
|
{
|
||||||
/** */ LambdaTest() { }
|
/** . */ LambdaTest() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The field itself has docs.
|
* The field itself has docs.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* @run main DocLintTester -ref LiteralTest.out LiteralTest.java
|
* @run main DocLintTester -ref LiteralTest.out LiteralTest.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
public class LiteralTest {
|
public class LiteralTest {
|
||||||
/** <code> abc {@literal < & > } def </code> */
|
/** <code> abc {@literal < & > } def </code> */
|
||||||
public void ok_literal_in_code() { }
|
public void ok_literal_in_code() { }
|
||||||
@ -15,6 +15,6 @@ public class LiteralTest {
|
|||||||
/** <code> abc {@code < & > } def </code> */
|
/** <code> abc {@code < & > } def </code> */
|
||||||
public void bad_code_in_code() { }
|
public void bad_code_in_code() { }
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
LiteralTest() { }
|
LiteralTest() { }
|
||||||
}
|
}
|
||||||
|
@ -10,15 +10,15 @@
|
|||||||
|
|
||||||
/** . */
|
/** . */
|
||||||
public class MissingParamsTest {
|
public class MissingParamsTest {
|
||||||
/** */
|
/** . */
|
||||||
MissingParamsTest(int param) { }
|
MissingParamsTest(int param) { }
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
<T> MissingParamsTest() { }
|
<T> MissingParamsTest() { }
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
void missingParam(int param) { }
|
void missingParam(int param) { }
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
<T> void missingTyparam() { }
|
<T> void missingTyparam() { }
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,6 @@ public class MissingReturnTest {
|
|||||||
/** no return required */
|
/** no return required */
|
||||||
Void return_Void() { }
|
Void return_Void() { }
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
int missingReturn() { }
|
int missingReturn() { }
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
* @run main DocLintTester -Xmsgs:missing -ref MissingThrowsTest.out MissingThrowsTest.java
|
* @run main DocLintTester -Xmsgs:missing -ref MissingThrowsTest.out MissingThrowsTest.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
public class MissingThrowsTest {
|
public class MissingThrowsTest {
|
||||||
/** */
|
/** . */
|
||||||
void missingThrows() throws Exception { }
|
void missingThrows() throws Exception { }
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
MissingThrowsTest() { }
|
MissingThrowsTest() { }
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,12 @@
|
|||||||
|
|
||||||
/** <html> */
|
/** <html> */
|
||||||
public class MultipleDocLintOptionsTest {
|
public class MultipleDocLintOptionsTest {
|
||||||
/** @return */
|
/**
|
||||||
|
* .
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
int emptyReturn() { return -1; }
|
int emptyReturn() { return -1; }
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
MultipleDocLintOptionsTest() { }
|
MultipleDocLintOptionsTest() { }
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
MultipleDocLintOptionsTest.java:8:5: compiler.err.proc.messager: element not allowed in documentation comments: <html>
|
MultipleDocLintOptionsTest.java:8:5: compiler.err.proc.messager: element not allowed in documentation comments: <html>
|
||||||
MultipleDocLintOptionsTest.java:8:5: compiler.err.proc.messager: element not closed: html
|
MultipleDocLintOptionsTest.java:8:5: compiler.err.proc.messager: element not closed: html
|
||||||
MultipleDocLintOptionsTest.java:10:9: compiler.warn.proc.messager: no description for @return
|
MultipleDocLintOptionsTest.java:12:8: compiler.warn.proc.messager: no description for @return
|
||||||
2 errors
|
2 errors
|
||||||
1 warning
|
1 warning
|
||||||
|
@ -8,49 +8,58 @@
|
|||||||
* @run main DocLintTester -ref ReferenceTest.out ReferenceTest.java
|
* @run main DocLintTester -ref ReferenceTest.out ReferenceTest.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
public class ReferenceTest {
|
public class ReferenceTest {
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @param x description
|
* @param x description
|
||||||
*/
|
*/
|
||||||
public int invalid_param;
|
public int invalid_param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @param x description
|
* @param x description
|
||||||
*/
|
*/
|
||||||
public class InvalidParam { /** . */ private InvalidParam() { } }
|
public class InvalidParam { /** . */ private InvalidParam() { } }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @param x description
|
* @param x description
|
||||||
*/
|
*/
|
||||||
public void param_name_not_found(int a) { }
|
public void param_name_not_found(int a) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @param <X> description
|
* @param <X> description
|
||||||
*/
|
*/
|
||||||
public class typaram_name_not_found { /** . */ private typaram_name_not_found() { } }
|
public class typaram_name_not_found { /** . */ private typaram_name_not_found() { } }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @see Object#tooStrong()
|
* @see Object#tooStrong()
|
||||||
*/
|
*/
|
||||||
public void ref_not_found() { }
|
public void ref_not_found() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @return x description
|
* @return x description
|
||||||
*/
|
*/
|
||||||
public int invalid_return;
|
public int invalid_return;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @return x description
|
* @return x description
|
||||||
*/
|
*/
|
||||||
public void invalid_return();
|
public void invalid_return();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @throws Exception description
|
* @throws Exception description
|
||||||
*/
|
*/
|
||||||
public void exception_not_thrown() { }
|
public void exception_not_thrown() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @param <T> throwable
|
* @param <T> throwable
|
||||||
* @throws T description
|
* @throws T description
|
||||||
*/
|
*/
|
||||||
|
@ -1,40 +1,40 @@
|
|||||||
ReferenceTest.java:14: error: invalid use of @param
|
ReferenceTest.java:15: error: invalid use of @param
|
||||||
* @param x description
|
* @param x description
|
||||||
^
|
^
|
||||||
ReferenceTest.java:19: error: invalid use of @param
|
ReferenceTest.java:21: error: invalid use of @param
|
||||||
* @param x description
|
* @param x description
|
||||||
^
|
^
|
||||||
ReferenceTest.java:24: error: @param name not found
|
ReferenceTest.java:27: error: @param name not found
|
||||||
* @param x description
|
* @param x description
|
||||||
^
|
^
|
||||||
ReferenceTest.java:26: warning: no @param for a
|
ReferenceTest.java:29: warning: no @param for a
|
||||||
public void param_name_not_found(int a) { }
|
public void param_name_not_found(int a) { }
|
||||||
^
|
^
|
||||||
ReferenceTest.java:29: error: @param name not found
|
ReferenceTest.java:33: error: @param name not found
|
||||||
* @param <X> description
|
* @param <X> description
|
||||||
^
|
^
|
||||||
ReferenceTest.java:34: error: reference not found
|
ReferenceTest.java:39: error: reference not found
|
||||||
* @see Object#tooStrong()
|
* @see Object#tooStrong()
|
||||||
^
|
^
|
||||||
ReferenceTest.java:39: error: invalid use of @return
|
ReferenceTest.java:45: error: invalid use of @return
|
||||||
* @return x description
|
* @return x description
|
||||||
^
|
^
|
||||||
ReferenceTest.java:44: error: invalid use of @return
|
ReferenceTest.java:51: error: invalid use of @return
|
||||||
* @return x description
|
* @return x description
|
||||||
^
|
^
|
||||||
ReferenceTest.java:49: error: exception not thrown: java.lang.Exception
|
ReferenceTest.java:57: error: exception not thrown: java.lang.Exception
|
||||||
* @throws Exception description
|
* @throws Exception description
|
||||||
^
|
^
|
||||||
ReferenceTest.java:62: error: reference not found
|
ReferenceTest.java:71: error: reference not found
|
||||||
* {@link not.Found<String>}
|
* {@link not.Found<String>}
|
||||||
^
|
^
|
||||||
ReferenceTest.java:65: error: reference not found
|
ReferenceTest.java:74: error: reference not found
|
||||||
* @see not.Found<String>
|
* @see not.Found<String>
|
||||||
^
|
^
|
||||||
ReferenceTest.java:72: error: reference not found
|
ReferenceTest.java:81: error: reference not found
|
||||||
* {@link not.Found[]}
|
* {@link not.Found[]}
|
||||||
^
|
^
|
||||||
ReferenceTest.java:75: error: reference not found
|
ReferenceTest.java:84: error: reference not found
|
||||||
* @see not.Found[]
|
* @see not.Found[]
|
||||||
^
|
^
|
||||||
12 errors
|
12 errors
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
* @run main DocLintTester -ref SyntaxTest.out SyntaxTest.java
|
* @run main DocLintTester -ref SyntaxTest.out SyntaxTest.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
public class SyntaxTest {
|
public class SyntaxTest {
|
||||||
/**
|
/**
|
||||||
* a < b
|
* a < b
|
||||||
*/
|
*/
|
||||||
public void syntax_error() { }
|
public void syntax_error() { }
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
private SyntaxTest() { }
|
private SyntaxTest() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
/** Unexpected comment */
|
/** Unexpected comment */
|
||||||
package bad;
|
package bad;
|
||||||
|
|
||||||
/** */
|
/** . */
|
||||||
class Test {
|
class Test {
|
||||||
/** */ Test() { }
|
/** . */ Test() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,5 +18,5 @@ public class StatsTest {
|
|||||||
/** 4 undocumented signature items */
|
/** 4 undocumented signature items */
|
||||||
public int warnings(int a1, int a2) throws Exception { return 0; }
|
public int warnings(int a1, int a2) throws Exception { return 0; }
|
||||||
|
|
||||||
/** */ StatsTest() { }
|
/** . */ StatsTest() { }
|
||||||
}
|
}
|
||||||
|
@ -62,27 +62,29 @@ public class DocLintTest {
|
|||||||
JavaFileObject file;
|
JavaFileObject file;
|
||||||
|
|
||||||
final String code =
|
final String code =
|
||||||
/* 01 */ "/** Class comment. */\n" +
|
/* 01 */ "/** Class comment. */\n" +
|
||||||
/* 02 */ "public class Test { /** */ Test() { }\n" +
|
/* 02 */ "public class Test { /** Constructor comment. */ Test() { }\n" +
|
||||||
/* 03 */ " /** Method comment. */\n" +
|
/* 03 */ " /** Method comment. */\n" +
|
||||||
/* 04 */ " public void method() { }\n" +
|
/* 04 */ " public void method() { }\n" +
|
||||||
/* 05 */ "\n" +
|
/* 05 */ "\n" +
|
||||||
/* 06 */ " /** Syntax < error. */\n" +
|
/* 06 */ " /** Syntax < error. */\n" +
|
||||||
/* 07 */ " private void syntaxError() { }\n" +
|
/* 07 */ " private void syntaxError() { }\n" +
|
||||||
/* 08 */ "\n" +
|
/* 08 */ "\n" +
|
||||||
/* 09 */ " /** @see DoesNotExist */\n" +
|
/* 09 */ " /** Description. \n" +
|
||||||
/* 10 */ " protected void referenceError() { }\n" +
|
/* 10 */ " * @see DoesNotExist */\n" +
|
||||||
/* 08 */ "\n" +
|
/* 11 */ " protected void referenceError() { }\n" +
|
||||||
/* 09 */ " /** @return */\n" +
|
/* 12 */ "\n" +
|
||||||
/* 10 */ " public int emptyReturn() { return 0; }\n" +
|
/* 13 */ " /** Description. \n" +
|
||||||
/* 11 */ "}\n";
|
/* 14 */ " * @return */\n" +
|
||||||
|
/* 15 */ " public int emptyReturn() { return 0; }\n" +
|
||||||
|
/* 16 */ "}\n";
|
||||||
|
|
||||||
final String rawDiags = "-XDrawDiagnostics";
|
final String rawDiags = "-XDrawDiagnostics";
|
||||||
private enum Message {
|
private enum Message {
|
||||||
// doclint messages
|
// doclint messages
|
||||||
DL_ERR6(ERROR, "Test.java:6:16: compiler.err.proc.messager: malformed HTML"),
|
DL_ERR6(ERROR, "Test.java:6:16: compiler.err.proc.messager: malformed HTML"),
|
||||||
DL_ERR9(ERROR, "Test.java:9:14: compiler.err.proc.messager: reference not found"),
|
DL_ERR10(ERROR, "Test.java:10:13: compiler.err.proc.messager: reference not found"),
|
||||||
DL_WRN12(WARNING, "Test.java:12:9: compiler.warn.proc.messager: no description for @return"),
|
DL_WRN14(WARNING, "Test.java:14:8: compiler.warn.proc.messager: no description for @return"),
|
||||||
|
|
||||||
OPT_BADARG(ERROR, "error: invalid flag: -Xdoclint:badarg");
|
OPT_BADARG(ERROR, "error: invalid flag: -Xdoclint:badarg");
|
||||||
|
|
||||||
@ -129,19 +131,19 @@ public class DocLintTest {
|
|||||||
|
|
||||||
test(Arrays.asList(rawDiags, "-Xdoclint"),
|
test(Arrays.asList(rawDiags, "-Xdoclint"),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
EnumSet.of(Message.DL_ERR6, Message.DL_ERR9, Message.DL_WRN12));
|
EnumSet.of(Message.DL_ERR6, Message.DL_ERR10, Message.DL_WRN14));
|
||||||
|
|
||||||
test(Arrays.asList(rawDiags, "-Xdoclint:all/public"),
|
test(Arrays.asList(rawDiags, "-Xdoclint:all/public"),
|
||||||
Main.Result.OK,
|
Main.Result.OK,
|
||||||
EnumSet.of(Message.DL_WRN12));
|
EnumSet.of(Message.DL_WRN14));
|
||||||
|
|
||||||
test(Arrays.asList(rawDiags, "-Xdoclint:syntax,missing"),
|
test(Arrays.asList(rawDiags, "-Xdoclint:syntax,missing"),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));
|
EnumSet.of(Message.DL_ERR6, Message.DL_WRN14));
|
||||||
|
|
||||||
test(Arrays.asList(rawDiags, "-Xdoclint:reference"),
|
test(Arrays.asList(rawDiags, "-Xdoclint:reference"),
|
||||||
Main.Result.ERROR,
|
Main.Result.ERROR,
|
||||||
EnumSet.of(Message.DL_ERR9));
|
EnumSet.of(Message.DL_ERR10));
|
||||||
|
|
||||||
test(Arrays.asList(rawDiags, "-Xdoclint:badarg"),
|
test(Arrays.asList(rawDiags, "-Xdoclint:badarg"),
|
||||||
Main.Result.CMDERR,
|
Main.Result.CMDERR,
|
||||||
|
Loading…
Reference in New Issue
Block a user