# HG changeset patch
# User ksrini
# Date 1515101530 28800
# Node ID 3b00541635f9cd4ba58593ed6f6f157f28a93cef
# Parent 9c37fbceb5791e3519b33e6e0cf7501e6c5e1188
8193671: Default Methods tab under Method Summary includes static methods
Reviewed-by: jjg
diff -r 9c37fbceb579 -r 3b00541635f9 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java Thu Jan 04 12:55:06 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java Thu Jan 04 13:32:10 2018 -0800
@@ -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 @@
.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")
diff -r 9c37fbceb579 -r 3b00541635f9 test/langtools/jdk/javadoc/doclet/testMethodTypes/TestMethodTypes.java
--- a/test/langtools/jdk/javadoc/doclet/testMethodTypes/TestMethodTypes.java Thu Jan 04 12:55:06 2018 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testMethodTypes/TestMethodTypes.java Thu Jan 04 13:32:10 2018 -0800
@@ -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 @@
"
");
checkOutput("pkg1/B.html", true,
- "All "
- + "Methods "
- + ""
- + "Instance Methods "
- + ""
- + "Abstract Methods "
- + "");
+ "var methods = {\"i0\":6,\"i1\":18,\"i2\":18,\"i3\":1,\"i4\":1,"
+ + "\"i5\":6,\"i6\":6,\"i7\":6,\"i8\":6};\n",
+ "All Methods"
+ + " "
+ + "Static Methods"
+ + " "
+ + "Instance Methods"
+ + " "
+ + "Abstract Methods"
+ + " "
+ + "Default Methods"
+ + " \n");
checkOutput("pkg1/D.html", true,
"var methods = {",
diff -r 9c37fbceb579 -r 3b00541635f9 test/langtools/jdk/javadoc/doclet/testMethodTypes/pkg1/A.java
--- a/test/langtools/jdk/javadoc/doclet/testMethodTypes/pkg1/A.java Thu Jan 04 12:55:06 2018 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testMethodTypes/pkg1/A.java Thu Jan 04 13:32:10 2018 -0800
@@ -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 @@
/**
* This is the third concrete instance method.
+ * @return a string
*/
public String getParameter() {
return "test";
diff -r 9c37fbceb579 -r 3b00541635f9 test/langtools/jdk/javadoc/doclet/testMethodTypes/pkg1/B.java
--- a/test/langtools/jdk/javadoc/doclet/testMethodTypes/pkg1/B.java Thu Jan 04 12:55:06 2018 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testMethodTypes/pkg1/B.java Thu Jan 04 13:32:10 2018 -0800
@@ -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 @@
/**
* 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() {}
}
diff -r 9c37fbceb579 -r 3b00541635f9 test/langtools/jdk/javadoc/doclet/testMethodTypes/pkg1/D.java
--- a/test/langtools/jdk/javadoc/doclet/testMethodTypes/pkg1/D.java Thu Jan 04 12:55:06 2018 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testMethodTypes/pkg1/D.java Thu Jan 04 13:32:10 2018 -0800
@@ -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 @@
/**
* This is the second concrete instance method.
+ * @return a string
*/
public String getParameter() {
return "test";