Skip to content
Permalink
Browse files

8237383: Members inherited from non-public types are not included in …

…index

Reviewed-by: jjg
  • Loading branch information
hns committed Apr 8, 2020
1 parent 64957a1 commit cdb379e5b48e744177550ae035fec4f2685efde4
Showing with 1,021 additions and 895 deletions.
  1. +1 −1 ...vadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java
  2. +73 −202 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
  3. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java
  4. +5 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java
  5. +1 −1 ...are/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
  6. +3 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java
  7. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
  8. +6 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
  9. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java
  10. +14 −14 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
  11. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java
  12. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchIndexItems.java
  13. +3 −7 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java
  14. +3 −7 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java
  15. +2 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java
  16. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java
  17. +7 −5 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java
  18. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java
  19. +2 −2 ....javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java
  20. +1 −1 ...jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
  21. +2 −2 ...dk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
  22. +3 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java
  23. +3 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java
  24. +10 −8 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java
  25. +0 −10 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java
  26. +589 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Comparators.java
  27. +2 −5 ...jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java
  28. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java
  29. +64 −24 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java
  30. +104 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexItem.java
  31. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/TypeElementCatalog.java
  32. +30 −514 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
  33. +6 −53 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java
  34. +72 −7 test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java
  35. +2 −2 test/langtools/jdk/javadoc/doclet/testMemberInheritance/pkg2/UndocumentedGenericParent.java
@@ -90,7 +90,7 @@ protected Content getDeprecatedLink(Element member) {
deprecatedLinkContent.add(".");
deprecatedLinkContent.add(member.getSimpleName());
}
String signature = utils.flatSignature((ExecutableElement) member);
String signature = utils.flatSignature((ExecutableElement) member, typeElement);
if (signature.length() > 2) {
deprecatedLinkContent.add(Entity.ZERO_WIDTH_SPACE);
}
@@ -27,19 +27,18 @@

import java.io.IOException;
import java.io.Writer;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.SimpleElementVisitor14;

import com.sun.source.doctree.DocTree;
import jdk.javadoc.internal.doclets.formats.html.SearchIndexItem.Category;
@@ -55,6 +54,7 @@
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
import jdk.javadoc.internal.doclets.toolkit.util.IndexItem;

