# HG changeset patch # User jjg # Date 1358791657 28800 # Node ID 8f719dc43e1fd91624fa9904cdc365a28b6228d0 # Parent c1c9a9e11b26183dc76a341805268b361a7914e0 8006251: doclint: incorrect position for diagnostic for illegal text in tags Reviewed-by: mcimadamore diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/src/share/classes/com/sun/tools/doclint/Checker.java --- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java Mon Jan 21 10:00:46 2013 -0800 +++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java Mon Jan 21 10:07:37 2013 -0800 @@ -95,7 +95,8 @@ public enum Flag { TABLE_HAS_CAPTION, HAS_ELEMENT, - HAS_TEXT + HAS_TEXT, + REPORTED_BAD_INLINE } static class TagStackItem { @@ -195,7 +196,8 @@ @Override public Void visitText(TextTree tree, Void ignore) { - if (!tree.getBody().trim().isEmpty()) { + if (hasNonWhitespace(tree)) { + checkAllowsText(tree); markEnclosingTag(Flag.HAS_TEXT); } return null; @@ -203,6 +205,7 @@ @Override public Void visitEntity(EntityTree tree, Void ignore) { + checkAllowsText(tree); markEnclosingTag(Flag.HAS_TEXT); String name = tree.getName().toString(); if (name.startsWith("#")) { @@ -218,6 +221,18 @@ return null; } + void checkAllowsText(DocTree tree) { + TagStackItem top = tagStack.peek(); + if (top != null + && top.tree.getKind() == DocTree.Kind.START_ELEMENT + && !top.tag.acceptsText()) { + if (top.flags.add(Flag.REPORTED_BAD_INLINE)) { + env.messages.error(HTML, tree, "dc.text.not.allowed", + ((StartElementTree) top.tree).getName()); + } + } + } + // // @@ -230,53 +245,22 @@ if (t == null) { env.messages.error(HTML, tree, "dc.tag.unknown", treeName); } else { + for (TagStackItem tsi: tagStack) { + if (tsi.tag.accepts(t)) { + while (tagStack.peek() != tsi) tagStack.pop(); + break; + } else if (tsi.tag.endKind != HtmlTag.EndKind.OPTIONAL) + break; + } + + checkStructure(tree, t); + // tag specific checks switch (t) { // check for out of sequence headers, such as

...

...

case H1: case H2: case H3: case H4: case H5: case H6: checkHeader(tree, t); break; - //

inside

-                case P:
-                    TagStackItem top = tagStack.peek();
-                    if (top != null && top.tag == HtmlTag.PRE)
-                        env.messages.warning(HTML, tree, "dc.tag.p.in.pre");
-                    break;
-            }
-
-            // check that only block tags and inline tags are used,
-            // and that blocks tags are not used within inline tags
-            switch (t.blockType) {
-                case INLINE:
-                    break;
-                case BLOCK:
-                    TagStackItem top = tagStack.peek();
-                    if (top != null && top.tag != null && top.tag.blockType == HtmlTag.BlockType.INLINE) {
-                        switch (top.tree.getKind()) {
-                            case START_ELEMENT: {
-                                Name name = ((StartElementTree) top.tree).getName();
-                                env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.element",
-                                        treeName, name);
-                                break;
-                            }
-                            case LINK:
-                            case LINK_PLAIN: {
-                                String name = top.tree.getKind().tagName;
-                                env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.tag",
-                                        treeName, name);
-                                break;
-                            }
-                            default:
-                                env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.other",
-                                        treeName);
-                        }
-                    }
-                    break;
-                case OTHER:
-                    env.messages.error(HTML, tree, "dc.tag.not.allowed", treeName);
-                    break;
-                default:
-                    throw new AssertionError();
             }
 
             if (t.flags.contains(HtmlTag.Flag.NO_NEST)) {
@@ -324,6 +308,58 @@
         }
     }
 
