8203791: Remove "compatibility" features from Table.java
authorpmuthuswamy
Mon, 30 Jul 2018 11:52:05 +0530
changeset 51260 b7a307084247
parent 51259 5fd711ba43f5
child 51261 0a4916c1418c
8203791: Remove "compatibility" features from Table.java Reviewed-by: jjg
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Table.java
test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java
test/langtools/jdk/javadoc/doclet/testMethodTypes/TestMethodTypes.java
test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java
test/langtools/jdk/javadoc/doclet/testUnnamedPackage/TestUnnamedPackage.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java	Mon Jul 30 11:52:05 2018 +0530
@@ -150,9 +150,7 @@
                 .addTab(resources.exceptionSummary, e -> utils.isException((TypeElement)e))
                 .addTab(resources.errorSummary, e -> utils.isError((TypeElement)e))
                 .addTab(resources.annotationTypeSummary, utils::isAnnotationType)
-                .setTabScript(i -> "show(" + i + ");")
-                .setUseTBody(false)
-                .setPutIdFirst(true);
+                .setTabScript(i -> "show(" + i + ");");
         for (Character unicode : indexbuilder.index()) {
             for (Element element : indexbuilder.getMemberList(unicode)) {
                 TypeElement typeElement = (TypeElement) element;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java	Mon Jul 30 11:52:05 2018 +0530
@@ -221,8 +221,7 @@
                 .setCaption(caption)
                 .setHeader(header)
                 .setRowScopeColumn(1)
-                .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast)
-                .setUseTBody(false);  // temporary? compatibility mode for TBody
+                .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast);
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Mon Jul 30 11:52:05 2018 +0530
@@ -242,8 +242,7 @@
                 .setCaption(getCaption())
                 .setHeader(getSummaryTableHeader(typeElement))
                 .setRowScopeColumn(1)
-                .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast)
-                .setUseTBody(false);  // temporary? compatibility mode for TBody
+                .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast);
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java	Mon Jul 30 11:52:05 2018 +0530
@@ -268,8 +268,7 @@
                 .setCaption(contents.constructors)
                 .setHeader(getSummaryTableHeader(typeElement))
                 .setRowScopeColumn(rowScopeColumn)
-                .setColumnStyles(bodyRowStyles)
-                .setUseTBody(false);  // temporary? compatibility mode for TBody
+                .setColumnStyles(bodyRowStyles);
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java	Mon Jul 30 11:52:05 2018 +0530
@@ -212,8 +212,7 @@
                 .setSummary(summary)
                 .setCaption(contents.getContent("doclet.Enum_Constants"))
                 .setHeader(getSummaryTableHeader(typeElement))
-                .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast)
-                .setUseTBody(false);
+                .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java	Mon Jul 30 11:52:05 2018 +0530
@@ -218,8 +218,7 @@
                 .setCaption(contents.fields)
                 .setHeader(getSummaryTableHeader(typeElement))
                 .setRowScopeColumn(1)
-                .setColumnStyles(bodyRowStyles)
-                .setUseTBody(false);  // temporary? compatibility mode for TBody
+                .setColumnStyles(bodyRowStyles);
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java	Mon Jul 30 11:52:05 2018 +0530
@@ -267,9 +267,7 @@
                 .addTab(resources.getText("doclet.Default_Methods"), utils::isDefault)
                 .addTab(resources.getText("doclet.Deprecated_Methods"),
                         e -> utils.isDeprecated(e) || utils.isDeprecated(typeElement))
-                .setTabScript(i -> "show(" + i + ");")
-                .setUseTBody(false)
-                .setPutIdFirst(true);
+                .setTabScript(i -> "show(" + i + ");");
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java	Mon Jul 30 11:52:05 2018 +0530
@@ -121,8 +121,7 @@
                 .setCaption(contents.getContent("doclet.Nested_Classes"))
                 .setHeader(getSummaryTableHeader(typeElement))
                 .setRowScopeColumn(1)
-                .setColumnStyles(bodyRowStyles)
-                .setUseTBody(false);  // temporary? compatibility mode for TBody
+                .setColumnStyles(bodyRowStyles);
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java	Mon Jul 30 11:52:05 2018 +0530
@@ -232,8 +232,7 @@
                 .setCaption(contents.properties)
                 .setHeader(getSummaryTableHeader(typeElement))
                 .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast)
-                .setRowScopeColumn(1)
-                .setUseTBody(false);
+                .setRowScopeColumn(1);
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Table.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Table.java	Mon Jul 30 11:52:05 2018 +0530
@@ -81,10 +81,6 @@
     private final List<Integer> bodyRowMasks;
     private String rowIdPrefix = "i";
 
