CSR :
|
|
CSR :
|
|
Relates :
|
Summary ------- The Record Classes feature is now ready to be made final and permanent. `javax.lang.model` APIs have been modified to support Record Classes as a preview feature, making the feature standard in Java will affect these APIs. Problem ------- The preview status of `javax.lang.model` APIs that support the Record Classes feature should be updated so that they can be used in standard Java. Solution -------- Update `javax.lang.model` APIs that support the Record Classes feature so that they can be used in standard Java Specification ------------- diff --git a/src/java.compiler/share/classes/javax/lang/model/element/ElementKind.java b/src/java.compiler/share/classes/javax/lang/model/element/ElementKind.java index deb9f8006c6..db86b2fcfea 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/ElementKind.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/ElementKind.java @@ -110,33 +110,15 @@ MODULE, /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This enum constant is associated with <i>records</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.} - * * A record type. - * @since 14 + * @since 16 */ - @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) RECORD, /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This enum constant is associated with <i>records</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.} - * * A record component of a {@code record}. - * @since 14 + * @since 16 */ - @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) RECORD_COMPONENT, /** diff --git a/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java b/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java index dd37a25db4f..d640744009a 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java @@ -212,13 +212,6 @@ default R visitModule(ModuleElement e, P p) { } /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This method is associated with <i>records</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.} - * * Visits a record component element. * * @implSpec The default implementation visits a {@code @@ -227,11 +220,8 @@ default R visitModule(ModuleElement e, P p) { * @param e the element to visit * @param p a visitor-specified parameter * @return a visitor-specified result - * @since 14 + * @since 16 */ - @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) - @SuppressWarnings("preview") default R visitRecordComponent(RecordComponentElement e, P p) { return visitUnknown(e, p); } diff --git a/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java b/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java index be4bd7c2680..c4e781baade 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java @@ -26,19 +26,10 @@ package javax.lang.model.element; /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This class is associated with <i>records</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.} - * * Represents a record component. * - * @since 14 + * @since 16 */ -@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) public interface RecordComponentElement extends Element { /** * Returns the enclosing element of this record component. diff --git a/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java b/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java index 1899bd0dffd..4ad71283762 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java @@ -180,13 +180,6 @@ List<? extends TypeParameterElement> getTypeParameters(); /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This method is associated with <i>records</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 record components of this type element in * declaration order. * @@ -196,11 +189,8 @@ * @return the record components, or an empty list if there are * none * - * @since 14 + * @since 16 */ - @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) - @SuppressWarnings("preview") default List<? extends RecordComponentElement> getRecordComponents() { return List.of(); } diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java index 051479f9208..3f0126b2ce1 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java @@ -31,13 +31,6 @@ import static javax.lang.model.SourceVersion.*; /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This class is associated with <i>records</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.} - * * A skeletal visitor of program elements with default behavior * appropriate for the {@link SourceVersion#RELEASE_14 RELEASE_14} * source version. @@ -54,10 +47,8 @@ * @see AbstractElementVisitor7 * @see AbstractElementVisitor8 * @see AbstractElementVisitor9 - * @since 14 + * @since 16 */ -@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) @SupportedSourceVersion(RELEASE_16) public abstract class AbstractElementVisitor14<R, P> extends AbstractElementVisitor9<R, P> { /** @@ -77,7 +68,6 @@ protected AbstractElementVisitor14(){ * @param p {@inheritDoc} * @return {@inheritDoc} */ - @SuppressWarnings("preview") @Override public abstract R visitRecordComponent(RecordComponentElement t, P p); } diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java index a82d2e52b08..98cb0db7a81 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java @@ -112,42 +112,22 @@ private ElementFilter() {} // Do not instantiate. } /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This method is associated with <i>records</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 a list of record components in {@code elements}. * @return a list of record components in {@code elements} * @param elements the elements to filter - * @since 14 + * @since 16 */ - @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) - @SuppressWarnings("preview") public static List<RecordComponentElement> recordComponentsIn(Iterable<? extends Element> elements) { return listFilter(elements, RECORD_COMPONENT_KIND, RecordComponentElement.class); } /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This method is associated with <i>records</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 a set of record components in {@code elements}. * @return a set of record components in {@code elements} * @param elements the elements to filter - * @since 14 + * @since 16 */ - @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) - @SuppressWarnings("preview") public static Set<RecordComponentElement> recordComponentsIn(Set<? extends Element> elements) { return setFilter(elements, RECORD_COMPONENT_KIND, RecordComponentElement.class); diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java index 1e7c92e1567..fd96c6ecad6 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java @@ -31,13 +31,6 @@ import javax.lang.model.SourceVersion; /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This class is associated with <i>records</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.} - * * A visitor of program elements based on their {@linkplain * ElementKind kind} with default behavior appropriate for the {@link * SourceVersion#RELEASE_14 RELEASE_14} source version. @@ -66,10 +59,8 @@ * @see ElementKindVisitor7 * @see ElementKindVisitor8 * @see ElementKindVisitor9 - * @since 14 + * @since 16 */ -@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) @SupportedSourceVersion(RELEASE_16) public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> { /** @@ -99,7 +90,6 @@ protected ElementKindVisitor14(R defaultValue) { * @param p a visitor-specified parameter * @return the result of {@code defaultAction} */ - @SuppressWarnings("preview") @Override public R visitRecordComponent(RecordComponentElement e, P p) { return defaultAction(e, p); diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java index 356accba1e0..3d40feed869 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java @@ -217,13 +217,6 @@ public R visitTypeAsInterface(TypeElement e, P p) { } /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This method is associated with <i>records</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.} - * * Visits a {@code RECORD} type element. * * @implSpec This implementation calls {@code visitUnknown}. @@ -232,10 +225,8 @@ public R visitTypeAsInterface(TypeElement e, P p) { * @param p a visitor-specified parameter * @return the result of {@code visitUnknown} * - * @since 14 + * @since 16 */ - @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) public R visitTypeAsRecord(TypeElement e, P p) { return visitUnknown(e, p); } diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java index d0e92f911f5..5e5d484fa83 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java @@ -33,13 +33,6 @@ import static javax.lang.model.SourceVersion.*; /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This class is associated with <i>records</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.} - * * A scanning visitor of program elements with default behavior * appropriate for the {@link SourceVersion#RELEASE_14 RELEASE_14} * source version. @@ -81,10 +74,8 @@ * @see ElementScanner7 * @see ElementScanner8 * @see ElementScanner9 - * @since 14 + * @since 16 */ -@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) @SupportedSourceVersion(RELEASE_16) public class ElementScanner14<R, P> extends ElementScanner9<R, P> { /** @@ -156,7 +147,6 @@ public R visitExecutable(ExecutableElement e, P p) { * @param p a visitor-specified parameter * @return the result of the scan */ - @SuppressWarnings("preview") @Override public R visitRecordComponent(RecordComponentElement e, P p) { return scan(e.getEnclosedElements(), p); diff --git a/src/java.compiler/share/classes/javax/lang/model/util/Elements.java b/src/java.compiler/share/classes/javax/lang/model/util/Elements.java index 81344311869..f5957e6ce39 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/Elements.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/Elements.java @@ -634,13 +634,6 @@ boolean overrides(ExecutableElement overrider, ExecutableElement overridden, boolean isFunctionalInterface(TypeElement type); /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This method is associated with <i>records</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 record component for the given accessor. Returns null if the * given method is not a record component accessor. * @@ -655,11 +648,8 @@ boolean overrides(ExecutableElement overrider, ExecutableElement overridden, * @param accessor the method for which the record component should be found. * @return the record component, or null if the given method is not an record * component accessor - * @since 14 + * @since 16 */ - @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) - @SuppressWarnings("preview") default RecordComponentElement recordComponentFor(ExecutableElement accessor) { if (accessor.getEnclosingElement().getKind() == ElementKind.RECORD) { for (RecordComponentElement rec : ElementFilter.recordComponentsIn(accessor.getEnclosingElement().getEnclosedElements())) { diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java index 5d0768eb0b0..9150f27d0fe 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java @@ -31,13 +31,6 @@ import static javax.lang.model.SourceVersion.*; /** - * {@preview Associated with records, a preview feature of the Java language. - * - * This class is associated with <i>records</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.} - * * A simple visitor of program elements with default behavior * appropriate for the {@link SourceVersion#RELEASE_14 RELEASE_14} * source version. @@ -62,10 +55,8 @@ * @see SimpleElementVisitor7 * @see SimpleElementVisitor8 * @see SimpleElementVisitor9 - * @since 14 + * @since 16 */ -@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS, - essentialAPI=false) @SupportedSourceVersion(RELEASE_16) public class SimpleElementVisitor14<R, P> extends SimpleElementVisitor9<R, P> { /** @@ -96,7 +87,6 @@ protected SimpleElementVisitor14(R defaultValue){ * @param p a visitor-specified parameter * @return {@inheritDoc} */ - @SuppressWarnings("preview") @Override public R visitRecordComponent(RecordComponentElement e, P p) { return defaultAction(e, p);
|