changeset 2471:3ae62331a56f

8002154: [doclint] doclint should check for issues which are errors in javadoc Reviewed-by: bpatel
author jjg
date Tue, 24 Sep 2013 13:48:12 -0700
parents 6a05a713450d
children 184c0d6698c3 daa3bfb82e58
files src/share/classes/com/sun/tools/doclint/Checker.java src/share/classes/com/sun/tools/doclint/resources/doclint.properties test/tools/doclint/ReferenceTest.java test/tools/doclint/ReferenceTest.out
diffstat 4 files changed, 27 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/doclint/Checker.java	Tue Sep 24 11:46:25 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclint/Checker.java	Tue Sep 24 13:48:12 2013 -0700
@@ -730,6 +730,10 @@
 
     @Override
     public Void visitReference(ReferenceTree tree, Void ignore) {
+        String sig = tree.getSignature();
+        if (sig.contains("<") || sig.contains(">"))
+            env.messages.error(REFERENCE, tree, "dc.type.arg.not.allowed");
+
         Element e = env.trees.getElement(getCurrentPath());
         if (e == null)
             env.messages.error(REFERENCE, tree, "dc.ref.not.found");
--- a/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Tue Sep 24 11:46:25 2013 -0700
+++ b/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Tue Sep 24 13:48:12 2013 -0700
@@ -67,6 +67,7 @@
 dc.tag.start.unmatched = end tag missing: </{0}>
 dc.tag.unknown = unknown tag: {0}
 dc.text.not.allowed = text not allowed in <{0}> element
+dc.type.arg.not.allowed = type arguments not allowed here
 dc.unexpected.comment=documentation comment not expected here
 dc.value.not.allowed.here='{@value}' not allowed here
 dc.value.not.a.constant=value does not refer to a constant
--- a/test/tools/doclint/ReferenceTest.java	Tue Sep 24 11:46:25 2013 -0700
+++ b/test/tools/doclint/ReferenceTest.java	Tue Sep 24 13:48:12 2013 -0700
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832 8020556
+ * @bug 8004832 8020556 8002154
  * @summary Add new doclint package
  * @build DocLintTester
  * @run main DocLintTester -Xmsgs:-reference ReferenceTest.java
@@ -54,5 +54,13 @@
      * @throws T description
      */
     public <T extends Throwable> void valid_throws_generic() throws T { }
+
+    /**
+     * {@link java.util.List<String>}
+     * {@link java.util.List<String>#equals}
+     * @see java.util.List<String>
+     * @see java.util.List<String>#equals
+     */
+    public void invalid_type_args() { }
 }
 
--- a/test/tools/doclint/ReferenceTest.out	Tue Sep 24 11:46:25 2013 -0700
+++ b/test/tools/doclint/ReferenceTest.out	Tue Sep 24 13:48:12 2013 -0700
@@ -25,6 +25,18 @@
 ReferenceTest.java:48: error: exception not thrown: java.lang.Exception
      * @throws Exception description
                ^
-8 errors
+ReferenceTest.java:59: error: type arguments not allowed here
+     * {@link java.util.List<String>}
+              ^
+ReferenceTest.java:60: error: type arguments not allowed here
+     * {@link java.util.List<String>#equals}
+              ^
+ReferenceTest.java:61: error: type arguments not allowed here
+     * @see java.util.List<String>
+            ^
+ReferenceTest.java:62: error: type arguments not allowed here
+     * @see java.util.List<String>#equals
+            ^
+12 errors
 1 warning