+    private void checkStructure(StartElementTree tree, HtmlTag t) {
+        Name treeName = tree.getName();
+        TagStackItem top = tagStack.peek();
+        switch (t.blockType) {
+            case BLOCK:
+                if (top == null || top.tag.accepts(t))
+                    return;
+
+                switch (top.tree.getKind()) {
+                    case START_ELEMENT: {
+                        if (top.tag.blockType == HtmlTag.BlockType.INLINE) {
+                            Name name = ((StartElementTree) top.tree).getName();
+                            env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.element",
+                                    treeName, name);
+                            return;
+                        }
+                    }
+                    break;
+
+                    case LINK:
+                    case LINK_PLAIN: {
+                        String name = top.tree.getKind().tagName;
+                        env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.tag",
+                                treeName, name);
+                        return;
+                    }
+                }
+                break;
+
+            case INLINE:
+                if (top == null || top.tag.accepts(t))
+                    return;
+                break;
+
+            case LIST_ITEM:
+            case TABLE_ITEM:
+                if (top != null) {
+                    // reset this flag so subsequent bad inline content gets reported
+                    top.flags.remove(Flag.REPORTED_BAD_INLINE);
+                    if (top.tag.accepts(t))
+                        return;
+                }
+                break;
+
+            case OTHER:
+                env.messages.error(HTML, tree, "dc.tag.not.allowed", treeName);
+                return;
+        }
+
+        env.messages.error(HTML, tree, "dc.tag.not.allowed.here", treeName);
+    }
+
     private void checkHeader(StartElementTree tree, HtmlTag tag) {
         // verify the new tag
         if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) {
@@ -378,10 +414,6 @@
                             && !top.flags.contains(Flag.HAS_ELEMENT)) {
                         env.messages.warning(HTML, tree, "dc.tag.empty", treeName);
                     }
-                    if (t.flags.contains(HtmlTag.Flag.NO_TEXT)
-                            && top.flags.contains(Flag.HAS_TEXT)) {
-                        env.messages.error(HTML, tree, "dc.text.not.allowed", treeName);
-                    }
                     tagStack.pop();
                     done = true;
                     break;
@@ -763,7 +795,7 @@
         for (DocTree d: list) {
             switch (d.getKind()) {
                 case TEXT:
-                    if (!((TextTree) d).getBody().trim().isEmpty())
+                    if (hasNonWhitespace((TextTree) d))
                         return;
                     break;
                 default:
@@ -772,6 +804,16 @@
         }
         env.messages.warning(SYNTAX, tree, "dc.empty", tree.getKind().tagName);
     }
+
+    boolean hasNonWhitespace(TextTree tree) {
+        String s = tree.getBody();
+        for (int i = 0; i < s.length(); i++) {
+            if (!Character.isWhitespace(s.charAt(i)))
+                return true;
+        }
+        return false;
+    }
+
     // 
 
 }
diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java
--- a/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Mon Jan 21 10:00:46 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Mon Jan 21 10:07:37 2013 -0800
@@ -57,16 +57,22 @@
     B(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
 
-    BLOCKQUOTE,
+    BIG(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT)),
+
+    BLOCKQUOTE(BlockType.BLOCK, EndKind.REQUIRED,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
 
     BODY(BlockType.OTHER, EndKind.REQUIRED),
 
     BR(BlockType.INLINE, EndKind.NONE,
             attrs(AttrKind.USE_CSS, CLEAR)),
 
-    CAPTION(EnumSet.of(Flag.EXPECT_CONTENT)),
+    CAPTION(BlockType.TABLE_ITEM, EndKind.REQUIRED,
+            EnumSet.of(Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)),
 
-    CENTER,
+    CENTER(BlockType.BLOCK, EndKind.REQUIRED,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
 
     CITE(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
@@ -74,17 +80,23 @@
     CODE(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
 
-    DD(BlockType.BLOCK, EndKind.OPTIONAL,
-            EnumSet.of(Flag.EXPECT_CONTENT)),
+    DD(BlockType.LIST_ITEM, EndKind.OPTIONAL,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)),
 
-    DIV,
+    DIV(BlockType.BLOCK, EndKind.REQUIRED,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
 
     DL(BlockType.BLOCK, EndKind.REQUIRED,
-            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT),
-            attrs(AttrKind.USE_CSS, COMPACT)),
+            EnumSet.of(Flag.EXPECT_CONTENT),
+            attrs(AttrKind.USE_CSS, COMPACT)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == DT) || (t == DD);
+        }
+    },
 