/**
* Generate Index for all the Member Names with Indexing in
@@ -96,80 +96,17 @@ protected AbstractIndexWriter(HtmlConfiguration configuration,
this.navBar = new Navigation(null, configuration, PageMode.INDEX, path);
Stream<SearchIndexItem> items =
searchItems.itemsOfCategories(Category.INDEX, Category.SYSTEM_PROPERTY)
.sorted(utils.makeGenericSearchIndexComparator());
.sorted(comparators.makeGenericSearchIndexComparator());
this.tagSearchIndexMap = buildSearchTagIndex(items);
}

/**
* Add the member information for the unicode character along with the
* list of the members.
*
* @param uc Unicode for which member list information to be generated
* @param memberlist List of members for the unicode character
* @param contentTree the content tree to which the information will be added
*/
protected void addContents(Character uc, Collection<? extends Element> memberlist,
protected void addContents(Character uc, List<IndexItem> memberlist,
Content contentTree) {
addHeading(uc, contentTree);
// Display the list only if there are elements to be displayed.
if (!memberlist.isEmpty()) {
HtmlTree dl = HtmlTree.DL(HtmlStyle.index);
for (Element element : memberlist) {
addDescription(dl, element);
}
contentTree.add(dl);
}
}

protected void addSearchContents(Character uc, List<SearchIndexItem> searchList,
Content contentTree) {
addHeading(uc, contentTree);
// Display the list only if there are elements to be displayed.
if (!searchList.isEmpty()) {
HtmlTree dl = HtmlTree.DL(HtmlStyle.index);
for (SearchIndexItem sii : searchList) {
addDescription(sii, dl);
}
contentTree.add(dl);
}
}

protected void addContents(Character uc, List<? extends Element> memberlist,
List<SearchIndexItem> searchList, Content contentTree) {
addHeading(uc, contentTree);
int memberListSize = memberlist.size();
int searchListSize = searchList.size();
int i = 0;
int j = 0;
HtmlTree dl = HtmlTree.DL(HtmlStyle.index);
while (i < memberListSize && j < searchListSize) {
Element elem = memberlist.get(i);
String name = (utils.isModule(elem))
? utils.getFullyQualifiedName(elem) : utils.getSimpleName(elem);
if (name.compareTo(searchList.get(j).getLabel()) < 0) {
addDescription(dl, memberlist.get(i));
i++;
} else if (name.compareTo(searchList.get(j).getLabel()) > 0) {
addDescription(searchList.get(j), dl);
j++;
} else {
addDescription(dl, memberlist.get(i));
addDescription(searchList.get(j), dl);
j++;
i++;
}
}
if (i >= memberListSize) {
while (j < searchListSize) {
addDescription(searchList.get(j), dl);
j++;
}
}
if (j >= searchListSize) {
while (i < memberListSize) {
addDescription(dl, memberlist.get(i));
i++;
}
for (IndexItem indexItem : memberlist) {
addDescription(indexItem, dl);
}
contentTree.add(dl);
}
@@ -183,109 +120,78 @@ protected void addHeading(Character uc, Content contentTree) {
contentTree.add(heading);
}

@SuppressWarnings("preview")
protected void addDescription(Content dl, Element element) {
SearchIndexItem si = new SearchIndexItem();
new SimpleElementVisitor14<Void, Void>() {

@Override
public Void visitModule(ModuleElement e, Void p) {
if (configuration.showModules) {
addDescription(e, dl, si);
searchItems.add(si);
}
return null;
}

@Override
public Void visitPackage(PackageElement e, Void p) {
addDescription(e, dl, si);
searchItems.add(si);
return null;
}

@Override
public Void visitType(TypeElement e, Void p) {
addDescription(e, dl, si);
searchItems.add(si);
return null;
}

@Override
protected Void defaultAction(Element e, Void p) {
addDescription(e, dl, si);
searchItems.add(si);
return null;
}

}.visit(element);
protected void addDescription(IndexItem indexItem, Content dl) {
SearchIndexItem si = indexItem.getSearchTag();
if (si != null) {
addDescription(si, dl);
} else {
si = new SearchIndexItem();
si.setLabel(indexItem.getLabel());
addElementDescription(indexItem, dl, si);
searchItems.add(si);
}
}

/**
* Add one line summary comment for the module.
* Add one line summary comment for the element.
*
* @param mdle the module to be documented
* @param indexItem the element to be documented
* @param dlTree the content tree to which the description will be added
* @param si the search index item
*/
protected void addDescription(ModuleElement mdle, Content dlTree, SearchIndexItem si) {
String moduleName = utils.getFullyQualifiedName(mdle);
Content link = getModuleLink(mdle, new StringContent(moduleName));
si.setLabel(moduleName);
si.setCategory(Category.MODULES);
Content dt = HtmlTree.DT(link);
dt.add(" - ");
dt.add(contents.module_);
dt.add(" " + moduleName);
dlTree.add(dt);
Content dd = new HtmlTree(TagName.DD);
addSummaryComment(mdle, dd);
dlTree.add(dd);
}

/**
* Add one line summary comment for the package.
*
* @param pkg the package to be documented
* @param dlTree the content tree to which the description will be added
* @param si the search index item to be updated
*/
protected void addDescription(PackageElement pkg, Content dlTree, SearchIndexItem si) {
Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
if (configuration.showModules) {
si.setContainingModule(utils.getFullyQualifiedName(utils.containingModule(pkg)));
protected void addElementDescription(IndexItem indexItem, Content dlTree, SearchIndexItem si) {
Content dt;
Element element = indexItem.getElement();
String label = indexItem.getLabel();
switch (element.getKind()) {
case MODULE:
dt = HtmlTree.DT(getModuleLink((ModuleElement)element, new StringContent(label)));
si.setCategory(Category.MODULES);
dt.add(" - ").add(contents.module_).add(" " + label);
break;
case PACKAGE:
dt = HtmlTree.DT(getPackageLink((PackageElement)element, new StringContent(label)));
if (configuration.showModules) {
si.setContainingModule(utils.getFullyQualifiedName(utils.containingModule(element)));
}
si.setCategory(Category.PACKAGES);
dt.add(" - ").add(contents.package_).add(" " + label);
break;
case CLASS:
case ENUM:
case ANNOTATION_TYPE:
case INTERFACE:
dt = HtmlTree.DT(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.INDEX, (TypeElement)element).strong(true)));
si.setContainingPackage(utils.getPackageName(utils.containingPackage(element)));
si.setCategory(Category.TYPES);
dt.add(" - ");
addClassInfo((TypeElement)element, dt);
break;
default:
TypeElement containingType = indexItem.getTypeElement();
dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.memberNameLink,
getDocLink(LinkInfoImpl.Kind.INDEX, containingType, element, new StringContent(label))));
si.setContainingPackage(utils.getPackageName(utils.containingPackage(element)));
si.setContainingClass(utils.getSimpleName(containingType));
if (utils.isExecutableElement(element)) {
String url = HtmlTree.encodeURL(links.getName(getAnchor((ExecutableElement)element)));
if (!label.equals(url)) {
si.setUrl(url);
}
}
si.setCategory(Category.MEMBERS);
dt.add(" - ");
addMemberDesc(element, containingType, dt);
break;
}
si.setLabel(utils.getPackageName(pkg));
si.setCategory(Category.PACKAGES);
Content dt = HtmlTree.DT(link);
dt.add(" - ");
dt.add(contents.package_);
dt.add(" " + utils.getPackageName(pkg));
dlTree.add(dt);
Content dd = new HtmlTree(TagName.DD);
addSummaryComment(pkg, dd);
dlTree.add(dd);
}

/**
* Add one line summary comment for the class.
*
* @param typeElement the class being documented
* @param dlTree the content tree to which the description will be added
* @param si the search index item to be updated
*/
protected void addDescription(TypeElement typeElement, Content dlTree, SearchIndexItem si) {
Content link = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.INDEX, typeElement).strong(true));
si.setContainingPackage(utils.getPackageName(utils.containingPackage(typeElement)));
si.setLabel(utils.getSimpleName(typeElement));
si.setCategory(Category.TYPES);
Content dt = HtmlTree.DT(link);
dt.add(" - ");
addClassInfo(typeElement, dt);
dlTree.add(dt);
Content dd = new HtmlTree(TagName.DD);
addComment(typeElement, dd);
if (element.getKind() == ElementKind.MODULE || element.getKind() == ElementKind.PACKAGE) {
addSummaryComment(element, dd);
} else {
addComment(element, dd);
}
dlTree.add(dd);
}

