diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/package-info.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/package-info.java
index 0c7157807e..26cf40285e 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/package-info.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/package-info.java
@@ -25,7 +25,7 @@
/**
* Doclets provide the user-selectable backends for processing the
- * documentation comnments in Java source code.
+ * documentation comments in Java source code.
*
*
Doclets are implementations of the {@link jdk.javadoc.doclet Doclet API}.
*
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
index bc4ac0bed5..b2ab20b7aa 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
@@ -320,7 +320,7 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
//necessary.
DocFinder.Output inheritedDoc =
DocFinder.search(configuration,
- new DocFinder.Input(utils, (ExecutableElement) member));
+ new DocFinder.Input(utils, member));
if (inheritedDoc.holder != null
&& !utils.getFirstSentenceTrees(inheritedDoc.holder).isEmpty()) {
// let the comment helper know of the overridden element
@@ -473,7 +473,7 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
private void addSummaryFootNote(TypeElement inheritedClass, SortedSet inheritedMembers,
Content linksTree, MemberSummaryWriter writer) {
for (Element member : inheritedMembers) {
- TypeElement t = (utils.isPackagePrivate(inheritedClass) && !utils.isLinkable(inheritedClass))
+ TypeElement t = utils.isUndocumentedEnclosure(inheritedClass)
? typeElement : inheritedClass;
writer.addInheritedMemberSummary(t, member, inheritedMembers.first() == member,
inheritedMembers.last() == member, linksTree);
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
index b8cb56117b..ddf1ccb62e 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
@@ -529,6 +529,10 @@ public class Utils {
return true;
}
+ public boolean isUndocumentedEnclosure(TypeElement enclosingTypeElement) {
+ return isPackagePrivate(enclosingTypeElement) && !isLinkable(enclosingTypeElement);
+ }
+
public boolean isError(TypeElement te) {
if (isEnum(te) || isInterface(te) || isAnnotationType(te)) {
return false;
@@ -1064,8 +1068,7 @@ public class Utils {
// Allow for the behavior that members of undocumented supertypes
// may be included in documented types
- TypeElement enclElem = getEnclosingTypeElement(elem);
- if (typeElem != enclElem && isSubclassOf(typeElem, enclElem)) {
+ if (isUndocumentedEnclosure(getEnclosingTypeElement(elem))) {
return true;
}
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java
index b4516fd5be..3d8c399840 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java
@@ -209,7 +209,7 @@ public class VisibleMemberTable {
public List extends Element> getVisibleMembers(Kind kind) {
Predicate declaredAndLeafMembers = e -> {
TypeElement encl = utils.getEnclosingTypeElement(e);
- return encl == te || isUndocumentedEnclosure(encl);
+ return encl == te || utils.isUndocumentedEnclosure(encl);
};
return getVisibleMembers(kind, declaredAndLeafMembers);
}
@@ -238,7 +238,8 @@ public class VisibleMemberTable {
ensureInitialized();
OverridingMethodInfo found = overriddenMethodTable.get(e);
- if (found != null && (found.simpleOverride || isUndocumentedEnclosure(utils.getEnclosingTypeElement(e)))) {
+ if (found != null
+ && (found.simpleOverride || utils.isUndocumentedEnclosure(utils.getEnclosingTypeElement(e)))) {
return found.overrider;
}
return null;
@@ -347,10 +348,6 @@ public class VisibleMemberTable {
return pm == null ? null : pm.setter;
}
- boolean isUndocumentedEnclosure(TypeElement encl) {
- return utils.isPackagePrivate(encl) && !utils.isLinkable(encl);
- }
-
private void computeParents() {
for (TypeMirror intfType : te.getInterfaces()) {
TypeElement intfc = utils.asTypeElement(intfType);
@@ -388,7 +385,7 @@ public class VisibleMemberTable {
private void computeLeafMembers(LocalMemberTable lmt, Kind kind) {
List list = new ArrayList<>();
- if (isUndocumentedEnclosure(te)) {
+ if (utils.isUndocumentedEnclosure(te)) {
list.addAll(lmt.getOrderedMembers(kind));
}
parents.forEach(pvmt -> {
@@ -617,7 +614,7 @@ public class VisibleMemberTable {
// Disallow package-private super methods to leak in
TypeElement encl = utils.getEnclosingTypeElement(inheritedMethod);
- if (isUndocumentedEnclosure(encl)) {
+ if (utils.isUndocumentedEnclosure(encl)) {
overriddenMethodTable.computeIfAbsent(lMethod,
l -> new OverridingMethodInfo(inheritedMethod, false));
return false;
diff --git a/test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java b/test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java
index 8079ca63ad..fac023e6e4 100644
--- a/test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java
+++ b/test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java
@@ -24,7 +24,7 @@
/*
* @test
* @bug 4638588 4635809 6256068 6270645 8025633 8026567 8162363 8175200
- * 8192850 8182765
+ * 8192850 8182765 8220217
* @summary Test to make sure that members are inherited properly in the Javadoc.
* Verify that inheritance labels are correct.
* @author jamieh
@@ -47,7 +47,7 @@ public class TestMemberInheritance extends JavadocTester {
public void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
- "pkg", "diamond", "inheritDist", "pkg1");
+ "pkg", "diamond", "inheritDist", "pkg1", "pkg2");
checkExit(Exit.OK);
checkOutput("pkg/SubClass.html", true,
@@ -104,5 +104,27 @@ public class TestMemberInheritance extends JavadocTester {
+ "between
"
);
+
+ checkOutput("pkg2/DocumentedNonGenericChild.html", true,
+ "\n
\n"
+ + "public abstract class "
+ + "DocumentedNonGenericChild\n"
+ + "extends java.lang.Object
\n"
+ + "");
+
+ checkOutput("pkg2/DocumentedNonGenericChild.html", true,
+ "protected abstract java.lang.String | \n"
+ + ""
+ + "parentMethod() | \n"
+ + "\n"
+ + " Returns some value. \n"
+ + " | \n");
+
+ checkOutput("pkg2/DocumentedNonGenericChild.html", true,
+ "\n"
+ + "protected abstract"
+ + " java.lang.String "
+ + "parentMethod()
");
+
}
}
diff --git a/test/langtools/jdk/javadoc/doclet/testMemberInheritance/pkg2/DocumentedNonGenericChild.java b/test/langtools/jdk/javadoc/doclet/testMemberInheritance/pkg2/DocumentedNonGenericChild.java
new file mode 100644
index 0000000000..f6d77985e6
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testMemberInheritance/pkg2/DocumentedNonGenericChild.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2019, 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 pkg2;
+
+public abstract class DocumentedNonGenericChild extends UndocumentedGenericParent {
+
+}
diff --git a/test/langtools/jdk/javadoc/doclet/testMemberInheritance/pkg2/UndocumentedGenericParent.java b/test/langtools/jdk/javadoc/doclet/testMemberInheritance/pkg2/UndocumentedGenericParent.java
new file mode 100644
index 0000000000..511a71f195
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testMemberInheritance/pkg2/UndocumentedGenericParent.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2019, 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 pkg2;
+
+abstract class UndocumentedGenericParent {
+ /**
+ * Returns some value.
+ *
+ * @return some value
+ */
+ protected abstract String parentMethod();
+}