changeset 1506:967052c425a1

8006251: doclint: incorrect position for diagnostic for illegal text in tags Reviewed-by: mcimadamore
author jjg
date Mon, 21 Jan 2013 10:07:37 -0800
parents 4a3cfc970c6f
children 1985e35e97b2
files src/share/classes/com/sun/tools/doclint/Checker.java src/share/classes/com/sun/tools/doclint/HtmlTag.java src/share/classes/com/sun/tools/doclint/resources/doclint.properties test/tools/doclint/HtmlTagsTest.java test/tools/doclint/HtmlTagsTest.out test/tools/doclint/html/BlockTagsTest.java test/tools/doclint/html/InlineTagsTest.java test/tools/doclint/html/ListTagsTest.java test/tools/doclint/html/OtherTagsTest.java test/tools/doclint/html/OtherTagsTest.out test/tools/doclint/html/TableTagsTest.java test/tools/doclint/html/TagNotAllowed.java test/tools/doclint/html/TagNotAllowed.out test/tools/doclint/html/TextNotAllowed.java test/tools/doclint/html/TextNotAllowed.out test/tools/doclint/tidy/ParaInPre.out test/tools/doclint/tidy/TextNotAllowed.out
diffstat 17 files changed, 725 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/doclint/Checker.java	Mon Jan 21 10:00:46 2013 -0800
+++ b/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());
+            }
+        }
+    }
+
     // </editor-fold>
 
     // <editor-fold defaultstate="collapsed" desc="HTML elements">
@@ -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 <h1>...</h1>  <h3>...</h3>
                 case H1: case H2: case H3: case H4: case H5: case H6:
                     checkHeader(tree, t);
                     break;
-                // <p> inside <pre>
-                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;
+    }
+
     // </editor-fold>
 
 }
--- a/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Mon Jan 21 10:00:46 2013 -0800
+++ b/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<Flag> flags;
     private final Map<Attr,AttrKind> attrs;
 
-
-    HtmlTag() {
-        this(BlockType.BLOCK, EndKind.REQUIRED);
-    }
-
-    HtmlTag(Set<Flag> flags) {
-        this(BlockType.BLOCK, EndKind.REQUIRED, flags);
-    }
-
     HtmlTag(BlockType blockType, EndKind endKind, AttrMap... attrMaps) {
         this(blockType, endKind, Collections.<Flag>emptySet(), attrMaps);
     }
 
     HtmlTag(BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) {
         this.blockType = blockType;
-        this.endKind = endKind;this.flags = flags;
+        this.endKind = endKind;
+        this.flags = flags;
         this.attrs = new EnumMap<Attr,AttrKind>(Attr.class);
         for (Map<Attr,AttrKind> 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();
     }
--- a/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Mon Jan 21 10:00:46 2013 -0800
+++ b/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}
--- a/test/tools/doclint/HtmlTagsTest.java	Mon Jan 21 10:00:46 2013 -0800
+++ b/test/tools/doclint/HtmlTagsTest.java	Mon Jan 21 10:07:37 2013 -0800
@@ -54,5 +54,17 @@
      * <i> </b> </i>
      */
     public void end_unexpected() { }
+
+    /**
+     * <ul> text <li> ... </li> </ul>
+     */
+    public void text_not_allowed() { }
+
+    /**
+     * <ul> <b>text</b> <li> ... </li> </ul>
+     */
+    public void inline_not_allowed() { }
+
+
 }
 
--- a/test/tools/doclint/HtmlTagsTest.out	Mon Jan 21 10:00:46 2013 -0800
+++ b/test/tools/doclint/HtmlTagsTest.out	Mon Jan 21 10:07:37 2013 -0800
@@ -34,5 +34,11 @@
 HtmlTagsTest.java:54: warning: empty <i> tag
      * <i> </b> </i>
                 ^
