mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8260517: implement Sealed Classes as a standard feature in Java
Co-authored-by: Harold Seigel <hseigel@openjdk.org> Co-authored-by: Vicente Romero <vromero@openjdk.org> Reviewed-by: dholmes, mcimadamore, jlahoda
This commit is contained in:
parent
31b98e129e
commit
0fa9223f34
54 changed files with 170 additions and 394 deletions
|
@ -4475,9 +4475,8 @@ public final class Class<T> implements java.io.Serializable,
|
|||
*
|
||||
* @jls 8.1 Class Declarations
|
||||
* @jls 9.1 Interface Declarations
|
||||
* @since 15
|
||||
* @since 17
|
||||
*/
|
||||
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES, reflective=true)
|
||||
@CallerSensitive
|
||||
public Class<?>[] getPermittedSubclasses() {
|
||||
Class<?>[] subClasses;
|
||||
|
@ -4524,14 +4523,13 @@ public final class Class<T> implements java.io.Serializable,
|
|||
* subclasses; {@link #getPermittedSubclasses()} returns a non-null but
|
||||
* possibly empty value for a sealed class or interface.
|
||||
*
|
||||
* @return {@code true} if and only if this {@code Class} object represents a sealed class or interface.
|
||||
* @return {@code true} if and only if this {@code Class} object represents
|
||||
* a sealed class or interface.
|
||||
*
|
||||
* @jls 8.1 Class Declarations
|
||||
* @jls 9.1 Interface Declarations
|
||||
* @since 15
|
||||
* @since 17
|
||||
*/
|
||||
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES, reflective=true)
|
||||
@SuppressWarnings("preview")
|
||||
public boolean isSealed() {
|
||||
if (isArray() || isPrimitive()) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue