changeset 52174:8f93292c2a51

8211901: javadoc generates broken links on deprecated items page Reviewed-by: jjg
author pmuthuswamy
date Wed, 17 Oct 2018 15:28:36 +0530
parents e4b9475b0508
children c2672a0f233a
files src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/BaseClass.java test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/SubClass.java
diffstat 5 files changed, 103 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Wed Oct 17 16:37:41 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Wed Oct 17 15:28:36 2018 +0530
@@ -1485,7 +1485,7 @@
             return false;
         }
 
-        if (!getBlockTags(m).isEmpty())
+        if (!getBlockTags(m).isEmpty() || isDeprecated(m))
             return false;
 
         List<? extends DocTree> fullBody = getFullBody(m);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java	Wed Oct 17 16:37:41 2018 +0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java	Wed Oct 17 15:28:36 2018 +0530
@@ -248,7 +248,7 @@
      * @param e the method to check
      * @return the overridden method or null
      */
-    public ExecutableElement getsimplyOverriddenMethod(ExecutableElement e) {
+    public ExecutableElement getSimplyOverriddenMethod(ExecutableElement e) {
         ensureInitialized();
 
         OverridingMethodInfo found = overriddenMethodTable.get(e);
@@ -869,7 +869,7 @@
     public List<ExecutableElement> getImplementedMethods(ExecutableElement method) {
         ImplementedMethods imf = getImplementedMethodsFinder(method);
         return imf.getImplementedMethods().stream()
-                .filter(m -> getsimplyOverriddenMethod(m) == null)
+                .filter(m -> getSimplyOverriddenMethod(m) == null)
                 .collect(Collectors.toList());
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java	Wed Oct 17 15:28:36 2018 +0530
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 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
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8211901
+ * @summary  javadoc generates broken links on deprecated items page
+ * @library  ../lib
+ * @modules  jdk.javadoc/jdk.javadoc.internal.tool
+ * @build    JavadocTester
+ * @run main TestOverriddenDeprecatedMethods
+ */
+
+public class TestOverriddenDeprecatedMethods extends JavadocTester {
+
+    public static void main(String args[]) throws Exception {
+        TestOverriddenDeprecatedMethods tester = new TestOverriddenDeprecatedMethods();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-d", "out-deprecated",
+                "-sourcepath", testSrc,
+                "--override-methods","summary",
+                "pkg1");
+
+        checkExit(Exit.OK);
+
+        checkOrder("pkg1/SubClass.html",
+                "Method Summary",
+                "Methods declared in class&nbsp;pkg1.<a href=\"BaseClass.html\" title=\"class in pkg1\">"
+                + "BaseClass</a>",
+                "<a href=\"BaseClass.html#func3()\">func3</a>");
+
+        checkOrder("pkg1/SubClass.html",
+                "Method Detail",
+                "@Deprecated\npublic&nbsp;void&nbsp;func1()",
+                "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>",
+                "@Deprecated\npublic&nbsp;void&nbsp;func2()",
+                "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>",
+                "<div class=\"block\">deprecated with comments</div>");
+    }
+}
--- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/BaseClass.java	Wed Oct 17 16:37:41 2018 +0800
+++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/BaseClass.java	Wed Oct 17 15:28:36 2018 +0530
@@ -50,4 +50,22 @@
    */
   public void overridenMethodWithDocsToCopy() {}
 
+  /**
+   * @deprecated func1 deprecated
+   */
+  @Deprecated
+  public void func1() {}
+
+  /**
+   * @deprecated func2 deprecated
+   */
+  @Deprecated
+  public void func2() {}
+
+  /**
+   * @deprecated func3 deprecated
+   */
+  @Deprecated
+  public void func3() {}
+
 }
--- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/SubClass.java	Wed Oct 17 16:37:41 2018 +0800
+++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/SubClass.java	Wed Oct 17 15:28:36 2018 +0530
@@ -48,4 +48,22 @@
   public void privateMethod() {}
 
   public void overridenMethodWithDocsToCopy() {}
+
+  /**
+   * {@inheritDoc}
+   */
+  @Deprecated
+  public void func1() {}
+
+  /**
+   * deprecated with comments
+   */
+  @Deprecated
+  public void func2() {}
+
+  /**
+   * {@inheritDoc}
+   */
+  public void func3() {}
+
 }