JDK-8199281 : Broken link in nav bar "Summary: ... METHOD" when it points to inherited methods of super class.
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 10,11
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2018-03-08
  • Updated: 2018-03-22
  • Resolved: 2018-03-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11Resolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
In some case javadoc generate broken link in nav bar.

click on "METHODS" in Summary section of nav bar on following pages 
api/jdk.dynalink/jdk/dynalink/support/SimpleRelinkableCallSite.html
api/java.naming/javax/naming/ldap/InitialLdapContext.html 
<a href="#methods.inherited.from.class.javax.naming.directory.InitialDirContext">Method</a>
Comments
Will be fixed as a part of JDK-8196200
22-03-2018

Will be fixed as a part of JDK-8196200
22-03-2018

Regression test, we need to add a 3rd case, which has no inherited or local methods, so the navbar summary links are greyed out. diff --git a/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java b/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java --- a/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java +++ b/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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,7 +23,8 @@ /* * @test - * @bug 4131628 4664607 7025314 8023700 7198273 8025633 8026567 8081854 8150188 8151743 + * @bug 4131628 4664607 7025314 8023700 7198273 8025633 8026567 8081854 + * 8150188 8151743 8199281 * @summary Make sure the Next/Prev Class links iterate through all types. * Make sure the navagation is 2 columns, not 3. * @author jamieh @@ -184,4 +185,26 @@ + "</script>\n" + "</nav>"); } + + @Test + void test4() { + javadoc("-d", "out-4", + "-sourcepath", testSrc, + "pkg1"); + checkExit(Exit.OK); + + checkOrder("pkg1/A.X.html", + "Summary", + "#nested.class.summary", "Nested", + "#field.summary", "Field", + "#constructor.summary", "Constr", + "#method.summary", "Method"); + + checkOrder("pkg1/A.Y.html", + "Summary", + "#nested.class.summary", "Nested", + "#field.summary", "Field", + "#constructor.summary", "Constr", + "#method.summary", "Method"); + } } diff --git a/test/langtools/jdk/javadoc/doclet/testNavigation/pkg1/A.java b/test/langtools/jdk/javadoc/doclet/testNavigation/pkg1/A.java new file mode 100644 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testNavigation/pkg1/A.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package pkg1; + +public class A { + + /** + * Class with members. + */ + public static class X { + /** + * A ctor + */ + public X() {} + + /** + * A field + */ + public int field; + + /** + * A method + */ + public void method(){} + + /** + * An inner class + */ + public static class IC {} + } + + /** + * Class with all inherited members. + */ + public static class Y extends X {} +}
15-03-2018

A possible fix. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java @@ -498,14 +498,23 @@ return; } - TypeElement superClass = utils.getSuperClass(typeElement); - while (superClass != null) { - if (visibleMemberMap.hasMembers(superClass)) { - liNav.addContent(getNavSummaryLink(superClass, true)); + SortedSet<TypeElement> visibleClasses = visibleMemberMap.getVisibleClasses(); + for (TypeElement t : visibleClasses) { + if (!configuration.getVisibleMemberMap(t, visibleMemberMap.kind).getLeafMembers().isEmpty()) { + liNav.addContent(getNavSummaryLink(null, true)); return; } - superClass = utils.getSuperClass(superClass); } + + +// TypeElement superClass = utils.getSuperClass(typeElement); +// while (superClass != null) { +// if (visibleMemberMap.hasMembers(superClass)) { +// liNav.addContent(getNavSummaryLink(superClass, true)); +// return; +// } +// superClass = utils.getSuperClass(superClass); +// } liNav.addContent(getNavSummaryLink(null, false)); }
15-03-2018

This one is caused by fix for JDK-8157000, where the inherited/declared type has disappeared, and will be fixed by JDK-8025091.
09-03-2018