8006228: Doclint doesn't detect <code> {@code nested inline} </code>
authorjjg
Wed, 16 Jan 2013 20:41:14 -0800
changeset 15366 545307ec740c
parent 15365 1f33464bbf46
child 15367 31b57f2b8d0b
8006228: Doclint doesn't detect <code> {@code nested inline} </code> Reviewed-by: darcy
langtools/src/share/classes/com/sun/tools/doclint/Checker.java
langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties
langtools/test/tools/doclint/LiteralTest.java
langtools/test/tools/doclint/LiteralTest.out
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Wed Jan 16 13:22:09 2013 -0800
+++ b/langtools/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/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Wed Jan 16 13:22:09 2013 -0800
+++ b/langtools/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/langtools/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/langtools/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