From da077b2e268825b60735e199fceea109cedbfcbf Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Wed, 4 Oct 2017 10:44:21 -0700 Subject: [PATCH] 8186703: javadoc needs a test to verify member hiding Reviewed-by: jjg --- .../doclet/testInterface/TestInterface.java | 35 ++++++++++++++++--- ...ethod.java => ClassWithStaticMembers.java} | 17 ++++++--- ...d.java => InterfaceWithStaticMembers.java} | 14 +++++--- 3 files changed, 53 insertions(+), 13 deletions(-) rename test/langtools/jdk/javadoc/doclet/testInterface/pkg/{ClassWithStaticMethod.java => ClassWithStaticMembers.java} (71%) rename test/langtools/jdk/javadoc/doclet/testInterface/pkg/{InterfaceWithStaticMethod.java => InterfaceWithStaticMembers.java} (79%) diff --git a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java index 0e6345a0170..9b7e7c3f12e 100644 --- a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java +++ b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java @@ -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 class TestInterface extends JavadocTester { "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. "
Specified by:
\n"); + + checkOutput("pkg/ClassWithStaticMembers.html", true, + "

f

\n" + + "
public static int f
\n" + + "
A hider field
", + + "static void\n" + + "" + + "m()\n" + + "\n" + + "
A hider method
\n" + + "\n", + + "

staticMethod

\n" + + "
public static void staticMethod()
\n" + + "
" + + "Description copied from interface: " + + "" + + "InterfaceWithStaticMembers
\n" + + "
A static method
\n"); + + checkOutput("pkg/ClassWithStaticMembers.InnerClass.html", true, + "
public static class "
+                + "ClassWithStaticMembers.InnerClass\n"
+                + "extends java.lang.Object
\n" + + "
A hider inner class
"); } @Test @@ -155,8 +182,8 @@ public class TestInterface extends JavadocTester { checkOutput("pkg2/Spliterator.OfDouble.html", true, // Ensure the correct type parameters are displayed correctly "

Nested classes/interfaces inherited from interface pkg2." - + "Spliterator

\n" + - "" + + "Spliterator\n" + + "" + "Spliterator.OfDouble, Spliterator.OfInt<" + "" diff --git a/test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMethod.java b/test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMembers.java similarity index 71% rename from test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMethod.java rename to test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMembers.java index db4e0315c24..159d329e805 100644 --- a/test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMethod.java +++ b/test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMembers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -23,9 +23,18 @@ package pkg; -public class ClassWithStaticMethod implements InterfaceWithStaticMethod { +public class ClassWithStaticMembers implements InterfaceWithStaticMembers { - public static void staticMethod() { - } + /** 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() {} } diff --git a/test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMethod.java b/test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMembers.java similarity index 79% rename from test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMethod.java rename to test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMembers.java index 2442ce390df..4da861917ae 100644 --- a/test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMethod.java +++ b/test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMembers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -23,10 +23,14 @@ package pkg; -public interface InterfaceWithStaticMethod { +public interface InterfaceWithStaticMembers { - /** - * A static method - */ + /** A static nested class */ + static class InnerClass {} + + /** A static field */ + static int f = 0; + + /** A static method */ static void staticMethod() { } }