< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java

Print this page

        

*** 31,40 **** --- 31,41 ---- import java.util.SortedSet; import java.util.TreeSet; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; + import javax.lang.model.element.ElementKind; import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.SimpleElementVisitor8;
*** 261,270 **** --- 262,294 ---- LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME, type)); pre.add(link); } } + List<? extends TypeMirror> permits = typeElement.getPermittedSubtypes(); + if (!permits.isEmpty()) { + boolean isFirst = true; + for (TypeMirror type : permits) { + TypeElement tDoc = utils.asTypeElement(type); + // Document all permitted subtypes, not just public linkable types, + // because it may be of interest to the reader that not all of the + // subtypes may be accessible: for example, in a pattern statement + // switching on the type of an object. + if (isFirst) { + pre.add(DocletConstants.NL); + pre.add("permits "); + isFirst = false; + } else { + pre.add(", "); + } + Content link = getLink(new LinkInfoImpl(configuration, + LinkInfoImpl.Kind.PERMITTED_SUBTYPES, + type)); + pre.add(link); + } + + } classInfoTree.add(pre); } /** * {@inheritDoc}
*** 292,304 **** /** * 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 */ ! private Content getClassInheritenceTree(TypeMirror type) { TypeMirror sup; HtmlTree classTree = null; do { sup = utils.getFirstVisibleSuperClass(type); HtmlTree htmlElement = HtmlTree.DIV(HtmlStyle.inheritance, getTreeForClassHelper(type)); --- 316,328 ---- /** * Get the class hierarchy tree for the given class. * * @param type the class to print the hierarchy for ! * @return a content tree for class inheritance */ ! private Content getClassInheritanceTree(TypeMirror type) { TypeMirror sup; HtmlTree classTree = null; do { sup = utils.getFirstVisibleSuperClass(type); HtmlTree htmlElement = HtmlTree.DIV(HtmlStyle.inheritance, getTreeForClassHelper(type));
*** 345,367 **** @Override public void addClassTree(Content classContentTree) { if (!utils.isClass(typeElement)) { return; } ! classContentTree.add(getClassInheritenceTree(typeElement.asType())); } /** * {@inheritDoc} */ @Override ! public void addTypeParamInfo(Content classInfoTree) { ! if (!utils.getTypeParamTrees(typeElement).isEmpty()) { ! Content typeParam = (new ParamTaglet()).getTagletOutput(typeElement, getTagletWriterInstance(false)); ! Content dl = HtmlTree.DL(typeParam); ! classInfoTree.add(dl); } } /** * {@inheritDoc} --- 369,392 ---- @Override public void addClassTree(Content classContentTree) { if (!utils.isClass(typeElement)) { return; } ! classContentTree.add(getClassInheritanceTree(typeElement.asType())); } /** * {@inheritDoc} */ @Override ! public void addParamInfo(Content classInfoTree) { ! if (utils.hasBlockTag(typeElement, DocTree.Kind.PARAM)) { ! Content paramInfo = (new ParamTaglet()).getTagletOutput(typeElement, getTagletWriterInstance(false)); ! if (!paramInfo.isEmpty()) { ! classInfoTree.add(HtmlTree.DL(paramInfo)); ! } } } /** * {@inheritDoc}
< prev index next >