8006228: Doclint doesn't detect <code> {@code nested inline} </code>

Reviewed-by: darcy
This commit is contained in:
Jonathan Gibbons 2013-01-16 20:41:14 -08:00
parent e942cdde81
commit 7b493a180e
4 changed files with 22 additions and 1 deletions

View File

@ -556,7 +556,7 @@ public class Checker extends DocTreeScanner<Void, Void> {
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;
}
}

View File

@ -48,6 +48,7 @@ dc.no.alt.attr.for.image = no "alt" attribute for image
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}>

View File

@ -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() { }
}

View File

@ -0,0 +1,4 @@
LiteralTest.java:14: warning: {@code} within <code>
/** <code> abc {@code < & > } def </code> */
^
1 warning