8189843: Missing \"id\" attributes in table rows
authorjjg
Wed, 25 Oct 2017 17:18:00 -0700
changeset 47450 d3e20c816f60
parent 47449 afa66f3c34c1
child 47451 52b4d3f0167c
8189843: Missing \"id\" attributes in table rows Reviewed-by: bpatel, ksrini
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MemberSummaryWriter.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Wed Oct 25 17:16:18 2017 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Wed Oct 25 17:18:00 2017 -0700
@@ -36,7 +36,6 @@
 import javax.lang.model.type.TypeMirror;
 
 import com.sun.source.doctree.DocTree;
-import jdk.javadoc.internal.doclets.formats.html.TableHeader;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
@@ -44,6 +43,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
 import jdk.javadoc.internal.doclets.toolkit.Resources;
 import jdk.javadoc.internal.doclets.toolkit.taglets.DeprecatedTaglet;
 import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
@@ -65,7 +65,7 @@
  * @author Jamie Ho (Re-write)
  * @author Bhavesh Patel (Modified)
  */
-public abstract class AbstractMemberWriter {
+public abstract class AbstractMemberWriter implements MemberSummaryWriter {
 
     protected final HtmlConfiguration configuration;
     protected final Utils utils;
@@ -519,7 +519,8 @@
      * @param counter the counter for determining id and style for the table row
      */
     public void addMemberSummary(TypeElement tElement, Element member,
-            List<? extends DocTree> firstSentenceTags, List<Content> tableContents, int counter) {
+            List<? extends DocTree> firstSentenceTags, List<Content> tableContents, int counter,
+            VisibleMemberMap.Kind vmmKind) {
         HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
         tdSummaryType.addStyle(HtmlStyle.colFirst);
         writer.addSummaryType(this, member, tdSummaryType);
@@ -532,7 +533,8 @@
         tdDesc.addStyle(HtmlStyle.colLast);
         writer.addSummaryLinkComment(this, member, firstSentenceTags, tdDesc);
         tr.addContent(tdDesc);
-        if (utils.isMethod(member) && !utils.isAnnotationType(member) && !utils.isProperty(name(member))) {
+        if (utils.isMethod(member) && !utils.isAnnotationType(member)
+                && vmmKind != VisibleMemberMap.Kind.PROPERTIES) {
             int methodType = utils.isStatic(member) ? MethodTypes.STATIC.tableTabs().value() :
                     MethodTypes.INSTANCE.tableTabs().value();
             if (utils.isInterface(member.getEnclosingElement())) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MemberSummaryWriter.java	Wed Oct 25 17:16:18 2017 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MemberSummaryWriter.java	Wed Oct 25 17:18:00 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -32,6 +32,7 @@
 import javax.lang.model.element.TypeElement;
 
 import com.sun.source.doctree.DocTree;
+import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 
 /**
  * The interface for writing member summary output.
@@ -77,7 +78,8 @@
      * @param counter the counter for determining id and style for the table row
      */
     public void addMemberSummary(TypeElement typeElement, Element member,
-            List<? extends DocTree> firstSentenceTags, List<Content> tableContents, int counter);
+            List<? extends DocTree> firstSentenceTags, List<Content> tableContents, int counter,
+            VisibleMemberMap.Kind vmmKind);
 
     /**
      * Get the inherited member summary header for the given class.
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Wed Oct 25 17:16:18 2017 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Wed Oct 25 17:18:00 2017 -0700
@@ -356,7 +356,7 @@
                     }
                 }
                 writer.addMemberSummary(typeElement, member, firstSentenceTags,
-                        tableContents, counter);
+                        tableContents, counter, visibleMemberMap.kind);
                 counter++;
             }
             summaryTreeList.add(writer.getSummaryTableTree(typeElement, tableContents));
--- a/test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java	Wed Oct 25 17:16:18 2017 -0700
+++ b/test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java	Wed Oct 25 17:18:00 2017 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8176231
+ * @bug      8176231 8189843
  * @summary  Test JavaFX property.
  * @library  ../lib/
  * @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -71,7 +71,23 @@
                 + "<dd><a href=\"../pkg/MyClass.html#getBad--\"><code>getBad()</code></a>, \n"
                 + "<a href=\"../pkg/MyClass.html#setBad-pkg.MyObj:A-\">"
                 + "<code>setBad(MyObj[])</code></a></dd>\n"
-                + "</dl>"
+                + "</dl>",
+
+                // id should not be used in the property table
+                "<tr class=\"altColor\">\n"
+                + "<td class=\"colFirst\"><code><a href=\"../pkg/ObjectProperty.html\" "
+                + "title=\"class in pkg\">ObjectProperty</a>&lt;<a href=\"../pkg/MyObj.html\" "
+                + "title=\"class in pkg\">MyObj</a>[]&gt;</code></td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg/MyClass.html#badProperty\">bad</a></span></code></th>",
+
+                // id should be used in the method table
+                "<tr id=\"i0\" class=\"altColor\">\n"
+                + "<td class=\"colFirst\"><code><a href=\"../pkg/ObjectProperty.html\" "
+                + "title=\"class in pkg\">ObjectProperty</a>&lt;<a href=\"../pkg/MyObj.html\" "
+                + "title=\"class in pkg\">MyObj</a>[]&gt;</code></td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg/MyClass.html#badProperty--\">badProperty</a></span>()</code></th>"
         );
 
         checkOutput("pkg/MyClassT.html", true,