8282572: EnumSet should be a sealed class

Reviewed-by: sundar
This commit is contained in:
Jaikiran Pai 2022-03-14 03:17:57 +00:00
parent 5c408c1410
commit 3cf83a671e
3 changed files with 7 additions and 7 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -76,8 +76,8 @@ import jdk.internal.access.SharedSecrets;
* @since 1.5
* @see EnumMap
*/
public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
implements Cloneable, java.io.Serializable
public abstract sealed class EnumSet<E extends Enum<E>> extends AbstractSet<E>
implements Cloneable, java.io.Serializable permits JumboEnumSet, RegularEnumSet
{
// declare EnumSet.class serialization compatibility with JDK 8
@java.io.Serial

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -33,7 +33,7 @@ package java.util;
* @since 1.5
* @serial exclude
*/
class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
final class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
@java.io.Serial
private static final long serialVersionUID = 334349849919042784L;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -33,7 +33,7 @@ package java.util;
* @since 1.5
* @serial exclude
*/
class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
final class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
@java.io.Serial
private static final long serialVersionUID = 3411599620347842686L;
/**