Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8250768: javac should be adapted to changes in JEP 12
Reviewed-by: mcimadamore, erikj, jjg, ihse
  • Loading branch information
Jan Lahoda committed Jan 11, 2021
1 parent 18a37f9 commit 235488215bb1e71174abff34192ab222c2c7047a
Showing with 3,107 additions and 1,078 deletions.
  1. +5 −5 make/CompileInterimLangtools.gmk
  2. +0 −1 make/Docs.gmk
  3. +3 −0 make/autoconf/spec.gmk.in
  4. +0 −79 make/jdk/src/classes/build/tools/taglet/Preview.java
  5. +15 −3 make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java
  6. +2 −3 make/modules/jdk.compiler/Gendata.gmk
  7. +1 −2 make/modules/jdk.javadoc/Gendata.gmk
  8. +3 −17 src/java.base/share/classes/java/lang/Class.java
  9. +6 −2 src/java.base/share/classes/jdk/internal/{ → javac}/PreviewFeature.java
  10. +2 −3 src/java.base/share/classes/module-info.java
  11. +5 −19 src/java.compiler/share/classes/javax/lang/model/element/Modifier.java
  12. +3 −9 src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java
  13. +3 −10 src/jdk.compiler/share/classes/com/sun/source/tree/ClassTree.java
  14. +5 −1 src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskPool.java
  15. +3 −3 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java
  16. +42 −10 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java
  17. +1 −1 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java
  18. +2 −2 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
  19. +2 −2 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
  20. +31 −16 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
  21. +2 −1 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java
  22. +3 −3 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
  23. +4 −2 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
  24. +3 −3 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
  25. +2 −2 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
  26. +23 −13 src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
  27. +17 −5 src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java
  28. +3 −3 src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java
  29. +8 −0 src/jdk.compiler/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java
  30. +10 −9 ...vadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java
  31. +13 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
  32. +9 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java
  33. +8 −3 ...are/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
  34. +3 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java
  35. +29 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
  36. +6 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java
  37. +9 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java
  38. +19 −350 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
  39. +8 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java
  40. +8 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java
  41. +10 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java
  42. +11 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java
  43. +11 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java
  44. +226 −16 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
  45. +38 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java
  46. +29 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkInfoImpl.java
  47. +8 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java
  48. +2 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
  49. +3 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
  50. +24 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Navigation.java
  51. +3 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java
  52. +3 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
  53. +93 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PreviewListWriter.java
  54. +7 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java
  55. +6 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Signatures.java
  56. +3 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java
  57. +303 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SummaryListWriter.java
  58. +15 −7 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java
  59. +13 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
  60. +2 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/TagName.java
  61. +19 −3 ...jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
  62. +9 −1 ...avadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeRequiredMemberWriter.java
  63. +9 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ConstructorWriter.java
  64. +8 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/EnumConstantWriter.java
  65. +9 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/FieldWriter.java
  66. +8 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MethodWriter.java
  67. +9 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/PropertyWriter.java
  68. +12 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java
  69. +12 −1 ...re/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
  70. +11 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java
  71. +11 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java
  72. +11 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java
  73. +11 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java
  74. +10 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java
  75. +2 −11 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties
  76. +16 −5 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
  77. +8 −7 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Comparators.java
  78. +12 −152 ...jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java
  79. +5 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocLink.java
  80. +4 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java
  81. +48 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/PreviewAPIListBuilder.java
  82. +225 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/SummaryAPIListBuilder.java
  83. +255 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
  84. +4 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java
  85. +5 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkInfo.java
  86. +2 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java
  87. +0 −8 src/jdk.jshell/share/classes/jdk/jshell/Snippet.java
  88. +2 −2 test/jdk/java/lang/invoke/defineHiddenClass/PreviewHiddenClass.java
  89. +2 −3 test/jdk/java/lang/ref/CleanerTest.java
  90. +1 −2 test/jdk/java/util/Arrays/TimSortStackSize2.java
  91. +1 −1 test/jdk/jdk/modules/etc/JdkQualifiedExportTest.java
  92. +18 −18 test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java
  93. +5 −5 test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java
  94. +3 −2 test/langtools/jdk/javadoc/doclet/testModules/TestModules.java
  95. +123 −0 test/langtools/jdk/javadoc/doclet/testPreview/TestPreview.java
  96. +30 −0 test/langtools/jdk/javadoc/doclet/testPreview/api/preview/Core.java
  97. +30 −0 test/langtools/jdk/javadoc/doclet/testPreview/api/preview/CoreRecord.java
  98. +29 −0 test/langtools/jdk/javadoc/doclet/testPreview/api/preview/CoreRecordComponent.java
  99. +30 −0 test/langtools/jdk/javadoc/doclet/testPreview/api/preview/Reflective.java
  100. +2 −0 test/langtools/jdk/javadoc/doclet/testPreview/doc/element-list
  101. 0 test/langtools/jdk/javadoc/doclet/testPreview/doc/java.base/preview/Core.html
  102. 0 test/langtools/jdk/javadoc/doclet/testPreview/doc/java.base/preview/Reflective.html
  103. +25 −0 test/langtools/jdk/javadoc/doclet/testPreview/m/module-info.java
  104. +35 −0 test/langtools/jdk/javadoc/doclet/testPreview/m/pkg/DocAnnotation.java
  105. +28 −0 test/langtools/jdk/javadoc/doclet/testPreview/m/pkg/DocAnnotationUse1.java
  106. +28 −0 test/langtools/jdk/javadoc/doclet/testPreview/m/pkg/DocAnnotationUse2.java
  107. +33 −0 test/langtools/jdk/javadoc/doclet/testPreview/m/pkg/TestPreviewAPIUse.java
  108. +28 −0 test/langtools/jdk/javadoc/doclet/testPreview/m/pkg/TestPreviewDeclaration.java
  109. +30 −0 test/langtools/jdk/javadoc/doclet/testPreview/m/pkg/TestPreviewDeclarationUse.java
  110. +3 −3 test/langtools/jdk/javadoc/doclet/testRecordTypes/TestRecordTypes.java
  111. +83 −54 test/langtools/jdk/javadoc/doclet/testSealedTypes/TestSealedTypes.java
  112. +2 −2 test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java
  113. +4 −1 test/langtools/jdk/javadoc/tool/CheckResourceKeys.java
  114. +1 −0 test/langtools/tools/javac/diags/examples.not-yet.txt
  115. +2 −2 ...s/tools/javac/diags/examples/CantExtendSealedInAnotherModule/CantExtendSealedInAnotherModule.java
  116. +2 −2 ...ngtools/tools/javac/diags/examples/CantExtendSealedInAnotherPkg/CantExtendSealedInAnotherPkg.java
  117. +2 −1 test/langtools/tools/javac/diags/examples/SealedTypes.java
  118. +4 −0 test/langtools/tools/javac/enum/FauxEnum3-preview.out
  119. +4 −0 test/langtools/tools/javac/lib/combo/ComboTask.java
  120. +1 −1 test/langtools/tools/javac/options/BCPOrSystemNotSpecified.java
  121. +0 −1 test/langtools/tools/javac/patterns/BreakAndLoops.java
  122. +1 −2 test/langtools/tools/javac/patterns/ConditionalTest.java
  123. +1 −1 test/langtools/tools/javac/patterns/PatternMatchPosTest.out
  124. +1 −1 test/langtools/tools/javac/platform/PreviewAPIsWithRelease.out
  125. +5 −0 test/langtools/tools/javac/preview/DeclaredUsingPreview-class.out
  126. +7 −0 test/langtools/tools/javac/preview/DeclaredUsingPreview-source.out
  127. +11 −0 test/langtools/tools/javac/preview/DeclaredUsingPreview.java
  128. +5 −0 test/langtools/tools/javac/preview/DeclaredUsingPreviewDeclarations.java
  129. +222 −0 test/langtools/tools/javac/preview/PreviewAutoSuppress.java
  130. +372 −101 test/langtools/tools/javac/preview/PreviewErrors.java
  131. +21 −21 test/langtools/tools/javac/processing/model/element/TestSealed.java
  132. +3 −1 test/langtools/tools/javac/sealed/SealedDiffConfigurationsTest.java
  133. +1 −1 test/langtools/tools/jdeps/listdeps/ListModuleDeps.java
