8139101: javadoc emits "specified by" clause when class has a method that matches a static interface method

Reviewed-by: jjg, ksrini
This commit is contained in:
Bhavesh Patel 2016-12-05 15:08:24 -08:00
parent 04f289629a
commit 5ef4598ec8
4 changed files with 71 additions and 3 deletions

View File

@ -364,10 +364,10 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
*/
protected static void addImplementsInfo(HtmlDocletWriter writer,
ExecutableElement method, Content dl) {
if (writer.configuration.nocomment) {
Utils utils = writer.utils;
if (utils.isStatic(method) || writer.configuration.nocomment) {
return;
}
Utils utils = writer.utils;
Contents contents = writer.contents;
ImplementedMethods implementedMethodsFinder =
new ImplementedMethods(method, writer.configuration);

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 4682448 4947464 5029946 8025633 8026567 8035473
* @bug 4682448 4947464 5029946 8025633 8026567 8035473 8139101
* @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
@ -121,6 +121,11 @@ public class TestInterface extends JavadocTester {
checkOutput("pkg/Interface.html", false,
"public int method()",
"public static final int field");
checkOutput("pkg/ClassWithStaticMethod.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");
}
@Test

View File

@ -0,0 +1,31 @@
/*
* 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() {
}
}

View File

@ -0,0 +1,32 @@
/*
* 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() { }
}