-11 errors
+HtmlTagsTest.java:59: error: text not allowed in <ul> element
+     * <ul> text <li> ... </li> </ul>
+           ^
+HtmlTagsTest.java:64: error: tag not allowed here: <b>
+     * <ul> <b>text</b> <li> ... </li> </ul>
+            ^
+13 errors
 1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/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 {
+    /**
+     *  <blockquote> abc </blockquote>
+     *  <center> abc </center>
+     *  <div> abc </div>
+     *  <dl> <dt> abc <dd> def </dl>
+     *  <div> abc </div>
+     *  <h1> abc </h1>
+     *  <h2> abc </h2>
+     *  <h3> abc </h3>
+     *  <h4> abc </h4>
+     *  <h5> abc </h5>
+     *  <h6> abc </h6>
+     *  <hr>
+     *  <menu> <li> abc </menu>
+     *  <noscript> </noscript>
+     *  <ol> <li> abc </ol>
+     *  <p> abc </p>
+     *  <pre> abc </pre>
+     *  <table summary="abc"> <tr> <td> </table>
+     *  <ul> <li> abc </ul>
+     */
+    public void supportedTags() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/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 {
+    /**
+     *  <a href="#abc"> abc </a>
+     *  <b> abc </b>
+     *  <big> abc </big>
+     *  <br>
+     *  <cite> abc </cite>
+     *  <code> abc </code>
+     *  <em> abc </em>
+     *  <font> abc </font>
+     *  <i> abc </i>
+     *  <img alt="image" src="image.png">
+     *  <small> abc </small>
+     *  <span> abc </span>
+     *  <strong> abc </strong>
+     *  <sub> abc </sub>
+     *  <sup> abc </sup>
+     *  <tt> abc </tt>
+     *  <u> abc </u>
+     *  <var> abc </var>
+     */
+    public void supportedTags() { }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/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 {
+    /**
+     *  <dl> <dt> abc <dd> def </dl>
+     *  <ol> <li> abc </ol>
+     *  <ul> <li> abc </ul>
+     */
+    public void supportedTags() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/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 {
+    /**
+     *  <body> <p> abc </body>
+     *  <frame>
+     *  <frameset> </frameset>
+     *  <head> </head>
+     *  <link>
+     *  <meta>
+     *  <noframes> </noframes>
+     *  <script> </script>
+     *  <title> </title>
+     */
+    public void knownInvalidTags() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/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: <body>
+     *  <body> <p> abc </body>
+        ^
+OtherTagsTest.java:14: error: element not allowed in documentation comments: <frame>
+     *  <frame>
+        ^
+OtherTagsTest.java:15: error: element not allowed in documentation comments: <frameset>
+     *  <frameset> </frameset>
+        ^
+OtherTagsTest.java:16: error: element not allowed in documentation comments: <head>
+     *  <head> </head>
+        ^
+OtherTagsTest.java:17: error: element not allowed in documentation comments: <link>
+     *  <link>
+        ^
+OtherTagsTest.java:18: error: element not allowed in documentation comments: <meta>
+     *  <meta>
+        ^
+OtherTagsTest.java:19: error: element not allowed in documentation comments: <noframes>
+     *  <noframes> </noframes>
+        ^
+OtherTagsTest.java:20: error: element not allowed in documentation comments: <script>
+     *  <script> </script>
+        ^
+OtherTagsTest.java:21: error: element not allowed in documentation comments: <title>
+     *  <title> </title>
+        ^
+9 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/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 {
+    /**
+     *  <table summary="abc"> <tr> <td> </table>
+     *  <table summary="abc"> <tr> <th> </table>
+     *  <table> <caption> abc </caption> <tr> <td> </table>
+     *  <table summary="abc"> <thead> <tr> </thead> <tr> <td> </table>
+     *  <table summary="abc"> <tbody> <tr> <td> </tbody> </table>
+     *  <table summary="abc"> <tr> <td> <tfoot> <tr> </tfoot></table>
+     */
+    public void supportedTags() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/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
+ */
+
+/**
+ * <dl> <b>abc</b> <dt> term </dt> <b>def</b> <dd> description </dd> <b>ghi</b> </dl>
+ * <ol> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ol>
+ * <ul> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ul>
+ *
+ * <table summary=description> <b>abc</b> </table>
+ * <table summary=description> <thead> <b>abc</b> </thead> </table>
+ * <table summary=description> <tbody> <b>abc</b> </tbody> </table>
+ * <table summary=description> <tfoot> <b>abc</b> </tfoot> </table>
+ * <table summary=description> <tr> <b>abc</b> </tr> </table>
+ *
+ * <pre>
+ *   <img alt="image" src="image.png">
+ *   <p> para </p>
+ *   <big> text </big>
+ *   <small> text </small>
+ *   <sub> text </sub>
+ *   <sup> text </sup>
+ * </pre>
+ */
+public class TagNotAllowed { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/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: <b>
+ * <dl> <b>abc</b> <dt> term </dt> <b>def</b> <dd> description </dd> <b>ghi</b> </dl>
+        ^
+TagNotAllowed.java:11: error: tag not allowed here: <b>
+ * <dl> <b>abc</b> <dt> term </dt> <b>def</b> <dd> description </dd> <b>ghi</b> </dl>
+                                   ^
+TagNotAllowed.java:11: error: tag not allowed here: <b>
+ * <dl> <b>abc</b> <dt> term </dt> <b>def</b> <dd> description </dd> <b>ghi</b> </dl>
+                                                                     ^
+TagNotAllowed.java:12: error: tag not allowed here: <b>
+ * <ol> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ol>
+        ^
+TagNotAllowed.java:12: error: tag not allowed here: <b>
+ * <ol> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ol>
+                                   ^
+TagNotAllowed.java:12: error: tag not allowed here: <b>
+ * <ol> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ol>
+                                                              ^
+TagNotAllowed.java:13: error: tag not allowed here: <b>
+ * <ul> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ul>
+        ^
+TagNotAllowed.java:13: error: tag not allowed here: <b>
+ * <ul> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ul>
+                                   ^
+TagNotAllowed.java:13: error: tag not allowed here: <b>
+ * <ul> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ul>
+                                                              ^
+TagNotAllowed.java:15: error: tag not allowed here: <b>
+ * <table summary=description> <b>abc</b> </table>
+                               ^
+TagNotAllowed.java:16: error: tag not allowed here: <b>
+ * <table summary=description> <thead> <b>abc</b> </thead> </table>
+                                       ^
+TagNotAllowed.java:17: error: tag not allowed here: <b>
+ * <table summary=description> <tbody> <b>abc</b> </tbody> </table>
+                                       ^
+TagNotAllowed.java:18: error: tag not allowed here: <b>
+ * <table summary=description> <tfoot> <b>abc</b> </tfoot> </table>
+                                       ^
+TagNotAllowed.java:19: error: tag not allowed here: <b>
+ * <table summary=description> <tr> <b>abc</b> </tr> </table>
+                                    ^
+TagNotAllowed.java:22: error: tag not allowed here: <img>
+ *   <img alt="image" src="image.png">
+     ^
+TagNotAllowed.java:23: error: tag not allowed here: <p>
+ *   <p> para </p>
+     ^
+TagNotAllowed.java:24: error: tag not allowed here: <big>
+ *   <big> text </big>
+     ^
+TagNotAllowed.java:25: error: tag not allowed here: <small>
+ *   <small> text </small>
+     ^
+TagNotAllowed.java:26: error: tag not allowed here: <sub>
+ *   <sub> text </sub>
+     ^
+TagNotAllowed.java:27: error: tag not allowed here: <sup>
+ *   <sup> text </sup>
+     ^
+20 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/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
+ */
+
+/**
+ * <dl> abc <dt> term </dt> def <dd> description </dd> ghi </dl>
+ * <ol> abc <li> item </li> def <li> item </li> ghi </ol>
+ * <ul> abc <li> item </li> def <li> item </li> ghi </ul>
+ *
+ * <table summary=description> abc </table>
+ * <table summary=description> <thead> abc </thead> </table>
+ * <table summary=description> <tbody> abc </tbody> </table>
+ * <table summary=description> <tfoot> abc </tfoot> </table>
+ * <table summary=description> <tr> abc </tr> </table>
+ *
+ * <dl> &amp; <dt> term </dt> &lt; <dd> description </dd> &gt; </dl>
+ * <ol> &amp; <li> item </li> &lt; <li> item </li> &gt; </ol>
+ * <ul> &amp; <li> item </li> &lt; <li> item </li> &gt; </ul>
+ *
+ * <table summary=description> &amp; </table>
+ * <table summary=description> <thead> &amp; </thead> </table>
+ * <table summary=description> <tbody> &amp; </tbody> </table>
+ * <table summary=description> <tfoot> &amp; </tfoot> </table>
+ * <table summary=description> <tr> &amp; </tr> </table>
+ *
+ */
+public class TextNotAllowed { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/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 <dl> element
+ * <dl> abc <dt> term </dt> def <dd> description </dd> ghi </dl>
+       ^
+TextNotAllowed.java:11: error: text not allowed in <dl> element
+ * <dl> abc <dt> term </dt> def <dd> description </dd> ghi </dl>
+                           ^
+TextNotAllowed.java:11: error: text not allowed in <dl> element
+ * <dl> abc <dt> term </dt> def <dd> description </dd> ghi </dl>
+                                                      ^
+TextNotAllowed.java:12: error: text not allowed in <ol> element
+ * <ol> abc <li> item </li> def <li> item </li> ghi </ol>
+       ^
+TextNotAllowed.java:12: error: text not allowed in <ol> element
+ * <ol> abc <li> item </li> def <li> item </li> ghi </ol>
+                           ^
+TextNotAllowed.java:12: error: text not allowed in <ol> element
+ * <ol> abc <li> item </li> def <li> item </li> ghi </ol>
+                                               ^
+TextNotAllowed.java:13: error: text not allowed in <ul> element
+ * <ul> abc <li> item </li> def <li> item </li> ghi </ul>
+       ^
+TextNotAllowed.java:13: error: text not allowed in <ul> element
+ * <ul> abc <li> item </li> def <li> item </li> ghi </ul>
+                           ^
+TextNotAllowed.java:13: error: text not allowed in <ul> element
+ * <ul> abc <li> item </li> def <li> item </li> ghi </ul>
+                                               ^
+TextNotAllowed.java:15: error: text not allowed in <table> element
+ * <table summary=description> abc </table>
+                              ^
+TextNotAllowed.java:16: error: text not allowed in <thead> element
+ * <table summary=description> <thead> abc </thead> </table>
+                                      ^
+TextNotAllowed.java:17: error: text not allowed in <tbody> element
+ * <table summary=description> <tbody> abc </tbody> </table>
+                                      ^
+TextNotAllowed.java:18: error: text not allowed in <tfoot> element
+ * <table summary=description> <tfoot> abc </tfoot> </table>
+                                      ^
+TextNotAllowed.java:19: error: text not allowed in <tr> element
+ * <table summary=description> <tr> abc </tr> </table>
+                                   ^
+TextNotAllowed.java:21: error: text not allowed in <dl> element
+ * <dl> &amp; <dt> term </dt> &lt; <dd> description </dd> &gt; </dl>
+        ^
+TextNotAllowed.java:21: error: text not allowed in <dl> element
+ * <dl> &amp; <dt> term </dt> &lt; <dd> description </dd> &gt; </dl>
+                              ^
+TextNotAllowed.java:21: error: text not allowed in <dl> element
+ * <dl> &amp; <dt> term </dt> &lt; <dd> description </dd> &gt; </dl>
+                                                          ^
+TextNotAllowed.java:22: error: text not allowed in <ol> element
+ * <ol> &amp; <li> item </li> &lt; <li> item </li> &gt; </ol>
+        ^
+TextNotAllowed.java:22: error: text not allowed in <ol> element
+ * <ol> &amp; <li> item </li> &lt; <li> item </li> &gt; </ol>
+                              ^
+TextNotAllowed.java:22: error: text not allowed in <ol> element
+ * <ol> &amp; <li> item </li> &lt; <li> item </li> &gt; </ol>
+                                                   ^
+TextNotAllowed.java:23: error: text not allowed in <ul> element
+ * <ul> &amp; <li> item </li> &lt; <li> item </li> &gt; </ul>
+        ^
+TextNotAllowed.java:23: error: text not allowed in <ul> element
+ * <ul> &amp; <li> item </li> &lt; <li> item </li> &gt; </ul>
+                              ^
+TextNotAllowed.java:23: error: text not allowed in <ul> element
+ * <ul> &amp; <li> item </li> &lt; <li> item </li> &gt; </ul>
+                                                   ^
+TextNotAllowed.java:25: error: text not allowed in <table> element
+ * <table summary=description> &amp; </table>
+                               ^
+TextNotAllowed.java:26: error: text not allowed in <thead> element
+ * <table summary=description> <thead> &amp; </thead> </table>
+                                       ^
+TextNotAllowed.java:27: error: text not allowed in <tbody> element
+ * <table summary=description> <tbody> &amp; </tbody> </table>
+                                       ^
+TextNotAllowed.java:28: error: text not allowed in <tfoot> element
+ * <table summary=description> <tfoot> &amp; </tfoot> </table>
+                                       ^
+TextNotAllowed.java:29: error: text not allowed in <tr> element
+ * <table summary=description> <tr> &amp; </tr> </table>
+                                    ^
+28 errors
--- a/test/tools/doclint/tidy/ParaInPre.out	Mon Jan 21 10:00:46 2013 -0800
+++ b/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 <p> inside <pre> element
+ParaInPre.java:16: error: tag not allowed here: <p>
  *     <p>
        ^
-1 warning
+1 error
--- a/test/tools/doclint/tidy/TextNotAllowed.out	Mon Jan 21 10:00:46 2013 -0800
+++ b/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 <table> element
  * <table summary=description> abc </table>
-                                   ^
+                              ^
 TextNotAllowed.java:14: error: text not allowed in <tbody> element
  * <table summary=description> <tbody> abc </tbody> </table>
-                                           ^
+                                      ^
 TextNotAllowed.java:15: error: text not allowed in <tr> element
  * <table summary=description> <tr> abc </tr> </table>
-                                        ^
+                                   ^
 TextNotAllowed.java:17: error: text not allowed in <dl> element
  * <dl> abc </dl>
-            ^
+       ^
 TextNotAllowed.java:18: error: text not allowed in <ol> element
  * <ol> abc </ol>
-            ^
+       ^
 TextNotAllowed.java:19: error: text not allowed in <ul> element
  * <ul> abc </ul>
-            ^
+       ^
 6 errors