@@ -304,41 +210,6 @@ protected void addClassInfo(TypeElement te, Content contentTree) {
));
}

/**
* Add description for Class, Field, Method or Constructor.
*
* @param member the member of the Class Kind
* @param dlTree the content tree to which the description will be added
* @param si search index item
*/
protected void addDescription(Element member, Content dlTree, SearchIndexItem si) {

si.setContainingPackage(utils.getPackageName(utils.containingPackage(member)));
si.setContainingClass(utils.getSimpleName(utils.getEnclosingTypeElement(member)));
String name = utils.getSimpleName(member);
if (utils.isExecutableElement(member)) {
ExecutableElement ee = (ExecutableElement)member;
name = name + utils.flatSignature(ee);
si.setLabel(name);
String url = HtmlTree.encodeURL(links.getName(getAnchor(ee)));
if (!name.equals(url)) {
si.setUrl(url);
}
} else {
si.setLabel(name);
}
si.setCategory(Category.MEMBERS);
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
Content dt = HtmlTree.DT(span);
dt.add(" - ");
addMemberDesc(member, dt);
dlTree.add(dt);
Content dd = new HtmlTree(TagName.DD);
addComment(member, dd);
dlTree.add(dd);
}

protected void addDescription(SearchIndexItem sii, Content dlTree) {
String siiPath = pathToRoot.isEmpty() ? "" : pathToRoot.getPath() + "/";
siiPath += sii.getUrl();
@@ -394,12 +265,12 @@ protected void addComment(Element element, Content contentTree) {
* Add description about the Static Variable/Method/Constructor for a
* member.
*
* @param member MemberDoc for the member within the Class Kind
* @param member element for the member
* @param enclosing the enclosing type element
* @param contentTree the content tree to which the member description will be added
*/
protected void addMemberDesc(Element member, Content contentTree) {
TypeElement containing = utils.getEnclosingTypeElement(member);
String classdesc = utils.getTypeElementName(containing, true) + " ";
protected void addMemberDesc(Element member, TypeElement enclosing, Content contentTree) {
String classdesc = utils.getTypeElementName(enclosing, true) + " ";
if (utils.isField(member)) {
Content resource = contents.getContent(utils.isStatic(member)
? "doclet.Static_variable_in"
@@ -414,7 +285,7 @@ protected void addMemberDesc(Element member, Content contentTree) {
: "doclet.Method_in", classdesc);
contentTree.add(resource);
}
addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, enclosing,
false, contentTree);
}

@@ -135,7 +135,7 @@ protected void addExtendsImplements(TypeElement parent,
TypeElement typeElement,
Content contentTree)
{
SortedSet<TypeElement> interfaces = new TreeSet<>(utils.makeGeneralPurposeComparator());
SortedSet<TypeElement> interfaces = new TreeSet<>(comparators.makeGeneralPurposeComparator());
typeElement.getInterfaces().forEach(t -> interfaces.add(utils.asTypeElement(t)));
if (interfaces.size() > (utils.isInterface(typeElement) ? 1 : 0)) {
boolean isFirst = true;

0 comments on commit cdb379e

Please sign in to comment.