changeset 1501:916143318f10

8006228: Doclint doesn't detect <code> {@code nested inline} </code> Reviewed-by: darcy
author jjg
date Wed, 16 Jan 2013 20:41:14 -0800
parents 8b749558767b
children 2d2b2be57c78
files src/share/classes/com/sun/tools/doclint/Checker.java src/share/classes/com/sun/tools/doclint/resources/doclint.properties test/tools/doclint/LiteralTest.java test/tools/doclint/LiteralTest.out
diffstat 4 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/doclint/Checker.java	Wed Jan 16 13:22:09 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclint/Checker.java	Wed Jan 16 20:41:14 2013 -0800
@@ -556,7 +556,7 @@
         if (tree.getKind() == DocTree.Kind.CODE) {
             for (TagStackItem tsi: tagStack) {
                 if (tsi.tag == HtmlTag.CODE) {
-                    env.messages.warning(HTML, tree, "dc.tag.nested.not.allowed", "code");
+                    env.messages.warning(HTML, tree, "dc.tag.code.within.code");
                     break;
                 }
             }
--- a/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Wed Jan 16 13:22:09 2013 -0800
+++ b/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Wed Jan 16 20:41:14 2013 -0800
@@ -48,6 +48,7 @@
 dc.no.summary.or.caption.for.table=no summary or caption for table
 dc.param.name.not.found = @param name not found
 dc.ref.not.found = reference not found
+dc.tag.code.within.code = '{@code'} within <code>
 dc.tag.empty = empty <{0}> tag
 dc.tag.end.not.permitted = invalid end tag: </{0}>
 dc.tag.end.unexpected = unexpected end tag: </{0}>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/LiteralTest.java	Wed Jan 16 20:41:14 2013 -0800
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006228
+ * @summary Doclint doesn't detect <code> {@code nested inline} </code>
+ * @build DocLintTester
+ * @run main DocLintTester -ref LiteralTest.out LiteralTest.java
+ */
+
+/** */
+public class LiteralTest {
+    /** <code> abc {@literal < & > } def </code> */
+    public void ok_literal_in_code() { }
+
+    /** <code> abc {@code < & > } def </code> */
+    public void bad_code_in_code() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/LiteralTest.out	Wed Jan 16 20:41:14 2013 -0800
@@ -0,0 +1,4 @@
+LiteralTest.java:14: warning: {@code} within <code>
+    /** <code> abc {@code < & > } def </code> */
+                   ^
+1 warning