-    DT(BlockType.BLOCK, EndKind.OPTIONAL,
-            EnumSet.of(Flag.EXPECT_CONTENT)),
+    DT(BlockType.LIST_ITEM, EndKind.OPTIONAL,
+            EnumSet.of(Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)),
 
     EM(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.NO_NEST)),
@@ -97,12 +109,12 @@
 
     FRAMESET(BlockType.OTHER, EndKind.REQUIRED),
 
-    H1,
-    H2,
-    H3,
-    H4,
-    H5,
-    H6,
+    H1(BlockType.BLOCK, EndKind.REQUIRED),
+    H2(BlockType.BLOCK, EndKind.REQUIRED),
+    H3(BlockType.BLOCK, EndKind.REQUIRED),
+    H4(BlockType.BLOCK, EndKind.REQUIRED),
+    H5(BlockType.BLOCK, EndKind.REQUIRED),
+    H6(BlockType.BLOCK, EndKind.REQUIRED),
 
     HEAD(BlockType.OTHER, EndKind.REQUIRED),
 
@@ -118,31 +130,54 @@
             attrs(AttrKind.OBSOLETE, NAME),
             attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)),
 
-    LI(BlockType.BLOCK, EndKind.OPTIONAL),
+    LI(BlockType.LIST_ITEM, EndKind.OPTIONAL,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
 
     LINK(BlockType.OTHER, EndKind.NONE),
 
-    MENU,
+    MENU(BlockType.BLOCK, EndKind.REQUIRED) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == LI);
+        }
+    },
 
     META(BlockType.OTHER, EndKind.NONE),
 
     NOFRAMES(BlockType.OTHER, EndKind.REQUIRED),
 
-    NOSCRIPT(BlockType.OTHER, EndKind.REQUIRED),
+    NOSCRIPT(BlockType.BLOCK, EndKind.REQUIRED),
 
     OL(BlockType.BLOCK, EndKind.REQUIRED,
-            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT),
-            attrs(AttrKind.USE_CSS, START, TYPE)),
+            EnumSet.of(Flag.EXPECT_CONTENT),
+            attrs(AttrKind.USE_CSS, START, TYPE)){
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == LI);
+        }
+    },
 
     P(BlockType.BLOCK, EndKind.OPTIONAL,
             EnumSet.of(Flag.EXPECT_CONTENT),
             attrs(AttrKind.USE_CSS, ALIGN)),
 
-    PRE(EnumSet.of(Flag.EXPECT_CONTENT)),
+    PRE(BlockType.BLOCK, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            switch (t) {
+                case IMG: case BIG: case SMALL: case SUB: case SUP:
+                    return false;
+                default:
+                    return (t.blockType == BlockType.INLINE);
+            }
+        }
+    },
 
     SCRIPT(BlockType.OTHER, EndKind.REQUIRED),
 
-    SMALL(BlockType.INLINE, EndKind.REQUIRED),
+    SMALL(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT)),
 
     SPAN(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT)),
@@ -157,37 +192,70 @@
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
 
     TABLE(BlockType.BLOCK, EndKind.REQUIRED,
-            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT),
+            EnumSet.of(Flag.EXPECT_CONTENT),
             attrs(AttrKind.OK, SUMMARY, Attr.FRAME, RULES, BORDER,
                 CELLPADDING, CELLSPACING),