-    // compatibility flags
-    private boolean putIdFirst = false;
-    private boolean useTBody = true;
-
     /**
      * Creates a builder for an HTML table.
      *
@@ -302,37 +298,6 @@
     }
 
     /**
-     * Sets whether the {@code id} attribute should appear first in a {@code <tr>} tag.
-     * The default is {@code false}.
-     *
-     * <b>This is a compatibility feature that should be removed when all tables use a
-     * consistent policy.</b>
-     *
-     * @param first whether to put {@code id} attributes first
-     * @return this object
-     */
-    public Table setPutIdFirst(boolean first) {
-        this.putIdFirst = first;
-        return this;
-    }
-
-    /**
-     * Sets whether or not to use an explicit {@code <tbody>} element to enclose the rows
-     * of a table.
-     * The default is {@code true}.
-     *
-     * <b>This is a compatibility feature that should be removed when all tables use a
-     * consistent policy.</b>
-     *
-     * @param use whether o use a {@code <tbody> element
-     * @return this object
-     */
-    public Table setUseTBody(boolean use) {
-        this.useTBody = use;
-        return this;
-    }
-
-    /**
      * Add a row of data to the table.
      * Each item of content should be suitable for use as the content of a
      * {@code <th>} or {@code <td>} cell.
@@ -399,11 +364,6 @@
 
         HtmlTree row = new HtmlTree(HtmlTag.TR);
 
-        if (putIdFirst && tabMap != null) {
-            int index = bodyRows.size();
-            row.addAttr(HtmlAttr.ID, (rowIdPrefix + index));
-        }
-
         if (stripedStyles != null) {
             int rowIndex = bodyRows.size();
             row.addAttr(HtmlAttr.CLASS, stripedStyles.get(rowIndex % 2).name());
@@ -422,10 +382,8 @@
         bodyRows.add(row);
 
         if (tabMap != null) {
-            if (!putIdFirst) {
-                int index = bodyRows.size() - 1;
-                row.addAttr(HtmlAttr.ID, (rowIdPrefix + index));
-            }
+            int index = bodyRows.size() - 1;
+            row.addAttr(HtmlAttr.ID, (rowIdPrefix + index));
             int mask = 0;
             int maskBit = 1;
             for (Map.Entry<String, Predicate<Element>> e : tabMap.entrySet()) {
@@ -493,13 +451,10 @@
             table.addContent(caption);
         }
         table.addContent(header.toContent());
-        if (useTBody) {
-            Content tbody = new HtmlTree(HtmlTag.TBODY);
-            bodyRows.forEach(row -> tbody.addContent(row));
-            table.addContent(tbody);
-        } else {
-            bodyRows.forEach(row -> table.addContent(row));
-        }
+        Content tbody = new HtmlTree(HtmlTag.TBODY);
+        bodyRows.forEach(row -> tbody.addContent(row));
+        table.addContent(tbody);
+
         return table;
     }
 
--- a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java	Mon Jul 30 11:52:05 2018 +0530
@@ -25,6 +25,7 @@
  * @test
  * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363
  *      8167967 8172528 8175200 8178830 8182257 8186332 8182765 8025091
+ *      8203791
  * @summary Test of the JavaFX doclet features.
  * @author jvalenta
  * @library ../lib
@@ -316,27 +317,28 @@
                 + "<th class=\"colSecond\" scope=\"col\">Method</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                 + "</tr>\n"
-                + "<tr id=\"i0\" class=\"altColor\">\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\" id=\"i0\">\n"
                 + "<td class=\"colFirst\"><code>&lt;T&gt;&nbsp;java.lang.Object</code></td>\n"
                 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"#alphaProperty(java.util.List)\">alphaProperty</a>"
                 + "</span>&#8203;(java.util.List&lt;T&gt;&nbsp;foo)</code></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>\n"
-                + "<tr id=\"i1\" class=\"rowColor\">\n"
+                + "<tr class=\"rowColor\" id=\"i1\">\n"
                 + "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n"
                 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"#betaProperty()\">betaProperty</a></span>()</code></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>\n"
-                + "<tr id=\"i2\" class=\"altColor\">\n"
+                + "<tr class=\"altColor\" id=\"i2\">\n"
                 + "<td class=\"colFirst\"><code>java.util.List&lt;java.util.Set&lt;? super java.lang.Object&gt;&gt;"
                 + "</code></td>\n"
                 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"#deltaProperty()\">deltaProperty</a></span>()</code></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>\n"
-                + "<tr id=\"i3\" class=\"rowColor\">\n"
+                + "<tr class=\"rowColor\" id=\"i3\">\n"
                 + "<td class=\"colFirst\"><code>java.util.List&lt;java.lang.String&gt;</code></td>\n"
                 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"#gammaProperty()\">gammaProperty</a></span>()</code></th>\n"
@@ -357,27 +359,28 @@
                 + "<th class=\"colSecond\" scope=\"col\">Method</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                 + "</tr>\n"
-                + "<tr id=\"i0\" class=\"altColor\">\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\" id=\"i0\">\n"
                 + "<td class=\"colFirst\"><code>&lt;T&gt;&nbsp;java.lang.Object</code></td>\n"
                 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"#alphaProperty-java.util.List-\">alphaProperty</a>"
                 + "</span>&#8203;(java.util.List&lt;T&gt;&nbsp;foo)</code></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>\n"
-                + "<tr id=\"i1\" class=\"rowColor\">\n"
+                + "<tr class=\"rowColor\" id=\"i1\">\n"
                 + "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n"
                 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"#betaProperty--\">betaProperty</a></span>()</code></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>\n"
-                + "<tr id=\"i2\" class=\"altColor\">\n"
+                + "<tr class=\"altColor\" id=\"i2\">\n"
                 + "<td class=\"colFirst\"><code>java.util.List&lt;java.util.Set&lt;? super java.lang.Object&gt;&gt;"
                 + "</code></td>\n"
                 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"#deltaProperty--\">deltaProperty</a></span>()</code></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>\n"
-                + "<tr id=\"i3\" class=\"rowColor\">\n"
+                + "<tr class=\"rowColor\" id=\"i3\">\n"
                 + "<td class=\"colFirst\"><code>java.util.List&lt;java.lang.String&gt;</code></td>\n"
                 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"#gammaProperty--\">gammaProperty</a></span>()</code></th>\n"
--- a/test/langtools/jdk/javadoc/doclet/testMethodTypes/TestMethodTypes.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/test/langtools/jdk/javadoc/doclet/testMethodTypes/TestMethodTypes.java	Mon Jul 30 11:52:05 2018 +0530
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8002304 8024096 8193671 8196201
+ * @bug      8002304 8024096 8193671 8196201 8203791
  * @summary  Test for various method type tabs in the method summary table
  * @author   Bhavesh Patel
  * @library  ../lib
@@ -59,7 +59,7 @@
                 + "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">"
                 + "Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
                 + "</caption>",
-                "<tr id=\"i0\" class=\"altColor\">");
+                "<tr class=\"altColor\" id=\"i0\">");
 
         checkOutput("pkg1/B.html", true,
                 "var data = {\"i0\":6,\"i1\":18,\"i2\":18,\"i3\":1,\"i4\":1,"
@@ -88,7 +88,7 @@
                 + "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">"
                 + "Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
                 + "</caption>",
-                "<tr id=\"i0\" class=\"altColor\">");
+                "<tr class=\"altColor\" id=\"i0\">");
 
         checkOutput("pkg1/A.html", false,
                 "<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>"
--- a/test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java	Mon Jul 30 11:52:05 2018 +0530
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8176231 8189843 8182765
+ * @bug      8176231 8189843 8182765 8203791
  * @summary  Test JavaFX property.
  * @library  ../lib/
  * @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -83,7 +83,7 @@
                 + "<a href=\"#badProperty\">bad</a></span></code></th>",
 
                 // id should be used in the method table
-                "<tr id=\"i0\" class=\"altColor\">\n"
+                "<tr class=\"altColor\" id=\"i0\">\n"
                 + "<td class=\"colFirst\"><code><a href=\"ObjectProperty.html\" "
                 + "title=\"class in pkg\">ObjectProperty</a>&lt;<a href=\"MyObj.html\" "
                 + "title=\"class in pkg\">MyObj</a>[]&gt;</code></td>\n"
@@ -147,7 +147,7 @@
                 + "</dl>",
 
                 // id should be used in the method table
-                "<tr id=\"i0\" class=\"altColor\">\n"
+                "<tr class=\"altColor\" id=\"i0\">\n"
                 + "<td class=\"colFirst\"><code><a href=\"ObjectProperty.html\" "
                 + "title=\"class in pkg\">ObjectProperty</a>&lt;<a href=\"MyObj.html\" "
                 + "title=\"class in pkg\">MyObj</a>[]&gt;</code></td>\n"
--- a/test/langtools/jdk/javadoc/doclet/testUnnamedPackage/TestUnnamedPackage.java	Mon Jul 30 09:06:14 2018 +0800
+++ b/test/langtools/jdk/javadoc/doclet/testUnnamedPackage/TestUnnamedPackage.java	Mon Jul 30 11:52:05 2018 +0530
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4904075 4774450 5015144 8043698 8196201
+ * @bug      4904075 4774450 5015144 8043698 8196201 8203791
  * @summary  Reference unnamed package as "Unnamed", not empty string.
  *           Generate a package summary for the unnamed package.
  * @author   jamieh
@@ -71,12 +71,14 @@
                 + "<th class=\"colFirst\" scope=\"col\">Class</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                 + "</tr>\n"
-                + "<tr id=\"i0\" class=\"altColor\">\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\" id=\"i0\">\n"
                 + "<td class=\"colFirst\"><a href=\"C.html\" title=\"class in &lt;Unnamed&gt;\">C</a></td>\n"
                 + "<th class=\"colLast\" scope=\"row\">\n"
                 + "<div class=\"block\">This is a class in the unnamed package.</div>\n"
                 + "</th>\n"
                 + "</tr>\n"
+                + "</tbody>\n"
                 + "</table>");
 
         checkOutput("allpackages-index.html", true,