--- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java 2019-10-30 16:23:44.055748660 -0700 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java 2019-10-30 16:23:43.763748670 -0700 @@ -35,6 +35,7 @@ import javax.lang.model.element.Element; import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; +import javax.lang.model.element.RecordComponentElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.SimpleElementVisitor8; @@ -210,7 +211,7 @@ /** * {@inheritDoc} */ - @Override + @Override @SuppressWarnings("preview") public void addClassSignature(String modifiers, Content classInfoTree) { Content hr = new HtmlTree(HtmlTag.HR); classInfoTree.add(hr); @@ -231,6 +232,9 @@ span.add(parameterLinks); pre.add(span); } + if (utils.isRecord(typeElement)) { + pre.add(getRecordComponents(typeElement)); + } if (!utils.isInterface(typeElement)) { TypeMirror superclass = utils.getFirstVisibleSuperClass(typeElement); if (superclass != null) { @@ -266,6 +270,26 @@ classInfoTree.add(pre); } + @SuppressWarnings("preview") + private Content getRecordComponents(TypeElement typeElem) { + Content content = new ContentBuilder(); + content.add("("); + String sep = ""; + for (RecordComponentElement e : typeElement.getRecordComponents()) { + content.add(sep); + getAnnotations(e.getAnnotationMirrors(), false).stream() + .forEach(a -> { content.add(a); content.add(" "); }); + Content link = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RECORD_COMPONENT, + e.asType())); + content.add(link); + content.add(Entity.NO_BREAK_SPACE); + content.add(e.getSimpleName()); + sep = ", "; + } + content.add(")"); + return content; + } + /** * {@inheritDoc} */ @@ -294,9 +318,9 @@ * Get the class hierarchy tree for the given class. * * @param type the class to print the hierarchy for - * @return a content tree for class inheritence + * @return a content tree for class inheritance */ - private Content getClassInheritenceTree(TypeMirror type) { + private Content getClassInheritanceTree(TypeMirror type) { TypeMirror sup; HtmlTree classTree = null; do { @@ -347,19 +371,20 @@ if (!utils.isClass(typeElement)) { return; } - classContentTree.add(getClassInheritenceTree(typeElement.asType())); + classContentTree.add(getClassInheritanceTree(typeElement.asType())); } /** * {@inheritDoc} */ @Override - public void addTypeParamInfo(Content classInfoTree) { - if (!utils.getTypeParamTrees(typeElement).isEmpty()) { - Content typeParam = (new ParamTaglet()).getTagletOutput(typeElement, + public void addParamInfo(Content classInfoTree) { + if (utils.hasBlockTag(typeElement, DocTree.Kind.PARAM)) { + Content paramInfo = (new ParamTaglet()).getTagletOutput(typeElement, getTagletWriterInstance(false)); - Content dl = HtmlTree.DL(typeParam); - classInfoTree.add(dl); + if (!paramInfo.isEmpty()) { + classInfoTree.add(HtmlTree.DL(paramInfo)); + } } }