Tue, 24 Sep 2013 13:48:12 -0700
8002154: [doclint] doclint should check for issues which are errors in javadoc
Reviewed-by: bpatel
1.1 --- a/src/share/classes/com/sun/tools/doclint/Checker.java Tue Sep 24 11:46:25 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclint/Checker.java Tue Sep 24 13:48:12 2013 -0700 1.3 @@ -730,6 +730,10 @@ 1.4 1.5 @Override 1.6 public Void visitReference(ReferenceTree tree, Void ignore) { 1.7 + String sig = tree.getSignature(); 1.8 + if (sig.contains("<") || sig.contains(">")) 1.9 + env.messages.error(REFERENCE, tree, "dc.type.arg.not.allowed"); 1.10 + 1.11 Element e = env.trees.getElement(getCurrentPath()); 1.12 if (e == null) 1.13 env.messages.error(REFERENCE, tree, "dc.ref.not.found");
2.1 --- a/src/share/classes/com/sun/tools/doclint/resources/doclint.properties Tue Sep 24 11:46:25 2013 -0700 2.2 +++ b/src/share/classes/com/sun/tools/doclint/resources/doclint.properties Tue Sep 24 13:48:12 2013 -0700 2.3 @@ -67,6 +67,7 @@ 2.4 dc.tag.start.unmatched = end tag missing: </{0}> 2.5 dc.tag.unknown = unknown tag: {0} 2.6 dc.text.not.allowed = text not allowed in <{0}> element 2.7 +dc.type.arg.not.allowed = type arguments not allowed here 2.8 dc.unexpected.comment=documentation comment not expected here 2.9 dc.value.not.allowed.here='{@value}' not allowed here 2.10 dc.value.not.a.constant=value does not refer to a constant
3.1 --- a/test/tools/doclint/ReferenceTest.java Tue Sep 24 11:46:25 2013 -0700 3.2 +++ b/test/tools/doclint/ReferenceTest.java Tue Sep 24 13:48:12 2013 -0700 3.3 @@ -1,6 +1,6 @@ 3.4 /* 3.5 * @test /nodynamiccopyright/ 3.6 - * @bug 8004832 8020556 3.7 + * @bug 8004832 8020556 8002154 3.8 * @summary Add new doclint package 3.9 * @build DocLintTester 3.10 * @run main DocLintTester -Xmsgs:-reference ReferenceTest.java 3.11 @@ -54,5 +54,13 @@ 3.12 * @throws T description 3.13 */ 3.14 public <T extends Throwable> void valid_throws_generic() throws T { } 3.15 + 3.16 + /** 3.17 + * {@link java.util.List<String>} 3.18 + * {@link java.util.List<String>#equals} 3.19 + * @see java.util.List<String> 3.20 + * @see java.util.List<String>#equals 3.21 + */ 3.22 + public void invalid_type_args() { } 3.23 } 3.24
4.1 --- a/test/tools/doclint/ReferenceTest.out Tue Sep 24 11:46:25 2013 -0700 4.2 +++ b/test/tools/doclint/ReferenceTest.out Tue Sep 24 13:48:12 2013 -0700 4.3 @@ -25,6 +25,18 @@ 4.4 ReferenceTest.java:48: error: exception not thrown: java.lang.Exception 4.5 * @throws Exception description 4.6 ^ 4.7 -8 errors 4.8 +ReferenceTest.java:59: error: type arguments not allowed here 4.9 + * {@link java.util.List<String>} 4.10 + ^ 4.11 +ReferenceTest.java:60: error: type arguments not allowed here 4.12 + * {@link java.util.List<String>#equals} 4.13 + ^ 4.14 +ReferenceTest.java:61: error: type arguments not allowed here 4.15 + * @see java.util.List<String> 4.16 + ^ 4.17 +ReferenceTest.java:62: error: type arguments not allowed here 4.18 + * @see java.util.List<String>#equals 4.19 + ^ 4.20 +12 errors 4.21 1 warning 4.22