-            attrs(AttrKind.USE_CSS, ALIGN, WIDTH, BGCOLOR)),
+            attrs(AttrKind.USE_CSS, ALIGN, WIDTH, BGCOLOR)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            switch (t) {
+                case CAPTION:
+                case THEAD: case TBODY: case TFOOT:
+                case TR: // HTML 3.2
+                    return true;
+                default:
+                    return false;
+            }
+        }
+    },
 
-    TBODY(BlockType.BLOCK, EndKind.REQUIRED,
-            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT),
-            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)),
+    TBODY(BlockType.TABLE_ITEM, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT),
+            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == TR);
+        }
+    },
 
-    TD(BlockType.BLOCK, EndKind.OPTIONAL,
+    TD(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
             attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, ABBR, AXIS,
                 ALIGN, CHAR, CHAROFF, VALIGN),
             attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)),
 
-    TFOOT(BlockType.BLOCK, EndKind.REQUIRED,
-            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)),
+    TFOOT(BlockType.TABLE_ITEM, EndKind.REQUIRED,
+            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == TR);
+        }
+    },
 
-    TH(BlockType.BLOCK, EndKind.OPTIONAL,
+    TH(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
             attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, ABBR, AXIS,
                 ALIGN, CHAR, CHAROFF, VALIGN),
             attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)),
 
-    THEAD(BlockType.BLOCK, EndKind.REQUIRED,
-            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)),
+    THEAD(BlockType.TABLE_ITEM, EndKind.REQUIRED,
+            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == TR);
+        }
+    },
 
     TITLE(BlockType.OTHER, EndKind.REQUIRED),
 
-    TR(BlockType.BLOCK, EndKind.OPTIONAL,
-            EnumSet.of(Flag.NO_TEXT),
+    TR(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
             attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN),
-            attrs(AttrKind.USE_CSS, BGCOLOR)),
+            attrs(AttrKind.USE_CSS, BGCOLOR)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == TH) || (t == TD);
+        }
+    },
 
     TT(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
@@ -196,8 +264,13 @@
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
 
     UL(BlockType.BLOCK, EndKind.REQUIRED,
-            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT),
-            attrs(AttrKind.USE_CSS, COMPACT, TYPE)),
+            EnumSet.of(Flag.EXPECT_CONTENT),
+            attrs(AttrKind.USE_CSS, COMPACT, TYPE)){
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == LI);
+        }
+    },
 
     VAR(BlockType.INLINE, EndKind.REQUIRED);
 
@@ -207,6 +280,8 @@
     public static enum BlockType {
         BLOCK,
         INLINE,
+        LIST_ITEM,
+        TABLE_ITEM,
         OTHER;
     }
 
