8186703: javadoc needs a test to verify member hiding
authorksrini
Wed, 04 Oct 2017 10:44:21 -0700
changeset 47311 ff631a3cadbc
parent 47310 eca11f20586e
child 47312 d4f959806fe9
8186703: javadoc needs a test to verify member hiding Reviewed-by: jjg
test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java
test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMembers.java
test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMethod.java
test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMembers.java
test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMethod.java
--- a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java	Wed Oct 04 01:08:36 2017 -0700
+++ b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java	Wed Oct 04 10:44:21 2017 -0700
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @bug      4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200 8186332
+ * @bug      4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200
+             8186332 8186703
  * @summary  Verify that the public modifier does not show up in the
  *           documentation for public methods, as recommended by the JLS.
  *           If A implements I and B extends A, B should be in the list of
@@ -122,10 +123,36 @@
                 "public int method()",
                 "public static final int field");
 
-        checkOutput("pkg/ClassWithStaticMethod.html", false,
+        checkOutput("pkg/ClassWithStaticMembers.html", false,
                 //Make sure "Specified By" does not appear on class documentation when
                 //the method is a static method in the interface.
                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n");
+
+        checkOutput("pkg/ClassWithStaticMembers.html", true,
+                "<h4>f</h4>\n"
+                + "<pre>public static&nbsp;int f</pre>\n"
+                + "<div class=\"block\">A hider field</div>",
+
+                "<td class=\"colFirst\"><code>static void</code></td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg/ClassWithStaticMembers.html#m--\">m</a></span>()</code></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">A hider method</div>\n"
+                + "</td>\n",
+
+                "<h4>staticMethod</h4>\n"
+                + "<pre>public static&nbsp;void&nbsp;staticMethod()</pre>\n"
+                + "<div class=\"block\"><span class=\"descfrmTypeLabel\">"
+                + "Description copied from interface:&nbsp;<code>"
+                + "<a href=\"../pkg/InterfaceWithStaticMembers.html#staticMethod--\">"
+                + "InterfaceWithStaticMembers</a></code></span></div>\n"
+                + "<div class=\"block\">A static method</div>\n");
+
+        checkOutput("pkg/ClassWithStaticMembers.InnerClass.html", true,
+                "<pre>public static class <span class=\"typeNameLabel\">"
+                + "ClassWithStaticMembers.InnerClass</span>\n"
+                + "extends java.lang.Object</pre>\n"
+                + "<div class=\"block\">A hider inner class</div>");
     }
 
     @Test
@@ -155,8 +182,8 @@
         checkOutput("pkg2/Spliterator.OfDouble.html", true,
             // Ensure the correct type parameters are displayed correctly
             "<h3>Nested classes/interfaces inherited from interface&nbsp;pkg2."
-            + "<a href=\"../pkg2/Spliterator.html\" title=\"interface in pkg2\">Spliterator</a></h3>\n" +
-            "<code><a href=\"../pkg2/Spliterator.OfDouble.html\" title=\"interface in pkg2\">"
+            + "<a href=\"../pkg2/Spliterator.html\" title=\"interface in pkg2\">Spliterator</a></h3>\n"
+            + "<code><a href=\"../pkg2/Spliterator.OfDouble.html\" title=\"interface in pkg2\">"
             + "Spliterator.OfDouble</a>, <a href=\"../pkg2/Spliterator.OfInt.html\" "
             + "title=\"interface in pkg2\">Spliterator.OfInt</a>&lt;"
             + "<a href=\"../pkg2/Spliterator.OfInt.html\" title=\"type parameter in Spliterator.OfInt\">"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMembers.java	Wed Oct 04 10:44:21 2017 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016, 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
+ * 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.
+ */
+
+package pkg;
+
+public class ClassWithStaticMembers implements InterfaceWithStaticMembers {
+
+    /** A hider inner class */
+    public static class InnerClass{}
+
+    /** A hider field */
+    public static int f = 1;
+
+    /** A hider method */
+    public static void m(){}
+
+    // no comment
+    public static void staticMethod() {}
+
+}
--- a/test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMethod.java	Wed Oct 04 01:08:36 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2016, 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.
- */
-
-package pkg;
-
-public class ClassWithStaticMethod implements InterfaceWithStaticMethod {
-
-    public static void staticMethod() {
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMembers.java	Wed Oct 04 10:44:21 2017 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2016, 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
+ * 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.
+ */
+
+package pkg;
+
+public interface InterfaceWithStaticMembers {
+
+    /** A static nested class */
+    static class InnerClass {}
+
+    /** A static field */
+    static int f = 0;
+
+    /** A static method */
+    static void staticMethod() { }
+}
--- a/test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMethod.java	Wed Oct 04 01:08:36 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2016, 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.
- */
-
-package pkg;
-
-public interface InterfaceWithStaticMethod {
-
-    /**
-     * A static method
-     */
-    static void staticMethod() { }
-}