Merge
authorlana
Mon, 03 Jun 2013 16:56:54 -0700
changeset 18003 dfbe39cd3ec7
parent 18002 bf9d876d0c6a (current diff)
parent 18001 e6193c14cc7e (diff)
child 18004 dcf9d59b1635
Merge
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Mon Jun 03 16:10:18 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Mon Jun 03 16:56:54 2013 -0700
@@ -531,6 +531,17 @@
                             }
                         }
                         break;
+
+                    case VALUE:
+                        if (currTag == HtmlTag.LI) {
+                            String v = getAttrValue(tree);
+                            if (v == null || v.isEmpty()) {
+                                env.messages.error(HTML, tree, "dc.attr.lacks.value");
+                            } else if (!validNumber.matcher(v).matches()) {
+                                env.messages.error(HTML, tree, "dc.attr.not.number");
+                            }
+                        }
+                        break;
                 }
             }
         }
@@ -543,6 +554,8 @@
     // http://www.w3.org/TR/html401/types.html#type-name
     private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*");
 
+    private static final Pattern validNumber = Pattern.compile("-?[0-9]+");
+
     // pattern to remove leading {@docRoot}/?
     private static final Pattern docRoot = Pattern.compile("(?i)(\\{@docRoot *\\}/?)?(.*)");
 
--- a/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Mon Jun 03 16:10:18 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Mon Jun 03 16:56:54 2013 -0700
@@ -131,7 +131,8 @@
             attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)),
 
     LI(BlockType.LIST_ITEM, EndKind.OPTIONAL,
-            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
+            attrs(AttrKind.OK, VALUE)),
 
     LINK(BlockType.OTHER, EndKind.NONE),
 
@@ -339,6 +340,7 @@
         TARGET,
         TYPE,
         VALIGN,
+        VALUE,
         VSPACE,
         WIDTH;
 
--- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Mon Jun 03 16:10:18 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Mon Jun 03 16:56:54 2013 -0700
@@ -26,6 +26,7 @@
 dc.anchor.already.defined = anchor already defined: {0}
 dc.anchor.value.missing = no value given for anchor
 dc.attr.lacks.value = attribute lacks value
+dc.attr.not.number = attribute value is not a number
 dc.attr.obsolete = attribute obsolete: {0}
 dc.attr.obsolete.use.css = attribute obsolete, use CSS instead: {0}
 dc.attr.repeated = repeated attribute: {0}
--- a/langtools/test/tools/doclint/html/ListTagsTest.java	Mon Jun 03 16:10:18 2013 -0700
+++ b/langtools/test/tools/doclint/html/ListTagsTest.java	Mon Jun 03 16:56:54 2013 -0700
@@ -1,33 +1,10 @@
 /*
- * 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
+ * @test /nodynamiccopyright/
+ * @bug 8006251 8013405
  * @summary test list tags
  * @library ..
  * @build DocLintTester
- * @run main DocLintTester -Xmsgs ListTagsTest.java
+ * @run main DocLintTester -Xmsgs -ref ListTagsTest.out ListTagsTest.java
  */
 
 /** */
@@ -35,6 +12,9 @@
     /**
      *  <dl> <dt> abc <dd> def </dl>
      *  <ol> <li> abc </ol>
+     *  <ol> <li value="1"> abc </ol>
+     *  <ol> <li value> bad </ol>
+     *  <ol> <li value="a"> bad </ol>
      *  <ul> <li> abc </ul>
      */
     public void supportedTags() { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/html/ListTagsTest.out	Mon Jun 03 16:56:54 2013 -0700
@@ -0,0 +1,7 @@
+ListTagsTest.java:16: error: attribute lacks value
+     *  <ol> <li value> bad </ol>
+                 ^
+ListTagsTest.java:17: error: attribute value is not a number
+     *  <ol> <li value="a"> bad </ol>
+                 ^
+2 errors