8193671: Default Methods tab under Method Summary includes static methods

Reviewed-by: jjg
This commit is contained in:
Kumar Srinivasan 2018-01-03 15:16:46 -08:00
parent c83a45ddf9
commit 64e992633f
5 changed files with 48 additions and 18 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@ -264,8 +264,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
.addTab(resources.getText("doclet.Abstract_Methods"), utils::isAbstract)
.addTab(resources.getText("doclet.Concrete_Methods"),
e -> !utils.isAbstract(e) && !utils.isInterface(e.getEnclosingElement()))
.addTab(resources.getText("doclet.Default_Methods"),
e -> !utils.isAbstract(e) && utils.isInterface(e.getEnclosingElement()))
.addTab(resources.getText("doclet.Default_Methods"), utils::isDefault)
.addTab(resources.getText("doclet.Deprecated_Methods"),
e -> utils.isDeprecated(e) || utils.isDeprecated(typeElement))
.setTabScriptVariable("methods")

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, 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,8 +23,8 @@
/*
* @test
* @bug 8002304 8024096
* @summary Test for various method types in the method summary table
* @bug 8002304 8024096 8193671
* @summary Test for various method type tabs in the method summary table
* @author Bhavesh Patel
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -62,13 +62,18 @@ public class TestMethodTypes extends JavadocTester {
"<tr id=\"i0\" class=\"altColor\">");
checkOutput("pkg1/B.html", true,
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All "
+ "Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">"
+ "Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+ "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "</caption>");
"var methods = {\"i0\":6,\"i1\":18,\"i2\":18,\"i3\":1,\"i4\":1,"
+ "\"i5\":6,\"i6\":6,\"i7\":6,\"i8\":6};\n",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Methods</span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t1\" class=\"tableTab\">"
+ "<span><a href=\"javascript:show(1);\">Static Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t2\" class=\"tableTab\">"
+ "<span><a href=\"javascript:show(2);\">Instance Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" class=\"tableTab\">"
+ "<span><a href=\"javascript:show(4);\">Abstract Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t5\" class=\"tableTab\">"
+ "<span><a href=\"javascript:show(16);\">Default Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span></caption>\n");
checkOutput("pkg1/D.html", true,
"var methods = {",

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, 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
@ -44,6 +44,7 @@ public class A {
/**
* This is the third concrete instance method.
* @return a string
*/
public String getParameter() {
return "test";

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, 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
@ -24,8 +24,8 @@
package pkg1;
/**
* This interface has different types of methods such as "Instance Methods" and
* "Abstract Methods". All the tabs will display same list of methods.
* This interface has different types of methods such as "Static Methods",
* "Instance Methods", "Abstract Methods", "Default Methods".
*/
public interface B {
@ -36,21 +36,45 @@ public interface B {
/**
* This is the second abstract instance method.
* @return a string
*/
public String getName();
/**
* This is the third abstract instance method.
* @return a boolean value
*/
public boolean addEntry();
/**
* This is the fourth abstract instance method.
* @return a boolean value
*/
public boolean removeEntry();
/**
* This is the fifth abstract instance method.
* @return a string
*/
public String getPermissions();
/**
* A static interface method.
*/
public static void aStaticMethod() {}
/**
* Another static interface method.
*/
public static void anotherStaticMethod() {}
/**
* A default method.
*/
public default void aDefaultMethod() {}
/**
* Another default method.
*/
public default void anotherDefaultMethod() {}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, 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
@ -46,6 +46,7 @@ public abstract class D {
/**
* This is the second concrete instance method.
* @return a string
*/
public String getParameter() {
return "test";