8265684: implement Sealed Classes as a standard feature in Java, javadoc changes

Reviewed-by: jjg
This commit is contained in:
Vicente Romero 2021-05-20 09:23:14 +00:00
parent 0fa9223f34
commit 7dcb9fda89
17 changed files with 62 additions and 176 deletions

@ -27,6 +27,7 @@ package jdk.javadoc.internal.doclets.formats.html;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
@ -84,8 +85,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
"java.lang.constant.ConstantDesc",
"java.io.Serializable");
private static final Set<String> previewModifiers
= Set.of("sealed", "non-sealed");
private static final Set<String> previewModifiers = Collections.emptySet();
protected final TypeElement typeElement;
@ -196,7 +196,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
return typeElement;
}
@Override @SuppressWarnings("preview")
@Override
public void addClassSignature(String modifiers, Content classInfoTree) {
ContentBuilder mods = new ContentBuilder();
String sep = null;

@ -1686,7 +1686,6 @@ public class HtmlDocletWriter {
*
* @return the text, with all the relative links redirected to work.
*/
@SuppressWarnings("preview")
private String redirectRelativeLinks(Element element, TextTree tt) {
String text = tt.getBody();
if (element == null || utils.isOverviewElement(element) || shouldNotRedirectRelativeLinks()) {
@ -2232,7 +2231,6 @@ public class HtmlDocletWriter {
}
}
@SuppressWarnings("preview")
private List<Content> getPreviewNotes(TypeElement el) {
String className = el.getSimpleName().toString();
List<Content> result = new ArrayList<>();
@ -2257,9 +2255,6 @@ public class HtmlDocletWriter {
}
previewLanguageFeatures.addAll(utils.previewLanguageFeaturesUsed(el));
if (!previewLanguageFeatures.isEmpty()) {
if (previewLanguageFeatures.contains(DeclarationPreviewLanguageFeatures.SEALED_PERMITS)) {
previewLanguageFeatures.remove(DeclarationPreviewLanguageFeatures.SEALED);
}
for (DeclarationPreviewLanguageFeatures feature : previewLanguageFeatures) {
String featureDisplayName =
resources.getText("doclet.Declared_Using_Preview." + feature.name());

@ -109,7 +109,6 @@ public class Signatures {
return this;
}
@SuppressWarnings("preview")
public Content toContent() {
Content content = new ContentBuilder();
Content annotationInfo = classWriter.getAnnotationInfo(typeElement, true);
@ -185,10 +184,6 @@ public class Signatures {
if (isFirst) {
content.add(DocletConstants.NL);
permitsSpan.add("permits");
Content link =
classWriter.links.createLink(classWriter.htmlIds.forPreviewSection(typeElement),
classWriter.contents.previewMark);
permitsSpan.add(HtmlTree.SUP(link));
permitsSpan.add(" ");
isFirst = false;
} else {
@ -209,7 +204,6 @@ public class Signatures {
return HtmlTree.DIV(HtmlStyle.typeSignature, content);
}
@SuppressWarnings("preview")
private Content getRecordComponents() {
Content content = new ContentBuilder();
content.add("(");

@ -287,7 +287,6 @@ public class TagletWriterImpl extends TagletWriter {
}
@Override
@SuppressWarnings("preview")
public Content paramTagOutput(Element element, ParamTree paramTag, String paramName) {
ContentBuilder body = new ContentBuilder();
CommentHelper ch = utils.getCommentHelper(element);
@ -461,7 +460,6 @@ public class TagletWriterImpl extends TagletWriter {
return htmlWriter.getCurrentPageElement();
}
@SuppressWarnings("preview")
private Content createAnchorAndSearchIndex(Element element, String tagText, String desc, DocTree tree) {
Content result = null;
if (context.isFirstSentence && context.inSummary || context.inTags.contains(DocTree.Kind.INDEX)) {

@ -625,7 +625,6 @@ public abstract class BaseConfiguration {
* Splits the elements in a collection to its individual
* collection.
*/
@SuppressWarnings("preview")
private static class Splitter {
final Set<ModuleElement> mset = new LinkedHashSet<>();

@ -205,7 +205,6 @@ public class CommentUtils {
* Generates the description for the standard {@code equals} method for a record.
* @param ee the {@code equals} method
*/
@SuppressWarnings("preview")
public void setRecordEqualsTree(ExecutableElement ee) {
List<DocTree> fullBody = new ArrayList<>();
add(fullBody, "doclet.record_equals_doc.fullbody.head");

@ -450,7 +450,6 @@ public class ClassBuilder extends AbstractBuilder {
* @param elem the record element
*/
@SuppressWarnings("preview")
private void setRecordDocumentation(TypeElement elem) {
CommentUtils cmtUtils = configuration.cmtUtils;
Set<Name> componentNames = elem.getRecordComponents().stream()

@ -133,7 +133,6 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
}
@Override
@SuppressWarnings("preview")
public Content getAllBlockTagOutput(Element holder, TagletWriter writer) {
Utils utils = writer.configuration().utils;
if (utils.isExecutableElement(holder)) {

@ -353,7 +353,6 @@ public class TagletManager {
* @param trees the trees containing the comments
* @param inlineTrees true if the trees are inline and false otherwise
*/
@SuppressWarnings("preview")
public void checkTags(Element element, Iterable<? extends DocTree> trees, boolean inlineTrees) {
if (trees == null) {
return;

@ -483,7 +483,6 @@ public class ClassUseMapper {
private <T extends Element> void mapTypeParameters(final Map<TypeElement, List<T>> map,
Element element, final T holder) {
@SuppressWarnings("preview")
SimpleElementVisitor14<Void, Void> elementVisitor
= new SimpleElementVisitor14<Void, Void>() {
@ -561,7 +560,6 @@ public class ClassUseMapper {
* @param e whose type parameters are being checked.
* @param holder owning the type parameters.
*/
@SuppressWarnings("preview")
private <T extends Element> void mapAnnotations(final Map<TypeElement, List<T>> map,
Element e, final T holder) {
new SimpleElementVisitor14<Void, Void>() {

@ -511,7 +511,6 @@ public class Comparators {
};
}
@SuppressWarnings("preview")
boolean hasParameters(Element e) {
return new SimpleElementVisitor14<Boolean, Void>() {
@Override
@ -533,7 +532,6 @@ public class Comparators {
* @return a negative integer, zero, or a positive integer as the first argument is less
* than, equal to, or greater than the second.
*/
@SuppressWarnings("preview")
private String getFullyQualifiedName(Element e) {
return new SimpleElementVisitor14<String, Void>() {
@Override

@ -348,7 +348,6 @@ public class IndexItem {
};
}
@SuppressWarnings("preview")
protected Category getCategory(Element element) {
return new SimpleElementVisitor14<Category, Void>() {
@Override

@ -34,6 +34,7 @@ import java.text.ParseException;
import java.text.RuleBasedCollator;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
@ -54,6 +55,7 @@ import java.util.TreeMap;
import java.util.TreeSet;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.lang.model.AnnotatedConstruct;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.AnnotationMirror;
@ -488,7 +490,6 @@ public class Utils {
return configuration.workArounds.definesSerializableFields( aclass);
}
@SuppressWarnings("preview")
public String modifiersToString(Element e, boolean trailingSpace) {
SortedSet<Modifier> modifiers = new TreeSet<>(e.getModifiers());
modifiers.remove(NATIVE);
@ -2988,29 +2989,12 @@ public class Utils {
* @param e the Element to check.
* @return the set of preview language features used to declare the given element
*/
@SuppressWarnings("preview")
public Set<DeclarationPreviewLanguageFeatures> previewLanguageFeaturesUsed(Element e) {
Set<DeclarationPreviewLanguageFeatures> result = new HashSet<>();
if ((e.getKind().isClass() || e.getKind().isInterface()) &&
e.getModifiers().contains(Modifier.SEALED)) {
List<? extends TypeMirror> permits = ((TypeElement) e).getPermittedSubclasses();
boolean hasLinkablePermits = permits.stream()
.anyMatch(t -> isLinkable(asTypeElement(t)));
if (hasLinkablePermits) {
result.add(DeclarationPreviewLanguageFeatures.SEALED_PERMITS);
} else {
result.add(DeclarationPreviewLanguageFeatures.SEALED);
}
}
return result;
return new HashSet<>();
}
public enum DeclarationPreviewLanguageFeatures {
SEALED(List.of("sealed")),
SEALED_PERMITS(List.of("sealed", "permits"));
NONE(List.of(""));
public final List<String> features;
DeclarationPreviewLanguageFeatures(List<String> features) {
@ -3018,7 +3002,6 @@ public class Utils {
}
}
@SuppressWarnings("preview")
public PreviewSummary declaredUsingPreviewAPIs(Element el) {
List<TypeElement> usedInDeclaration = new ArrayList<>();
usedInDeclaration.addAll(annotations2Classes(el));

@ -784,7 +784,6 @@ public class VisibleMemberTable {
}
}
@SuppressWarnings("preview")
String getMemberKey(Element e) {
return new SimpleElementVisitor14<String, Void>() {
@Override

@ -977,7 +977,6 @@ public class ElementsTable {
return (xclasses || toolEnv.getFileKind(te) == SOURCE) && isSelected(te);
}
@SuppressWarnings("preview")
SimpleElementVisitor14<Boolean, Void> visibleElementVisitor = null;
/**
* Returns true if the element is selected, by applying
@ -989,7 +988,6 @@ public class ElementsTable {
* @param e the element to be checked
* @return true if the element is visible
*/
@SuppressWarnings("preview")
public boolean isSelected(Element e) {
if (toolEnv.isSynthetic((Symbol) e)) {
return false;
@ -1029,7 +1027,6 @@ public class ElementsTable {
return visibleElementVisitor.visit(e);
}
@SuppressWarnings("preview")
private class IncludedVisitor extends SimpleElementVisitor14<Boolean, Void> {
private final Set<Element> includedCache;

@ -56,35 +56,16 @@ public class TestPreview extends JavadocTester {
"m/pkg");
checkExit(Exit.OK);
ResourceBundle bundle = ResourceBundle.getBundle("jdk.javadoc.internal.doclets.formats.html.resources.standard", ModuleLayer.boot().findModule("jdk.javadoc").get());
{
String zero = MessageFormat.format(bundle.getString("doclet.PreviewLeadingNote"), "<code>TestPreviewDeclaration</code>");
String one = MessageFormat.format(bundle.getString("doclet.Declared_Using_Preview"), "<code>TestPreviewDeclaration</code>", "<em>Sealed Classes</em>", "<code>sealed</code>");
String two = MessageFormat.format(bundle.getString("doclet.PreviewTrailingNote1"), "<code>TestPreviewDeclaration</code>");
String three = MessageFormat.format(bundle.getString("doclet.PreviewTrailingNote2"), new Object[0]);
String expectedTemplate = """
<div class="preview-block" id="preview-pkg.TestPreviewDeclaration"><span class="preview-label">{0}</span>
<ul class="preview-comment">
<li>{1}</li>
</ul>
<div class="preview-comment">{2}</div>
<div class="preview-comment">{3}</div>
</div>""";
String expected = MessageFormat.format(expectedTemplate, zero, one, two, three);
checkOutput("m/pkg/TestPreviewDeclaration.html", true, expected);
}
checkOutput("m/pkg/TestPreviewDeclarationUse.html", true,
"<code><a href=\"TestPreviewDeclaration.html\" title=\"interface in pkg\">TestPreviewDeclaration</a><sup><a href=\"TestPreviewDeclaration.html#preview-pkg.TestPreviewDeclaration\">PREVIEW</a></sup></code>");
"<code><a href=\"TestPreviewDeclaration.html\" title=\"interface in pkg\">TestPreviewDeclaration</a></code>");
checkOutput("m/pkg/TestPreviewAPIUse.html", true,
"<a href=\"" + doc + "java.base/preview/Core.html\" title=\"class or interface in preview\" class=\"external-link\">Core</a><sup><a href=\"" + doc + "java.base/preview/Core.html#preview-preview.Core\" title=\"class or interface in preview\" class=\"external-link\">PREVIEW</a>");
checkOutput("m/pkg/DocAnnotation.html", true,
"<div class=\"preview-block\" id=\"preview-pkg.DocAnnotation\"><span class=\"preview-label\">");
"<span class=\"modifiers\">public @interface </span><span class=\"element-name type-name-label\">DocAnnotation</span>");
checkOutput("m/pkg/DocAnnotationUse1.html", true,
"<div class=\"preview-block\" id=\"preview-pkg.DocAnnotationUse1\"><span class=\"preview-label\">");
"<div class=\"inheritance\">pkg.DocAnnotationUse1</div>");
checkOutput("m/pkg/DocAnnotationUse2.html", true,
"<div class=\"preview-block\" id=\"preview-pkg.DocAnnotationUse2\"><span class=\"preview-label\">");
"<div class=\"inheritance\">pkg.DocAnnotationUse2</div>");
}
@Test

@ -54,15 +54,13 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"-sourcepath", src.toString(),
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> class </span><span class="element-name type-name-\
label">A</span>""");
<div class="type-signature"><span class="modifiers">public sealed class </span><span class="element-name type-name-label">A</span>
""");
}
@Test
@ -73,15 +71,13 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"-sourcepath", src.toString(),
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> interface </span><span class="element-name type-n\
ame-label">A</span>""");
<div class="type-signature"><span class="modifiers">public sealed interface </span><span class="element-name type-name-label">A</span></div>
""");
}
@Test
@ -93,21 +89,18 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"--source-path", src.toString(),
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> class </span><span class="element-name type-name-\
label">A</span>""");
<div class="type-signature"><span class="modifiers">public sealed class </span><span class="element-name type-name-label">A</span>
""");
checkOutput("p/B.html", true,
"""
<div class="type-signature"><span class="modifiers">public non-sealed<sup><a hre\
f="#preview-p.B">PREVIEW</a></sup> class </span><span class="element-name type-n\
ame-label">B</span>""");
<div class="type-signature"><span class="modifiers">public non-sealed class </span><span class="element-name type-name-label">B</span>
""");
}
@Test
@ -119,21 +112,19 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"--source-path", src.toString(),
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> interface </span><span class="element-name type-n\
ame-label">A</span>""");
<div class="type-signature"><span class="modifiers">public sealed interface </span><span class="element-name type-name-label">A</span>
""");
checkOutput("p/B.html", true,
"""
<div class="type-signature"><span class="modifiers">public non-sealed<sup><a hre\
f="#preview-p.B">PREVIEW</a></sup> interface </span><span class="element-name ty\
pe-name-label">B</span>""");
<div class="type-signature"><span class="modifiers">public non-sealed interface </span><span class="element-name type-name-label">B</span><span class="extends-implements">
extends <a href="A.html" title="interface in p">A</a></span></div>
""");
}
@Test
@ -145,21 +136,18 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"--source-path", src.toString(),
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> class </span><span class="element-name type-name-\
label">A</span>""");
<div class="type-signature"><span class="modifiers">public sealed class </span><span class="element-name type-name-label">A</span>
""");
checkOutput("p/B.html", true,
"""
<div class="type-signature"><span class="modifiers">public abstract sealed<sup><\
a href="#preview-p.B">PREVIEW</a></sup> class </span><span class="element-name t\
ype-name-label">B</span>""");
<div class="type-signature"><span class="modifiers">public abstract sealed class </span><span class="element-name type-name-label">B</span>
""");
}
@Test
@ -171,21 +159,19 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"--source-path", src.toString(),
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> interface </span><span class="element-name type-n\
ame-label">A</span>""");
<div class="type-signature"><span class="modifiers">public sealed interface </span><span class="element-name type-name-label">A</span>
""");
checkOutput("p/B.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.B">PREVIEW</a></sup> interface </span><span class="element-name type-n\
ame-label">B</span>""");
<div class="type-signature"><span class="modifiers">public sealed interface </span><span class="element-name type-name-label">B</span><span class="extends-implements">
extends <a href="A.html" title="interface in p">A</a></span></div>
""");
}
@Test
@ -198,19 +184,15 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"--source-path", src.toString(),
"--no-platform-links",
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> class </span><span class="element-name type-name-\
label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits<sup><a href="#preview-p.A">PREVIEW</a></sup> <a hr\
ef="B.html" title="class in p">B</a><sup><a href="B.html#preview-p.B">PREVIEW</a\
></sup></span></div>""");
<div class="type-signature"><span class="modifiers">public sealed class </span><span class="element-name type-name-label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits <a href="B.html" title="class in p">B</a></span></div>
""");
}
@Test
@ -225,21 +207,15 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"--source-path", src.toString(),
"--no-platform-links",
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> class </span><span class="element-name type-name-\
label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits<sup><a href="#preview-p.A">PREVIEW</a></sup> <a hr\
ef="B.html" title="class in p">B</a><sup><a href="B.html#preview-p.B">PREVIEW</a\
></sup>, <a href="C.html" title="class in p">C</a><sup><a href="C.html#preview-p\
.C">PREVIEW</a></sup>, <a href="D.html" title="class in p">D</a><sup><a href="D.\
html#preview-p.D">PREVIEW</a></sup></span></div>""");
<div class="type-signature"><span class="modifiers">public sealed class </span><span class="element-name type-name-label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits <a href="B.html" title="class in p">B</a>, <a href="C.html" title="class in p">C</a>, <a href="D.html" title="class in p">D</a></span></div>
""");
}
@Test
@ -254,24 +230,18 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"--source-path", src.toString(),
"--no-platform-links",
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> class </span><span class="element-name type-name-\
label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits<sup><a href="#preview-p.A">PREVIEW</a></sup> <a hr\
ef="B.html" title="class in p">B</a><sup><a href="B.html#preview-p.B">PREVIEW</a\
></sup>, <a href="C.html" title="class in p">C</a><sup><a href="C.html#preview-p\
.C">PREVIEW</a></sup> <span class="permits-note">(not exhaustive)</span></span><\
/div>""");
<div class="type-signature"><span class="modifiers">public sealed class </span><span class="element-name type-name-label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits <a href="B.html" title="class in p">B</a>, <a href="C.html" title="class in p">C</a> <span class="permits-note">(not exhaustive)</span></span></div>
""");
}
// @Test // javac incorrectly rejects the source
@Test
public void testPartialMultiplePermitsWithSubtypes1(Path base) throws IOException {
Path src = base.resolve("src");
tb.writeJavaFiles(src,
@ -284,20 +254,16 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"--source-path", src.toString(),
"--enable-preview", "--source", thisRelease,
"--no-platform-links",
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview">PREVIEW</a></sup> class </span><span class="element-name type-name-labe\
l">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits<sup><a href="#preview">PREVIEW</a></sup> <a href="\
A.B.html" title="class in p">A.B</a><sup><a href="B.html#preview">PREVIEW</a></s\
up>, <a href="A.C.html" title="class in p">A.C</a><sup><a href="C.html#preview">\
PREVIEW</a></sup>, <a href="A.D.html" title="class in p">A.D</a></span></div>""");
<div class="type-signature"><span class="modifiers">public sealed class </span><span class="element-name type-name-label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits <a href="B.html" title="class in p">B</a>, <a href="C.html" title="class in p">C</a> <span class="permits-note">(not exhaustive)</span></span></div>
""");
}
@Test
@ -314,20 +280,15 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"--source-path", src.toString(),
"--no-platform-links",
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#prev\
iew-p.A">PREVIEW</a></sup> class </span><span class="element-name type-name-label">A\
</span>
<div class="type-signature"><span class="modifiers">public sealed class </span><span class="element-name type-name-label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits<sup><a href="#preview-p.A">PREVIEW</a></sup> <a href="\
B.html" title="class in p">B</a><sup><a href="B.html#preview-p.B">PREVIEW</a></sup>,\
<a href="C.html" title="class in p">C</a><sup><a href="C.html#preview-p.C">PREVIEW<\
/a></sup> <span class="permits-note">(not exhaustive)</span></span></div>""");
<span class="permits">permits <a href="B.html" title="class in p">B</a>, <a href="C.html" title="class in p">C</a> <span class="permits-note">(not exhaustive)</span></span></div>
""");
}
@Test
@ -343,21 +304,15 @@ public class TestSealedTypes extends JavadocTester {
"--source-path", src.toString(),
"--no-platform-links",
"-package",
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> class </span><span class="element-name type-name-\
label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits<sup><a href="#preview-p.A">PREVIEW</a></sup> <a hr\
ef="B.html" title="class in p">B</a><sup><a href="B.html#preview-p.B">PREVIEW</a\
></sup>, <a href="C.html" title="class in p">C</a><sup><a href="C.html#preview-p\
.C">PREVIEW</a></sup>, <a href="D.html" title="class in p">D</a><sup><a href="D.\
html#preview-p.D">PREVIEW</a></sup></span></div>""");
<div class="type-signature"><span class="modifiers">public sealed class </span><span class="element-name type-name-label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits <a href="B.html" title="class in p">B</a>, <a href="C.html" title="class in p">C</a>, <a href="D.html" title="class in p">D</a></span></div>
""");
}
@Test
@ -373,20 +328,14 @@ public class TestSealedTypes extends JavadocTester {
javadoc("-d", base.resolve("out").toString(),
"--source-path", src.toString(),
"--no-platform-links",
"--enable-preview", "--source", thisRelease,
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", true,
"""
<div class="type-signature"><span class="modifiers">public sealed<sup><a href="#\
preview-p.A">PREVIEW</a></sup> class </span><span class="element-name type-name-\
label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits<sup><a href="#preview-p.A">PREVIEW</a></sup> <a hr\
ef="A.B.html" title="class in p">A.B</a><sup><a href="A.B.html#preview-p.A.B">PR\
EVIEW</a></sup>, <a href="A.C.html" title="class in p">A.C</a><sup><a href="A.C.\
html#preview-p.A.C">PREVIEW</a></sup>, <a href="A.D.html" title="class in p">A.D\
</a><sup><a href="A.D.html#preview-p.A.D">PREVIEW</a></sup></span></div>""");
<div class="type-signature"><span class="modifiers">public sealed class </span><span class="element-name type-name-label">A</span>
<span class="extends-implements">extends java.lang.Object</span>
<span class="permits">permits <a href="A.B.html" title="class in p">A.B</a>, <a href="A.C.html" title="class in p">A.C</a>, <a href="A.D.html" title="class in p">A.D</a></span></div>
""");
}
}