@@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2021, 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
@@ -49,8 +49,8 @@ TARGETS += $(patsubst %, $(BUILDTOOLS_OUTPUTDIR)/gensrc/%/module-info.java, \
$(INTERIM_LANGTOOLS_MODULES))

$(eval $(call SetupCopyFiles, COPY_PREVIEW_FEATURES, \
FILES := $(TOPDIR)/src/java.base/share/classes/jdk/internal/PreviewFeature.java, \
DEST := $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/, \
FILES := $(TOPDIR)/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java, \
DEST := $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/javac/, \
))

TARGETS += $(COPY_PREVIEW_FEATURES)
@@ -81,8 +81,8 @@ define SetupInterimModule
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
$$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
--add-exports java.base/jdk.internal=java.compiler.interim \
--add-exports java.base/jdk.internal=jdk.compiler.interim, \
--add-exports java.base/jdk.internal.javac=java.compiler.interim \
--add-exports java.base/jdk.internal.javac=jdk.compiler.interim, \
))

$1_DEPS_INTERIM := $$(addsuffix .interim, $$(filter \
@@ -89,7 +89,6 @@ JAVADOC_TAGS := \
-tag see \
-taglet build.tools.taglet.ExtLink \
-taglet build.tools.taglet.Incubating \
-taglet build.tools.taglet.Preview \
-tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
$(CUSTOM_JAVADOC_TAGS) \
#
@@ -658,13 +658,16 @@ INTERIM_LANGTOOLS_ADD_EXPORTS := \
--add-exports java.base/jdk.internal.jmod=jdk.compiler.interim \
--add-exports java.base/jdk.internal.misc=jdk.compiler.interim \
--add-exports java.base/sun.invoke.util=jdk.compiler.interim \
--add-exports java.base/jdk.internal.javac=java.compiler.interim \
--add-exports java.base/jdk.internal.javac=jdk.compiler.interim \
#
INTERIM_LANGTOOLS_MODULES_COMMA := $(strip $(subst $(SPACE),$(COMMA),$(strip \
$(INTERIM_LANGTOOLS_MODULES))))
INTERIM_LANGTOOLS_ARGS := \
--limit-modules java.base,jdk.zipfs,$(INTERIM_LANGTOOLS_MODULES_COMMA) \
--add-modules $(INTERIM_LANGTOOLS_MODULES_COMMA) \
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
#
JAVAC_MAIN_CLASS = -m jdk.compiler.interim/com.sun.tools.javac.Main

This file was deleted.

@@ -1112,20 +1112,32 @@ private Annotation[][] createParameterAnnotations(List<CPInfo> constantPool, Lis

private Annotation createAnnotation(List<CPInfo> constantPool, AnnotationDescription desc) {
String annotationType = desc.annotationType;
Map<String, Object> values = desc.values;

if (PREVIEW_FEATURE_ANNOTATION.equals(annotationType)) {
if (PREVIEW_FEATURE_ANNOTATION_NEW.equals(annotationType)) {
//the non-public PreviewFeature annotation will not be available in ct.sym,
//replace with purely synthetic javac-internal annotation:
annotationType = PREVIEW_FEATURE_ANNOTATION_INTERNAL;
}

if (PREVIEW_FEATURE_ANNOTATION_OLD.equals(annotationType)) {
//the non-public PreviewFeature annotation will not be available in ct.sym,
//replace with purely synthetic javac-internal annotation:
annotationType = PREVIEW_FEATURE_ANNOTATION_INTERNAL;
values = new HashMap<>(values);
Boolean essentialAPI = (Boolean) values.remove("essentialAPI");
values.put("reflective", essentialAPI != null && !essentialAPI);
}

return new Annotation(null,
addString(constantPool, annotationType),
createElementPairs(constantPool, desc.values));
createElementPairs(constantPool, values));
}
//where:
private static final String PREVIEW_FEATURE_ANNOTATION =
private static final String PREVIEW_FEATURE_ANNOTATION_OLD =
"Ljdk/internal/PreviewFeature;";
private static final String PREVIEW_FEATURE_ANNOTATION_NEW =
"Ljdk/internal/javac/PreviewFeature;";
private static final String PREVIEW_FEATURE_ANNOTATION_INTERNAL =
"Ljdk/internal/PreviewFeature+Annotation;";

@@ -1,5 +1,5 @@
#
# Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2021, 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
@@ -44,7 +44,7 @@ CT_MODULESOURCEPATH := $(call GetModuleSrcPath)
CT_DATA_DESCRIPTION += $(TOPDIR)/make/data/symbols/symbols

COMPILECREATESYMBOLS_ADD_EXPORTS := \
--add-exports java.base/jdk.internal=java.compiler.interim,jdk.compiler.interim \
--add-exports java.base/jdk.internal.javac=java.compiler.interim,jdk.compiler.interim \
--add-exports jdk.compiler.interim/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler.interim/com.sun.tools.javac.code=ALL-UNNAMED \
--add-exports jdk.compiler.interim/com.sun.tools.javac.util=ALL-UNNAMED \
@@ -60,7 +60,6 @@ $(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \
DISABLED_WARNINGS := options, \
JAVAC_FLAGS := \
$(INTERIM_LANGTOOLS_ARGS) \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
$(COMPILECREATESYMBOLS_ADD_EXPORTS), \
))

@@ -1,5 +1,5 @@
#
# Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2021, 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
@@ -58,7 +58,6 @@ $(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \
DISABLED_WARNINGS := options, \
JAVAC_FLAGS := \
$(INTERIM_LANGTOOLS_ARGS) \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
$(COMPILECREATESYMBOLS_ADD_EXPORTS), \
))

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2021, 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
@@ -4387,13 +4387,6 @@ public Optional<ClassDesc> describeConstable() {
public native boolean isHidden();

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This method is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Returns an array containing {@code Class} objects representing the
* direct subinterfaces or subclasses permitted to extend or
* implement this class or interface if it is sealed. The order of such elements
@@ -4429,7 +4422,7 @@ public Optional<ClassDesc> describeConstable() {
* @jls 9.1 Interface Declarations
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES, essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES, reflective=true)
@CallerSensitive
public Class<?>[] getPermittedSubclasses() {
Class<?>[] subClasses;
@@ -4469,13 +4462,6 @@ private boolean isDirectSubType(Class<?> c) {
}

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This method is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Returns {@code true} if and only if this {@code Class} object represents
* a sealed class or interface. If this {@code Class} object represents a
* primitive type, {@code void}, or an array type, this method returns
@@ -4489,7 +4475,7 @@ private boolean isDirectSubType(Class<?> c) {
* @jls 9.1 Interface Declarations
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES, essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES, reflective=true)
@SuppressWarnings("preview")
public boolean isSealed() {
if (isArray() || isPrimitive()) {
@@ -23,7 +23,7 @@
* questions.
*/

package jdk.internal;
package jdk.internal.javac;

import java.lang.annotation.*;

@@ -51,7 +51,7 @@
*/
public Feature feature();

public boolean essentialAPI() default false;
public boolean reflective() default false;

public enum Feature {
// 8242284:
@@ -68,6 +68,10 @@ public enum Feature {
// necessary for PreviewFeature in JDK 16 to declare the enum constant.
RECORDS,
SEALED_CLASSES,
/**
* A key for testing.
*/
TEST,
;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
@@ -138,10 +138,9 @@
jdk.incubator.foreign;
exports com.sun.security.ntlm to
java.security.sasl;
exports jdk.internal to // for @HotSpotIntrinsicCandidate
exports jdk.internal.javac to
java.compiler,
jdk.compiler,
jdk.incubator.vector,
jdk.jshell;
exports jdk.internal.access to
java.desktop,
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, 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
@@ -66,33 +66,19 @@ public enum Modifier {
/** The modifier {@code static} */ STATIC,

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This enum constant is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* The modifier {@code sealed}
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES,
reflective=true)
SEALED,

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This enum constant is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* The modifier {@code non-sealed}
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES,
reflective=true)
NON_SEALED {
public String toString() {
return "non-sealed";
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, 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
@@ -199,12 +199,6 @@ default List<? extends RecordComponentElement> getRecordComponents() {
}

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This method is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
* Returns the permitted classes of this class or interface
* element in declaration order.
*
@@ -215,8 +209,8 @@ default List<? extends RecordComponentElement> getRecordComponents() {
*
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES,
reflective=true)
default List<? extends TypeMirror> getPermittedSubclasses() {
return List.of();
}

0 comments on commit 2354882

Please sign in to comment.