@@ -220,9 +295,10 @@
     }
 
     public static enum Flag {
+        ACCEPTS_BLOCK,
+        ACCEPTS_INLINE,
         EXPECT_CONTENT,
-        NO_NEST,
-        NO_TEXT
+        NO_NEST
     }
 
     public static enum Attr {
@@ -300,22 +376,14 @@
     public final Set flags;
     private final Map attrs;
 
-
-    HtmlTag() {
-        this(BlockType.BLOCK, EndKind.REQUIRED);
-    }
-
-    HtmlTag(Set flags) {
-        this(BlockType.BLOCK, EndKind.REQUIRED, flags);
-    }
-
     HtmlTag(BlockType blockType, EndKind endKind, AttrMap... attrMaps) {
         this(blockType, endKind, Collections.emptySet(), attrMaps);
     }
 
     HtmlTag(BlockType blockType, EndKind endKind, Set flags, AttrMap... attrMaps) {
         this.blockType = blockType;
-        this.endKind = endKind;this.flags = flags;
+        this.endKind = endKind;
+        this.flags = flags;
         this.attrs = new EnumMap(Attr.class);
         for (Map m: attrMaps)
             this.attrs.putAll(m);
@@ -324,6 +392,35 @@
         attrs.put(Attr.STYLE, AttrKind.OK);
     }
 
+    public boolean accepts(HtmlTag t) {
+        if (flags.contains(Flag.ACCEPTS_BLOCK) && flags.contains(Flag.ACCEPTS_INLINE)) {
+            return (t.blockType == BlockType.BLOCK) || (t.blockType == BlockType.INLINE);
+        } else if (flags.contains(Flag.ACCEPTS_BLOCK)) {
+            return (t.blockType == BlockType.BLOCK);
+        } else if (flags.contains(Flag.ACCEPTS_INLINE)) {
+            return (t.blockType == BlockType.INLINE);
+        } else
+            switch (blockType) {
+                case BLOCK:
+                case INLINE:
+                    return (t.blockType == BlockType.INLINE);
+                case OTHER:
+                    // OTHER tags are invalid in doc comments, and will be
+                    // reported separately, so silently accept/ignore any content
+                    return true;
+                default:
+                    // any combination which could otherwise arrive here
+                    // ought to have been handled in an overriding method
+                    throw new AssertionError(this + ":" + t);
+            }
+    }
+
+    public boolean acceptsText() {
+        // generally, anywhere we can put text we can also put inline tag
+        // so check if a typical inline tag is allowed
+        return accepts(B);
+    }
+
     public String getText() {
         return name().toLowerCase();
     }
diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties
--- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Mon Jan 21 10:00:46 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Mon Jan 21 10:07:37 2013 -0800
@@ -55,6 +55,7 @@
 dc.tag.header.sequence.1 = header used out of sequence: <{0}>
 dc.tag.header.sequence.2 = header used out of sequence: <{0}>
 dc.tag.nested.not.allowed=nested tag not allowed: <{0}>
+dc.tag.not.allowed.here = tag not allowed here: <{0}>
 dc.tag.not.allowed = element not allowed in documentation comments: <{0}>
 dc.tag.not.allowed.inline.element = block element not allowed within inline element <{1}>: {0}
 dc.tag.not.allowed.inline.tag = block element not allowed within @{1}: {0}
diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/HtmlTagsTest.java
--- a/langtools/test/tools/doclint/HtmlTagsTest.java	Mon Jan 21 10:00:46 2013 -0800
+++ b/langtools/test/tools/doclint/HtmlTagsTest.java	Mon Jan 21 10:07:37 2013 -0800
@@ -54,5 +54,17 @@
      *   
      */
     public void end_unexpected() { }
+
+    /**
+     * 
    text
  • ...
+ */ + public void text_not_allowed() { } + + /** + *
    text
  • ...
+ */ + public void inline_not_allowed() { } + + } diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/HtmlTagsTest.out --- a/langtools/test/tools/doclint/HtmlTagsTest.out Mon Jan 21 10:00:46 2013 -0800 +++ b/langtools/test/tools/doclint/HtmlTagsTest.out Mon Jan 21 10:07:37 2013 -0800 @@ -34,5 +34,11 @@ HtmlTagsTest.java:54: warning: empty tag * ^ -11 errors +HtmlTagsTest.java:59: error: text not allowed in
    element + *
      text
    • ...
    + ^ +HtmlTagsTest.java:64: error: tag not allowed here: + *
      text
    • ...
    + ^ +13 errors 1 warning diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/html/BlockTagsTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/doclint/html/BlockTagsTest.java Mon Jan 21 10:07:37 2013 -0800 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8006251 + * @summary test block tags + * @library .. + * @build DocLintTester + * @run main DocLintTester -Xmsgs BlockTagsTest.java + */ + +/** */ +public class BlockTagsTest { + /** + *
    abc
    + *
    abc
    + *
    abc
    + *
    abc
    def
    + *
    abc
    + *

    abc

    + *

    abc

    + *

    abc

    + *

    abc

    + *
    abc
    + *
    abc
    + *
    + *
  • abc
  • + * + *
    1. abc
    + *

    abc

    + *
     abc 
    + *
    + *
    • abc
    + */ + public void supportedTags() { } +} diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/html/InlineTagsTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/doclint/html/InlineTagsTest.java Mon Jan 21 10:07:37 2013 -0800 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8006251 + * @summary test inline tags + * @library .. + * @build DocLintTester + * @run main DocLintTester -Xmsgs InlineTagsTest.java + */ + +/** */ +public class InlineTagsTest { + /** + * abc + * abc + * abc + *
    + * abc + * abc + * abc + * abc + * abc + * image + * abc + * abc + * abc + * abc + * abc + * abc + * abc + * abc + */ + public void supportedTags() { } +} + diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/html/ListTagsTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/doclint/html/ListTagsTest.java Mon Jan 21 10:07:37 2013 -0800 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8006251 + * @summary test list tags + * @library .. + * @build DocLintTester + * @run main DocLintTester -Xmsgs ListTagsTest.java + */ + +/** */ +public class ListTagsTest { + /** + *
    abc
    def
    + *
    1. abc
    + *
    • abc
    + */ + public void supportedTags() { } +} diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/html/OtherTagsTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/doclint/html/OtherTagsTest.java Mon Jan 21 10:07:37 2013 -0800 @@ -0,0 +1,24 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8006251 + * @summary test other tags + * @library .. + * @build DocLintTester + * @run main DocLintTester -Xmsgs -ref OtherTagsTest.out OtherTagsTest.java + */ + +/** */ +public class OtherTagsTest { + /** + *

    abc + * + * + * + * + * + * + * + * + */ + public void knownInvalidTags() { } +} diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/html/OtherTagsTest.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/doclint/html/OtherTagsTest.out Mon Jan 21 10:07:37 2013 -0800 @@ -0,0 +1,28 @@ +OtherTagsTest.java:13: error: element not allowed in documentation comments: + *

    abc + ^ +OtherTagsTest.java:14: error: element not allowed in documentation comments: + * + ^ +OtherTagsTest.java:15: error: element not allowed in documentation comments: + * + ^ +OtherTagsTest.java:16: error: element not allowed in documentation comments: + * + ^ +OtherTagsTest.java:17: error: element not allowed in documentation comments: + * + ^ +OtherTagsTest.java:18: error: element not allowed in documentation comments: + * + ^ +OtherTagsTest.java:19: error: element not allowed in documentation comments: + * <noframes> + ^ +OtherTagsTest.java:20: error: element not allowed in documentation comments: + ^ +OtherTagsTest.java:21: error: element not allowed in documentation comments: + * <title> + ^ +9 errors diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/html/TableTagsTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/doclint/html/TableTagsTest.java Mon Jan 21 10:07:37 2013 -0800 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8006251 + * @summary test table tags + * @library .. + * @build DocLintTester + * @run main DocLintTester -Xmsgs TableTagsTest.java + */ + +/** */ +public class TableTagsTest { + /** + *
    + *
    + *
    abc
    + *
    + *
    + *
    + */ + public void supportedTags() { } +} diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/html/TagNotAllowed.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/doclint/html/TagNotAllowed.java Mon Jan 21 10:07:37 2013 -0800 @@ -0,0 +1,30 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8004832 + * @summary Add new doclint package + * @library .. + * @build DocLintTester + * @run main DocLintTester -ref TagNotAllowed.out TagNotAllowed.java + */ + +/** + *

    abc
    term
    def
    description
    ghi
    + *
      abc
    1. item
    2. def
    3. item
    4. ghi
    + *
      abc
    • item
    • def
    • item
    • ghi
    + * + * abc
    + * abc
    + * abc
    + * abc
    + * abc
    + * + *
    + *   image
    + *   

    para

    + * text + * text + * text + * text + *
    + */ +public class TagNotAllowed { } diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/html/TagNotAllowed.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/doclint/html/TagNotAllowed.out Mon Jan 21 10:07:37 2013 -0800 @@ -0,0 +1,61 @@ +TagNotAllowed.java:11: error: tag not allowed here: + *
    abc
    term
    def
    description
    ghi
    + ^ +TagNotAllowed.java:11: error: tag not allowed here: + *
    abc
    term
    def
    description
    ghi
    + ^ +TagNotAllowed.java:11: error: tag not allowed here: + *
    abc
    term
    def
    description
    ghi
    + ^ +TagNotAllowed.java:12: error: tag not allowed here: + *
      abc
    1. item
    2. def
    3. item
    4. ghi
    + ^ +TagNotAllowed.java:12: error: tag not allowed here: + *
      abc
    1. item
    2. def
    3. item
    4. ghi
    + ^ +TagNotAllowed.java:12: error: tag not allowed here: + *
      abc
    1. item
    2. def
    3. item
    4. ghi
    + ^ +TagNotAllowed.java:13: error: tag not allowed here: + *
      abc
    • item
    • def
    • item
    • ghi
    + ^ +TagNotAllowed.java:13: error: tag not allowed here: + *
      abc
    • item
    • def
    • item
    • ghi
    + ^ +TagNotAllowed.java:13: error: tag not allowed here: + *
      abc
    • item
    • def
    • item
    • ghi
    + ^ +TagNotAllowed.java:15: error: tag not allowed here: + * abc
    + ^ +TagNotAllowed.java:16: error: tag not allowed here: + * abc
    + ^ +TagNotAllowed.java:17: error: tag not allowed here: + * abc
    + ^ +TagNotAllowed.java:18: error: tag not allowed here: + * abc
    + ^ +TagNotAllowed.java:19: error: tag not allowed here: + * abc
    + ^ +TagNotAllowed.java:22: error: tag not allowed here: + * image + ^ +TagNotAllowed.java:23: error: tag not allowed here:

    + *

    para

    + ^ +TagNotAllowed.java:24: error: tag not allowed here: + * text + ^ +TagNotAllowed.java:25: error: tag not allowed here: + * text + ^ +TagNotAllowed.java:26: error: tag not allowed here: + * text + ^ +TagNotAllowed.java:27: error: tag not allowed here: + * text + ^ +20 errors diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/html/TextNotAllowed.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/doclint/html/TextNotAllowed.java Mon Jan 21 10:07:37 2013 -0800 @@ -0,0 +1,32 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8004832 + * @summary Add new doclint package + * @library .. + * @build DocLintTester + * @run main DocLintTester -ref TextNotAllowed.out TextNotAllowed.java + */ + +/** + *
    abc
    term
    def
    description
    ghi
    + *
      abc
    1. item
    2. def
    3. item
    4. ghi
    + *
      abc
    • item
    • def
    • item
    • ghi
    + * + * abc
    + * abc
    + * abc
    + * abc
    + * abc
    + * + *
    &
    term
    <
    description
    >
    + *
      &
    1. item
    2. <
    3. item
    4. >
    + *
      &
    • item
    • <
    • item
    • >
    + * + * &
    + * &
    + * &
    + * &
    + * &
    + * + */ +public class TextNotAllowed { } diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/html/TextNotAllowed.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/doclint/html/TextNotAllowed.out Mon Jan 21 10:07:37 2013 -0800 @@ -0,0 +1,85 @@ +TextNotAllowed.java:11: error: text not allowed in
    element + *
    abc
    term
    def
    description
    ghi
    + ^ +TextNotAllowed.java:11: error: text not allowed in
    element + *
    abc
    term
    def
    description
    ghi
    + ^ +TextNotAllowed.java:11: error: text not allowed in
    element + *
    abc
    term
    def
    description
    ghi
    + ^ +TextNotAllowed.java:12: error: text not allowed in
      element + *
        abc
      1. item
      2. def
      3. item
      4. ghi
      + ^ +TextNotAllowed.java:12: error: text not allowed in
        element + *
          abc
        1. item
        2. def
        3. item
        4. ghi
        + ^ +TextNotAllowed.java:12: error: text not allowed in
          element + *
            abc
          1. item
          2. def
          3. item
          4. ghi
          + ^ +TextNotAllowed.java:13: error: text not allowed in
            element + *
              abc
            • item
            • def
            • item
            • ghi
            + ^ +TextNotAllowed.java:13: error: text not allowed in
              element + *
                abc
              • item
              • def
              • item
              • ghi
              + ^ +TextNotAllowed.java:13: error: text not allowed in
                element + *
                  abc
                • item
                • def
                • item
                • ghi
                + ^ +TextNotAllowed.java:15: error: text not allowed in element + *
                abc
                + ^ +TextNotAllowed.java:16: error: text not allowed in element + * abc
                + ^ +TextNotAllowed.java:17: error: text not allowed in element + * abc
                + ^ +TextNotAllowed.java:18: error: text not allowed in element + * abc
                + ^ +TextNotAllowed.java:19: error: text not allowed in element + * abc
                + ^ +TextNotAllowed.java:21: error: text not allowed in
                element + *
                &
                term
                <
                description
                >
                + ^ +TextNotAllowed.java:21: error: text not allowed in
                element + *
                &
                term
                <
                description
                >
                + ^ +TextNotAllowed.java:21: error: text not allowed in
                element + *
                &
                term
                <
                description
                >
                + ^ +TextNotAllowed.java:22: error: text not allowed in
                  element + *
                    &
                  1. item
                  2. <
                  3. item
                  4. >
                  + ^ +TextNotAllowed.java:22: error: text not allowed in
                    element + *
                      &
                    1. item
                    2. <
                    3. item
                    4. >
                    + ^ +TextNotAllowed.java:22: error: text not allowed in
                      element + *
                        &
                      1. item
                      2. <
                      3. item
                      4. >
                      + ^ +TextNotAllowed.java:23: error: text not allowed in
                        element + *
                          &
                        • item
                        • <
                        • item
                        • >
                        + ^ +TextNotAllowed.java:23: error: text not allowed in
                          element + *
                            &
                          • item
                          • <
                          • item
                          • >
                          + ^ +TextNotAllowed.java:23: error: text not allowed in
                            element + *
                              &
                            • item
                            • <
                            • item
                            • >
                            + ^ +TextNotAllowed.java:25: error: text not allowed in element + *
                            &
                            + ^ +TextNotAllowed.java:26: error: text not allowed in element + * &
                            + ^ +TextNotAllowed.java:27: error: text not allowed in element + * &
                            + ^ +TextNotAllowed.java:28: error: text not allowed in element + * &
                            + ^ +TextNotAllowed.java:29: error: text not allowed in element + * &
                            + ^ +28 errors diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/tidy/ParaInPre.out --- a/langtools/test/tools/doclint/tidy/ParaInPre.out Mon Jan 21 10:00:46 2013 -0800 +++ b/langtools/test/tools/doclint/tidy/ParaInPre.out Mon Jan 21 10:07:37 2013 -0800 @@ -1,4 +1,4 @@ -ParaInPre.java:16: warning: unexpected use of

                            inside

                             element
                            +ParaInPre.java:16: error: tag not allowed here: 

                            *

                            ^ -1 warning +1 error diff -r c1c9a9e11b26 -r 8f719dc43e1f langtools/test/tools/doclint/tidy/TextNotAllowed.out --- a/langtools/test/tools/doclint/tidy/TextNotAllowed.out Mon Jan 21 10:00:46 2013 -0800 +++ b/langtools/test/tools/doclint/tidy/TextNotAllowed.out Mon Jan 21 10:07:37 2013 -0800 @@ -1,19 +1,19 @@ TextNotAllowed.java:13: error: text not allowed in element *
                            abc
                            - ^ + ^ TextNotAllowed.java:14: error: text not allowed in element * abc
                            - ^ + ^ TextNotAllowed.java:15: error: text not allowed in element * abc
                            - ^ + ^ TextNotAllowed.java:17: error: text not allowed in

                            element *
                            abc
                            - ^ + ^ TextNotAllowed.java:18: error: text not allowed in
                              element *
                                abc
                              - ^ + ^ TextNotAllowed.java:19: error: text not allowed in
                                element *
                                  abc
                                - ^ + ^ 6 errors