src/java.base/share/classes/java/util/EnumMap.java
changeset 57956 e0b8b019d2f5
parent 52427 3c6aa484536c
equal deleted inserted replaced
57955:18863bf3501f 57956:e0b8b019d2f5
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   752     private static <K extends Enum<K>> K[] getKeyUniverse(Class<K> keyType) {
   752     private static <K extends Enum<K>> K[] getKeyUniverse(Class<K> keyType) {
   753         return SharedSecrets.getJavaLangAccess()
   753         return SharedSecrets.getJavaLangAccess()
   754                                         .getEnumConstantsShared(keyType);
   754                                         .getEnumConstantsShared(keyType);
   755     }
   755     }
   756 
   756 
       
   757     @java.io.Serial
   757     private static final long serialVersionUID = 458661240069192865L;
   758     private static final long serialVersionUID = 458661240069192865L;
   758 
   759 
   759     /**
   760     /**
   760      * Save the state of the {@code EnumMap} instance to a stream (i.e.,
   761      * Save the state of the {@code EnumMap} instance to a stream (i.e.,
   761      * serialize it).
   762      * serialize it).
   763      * @serialData The <i>size</i> of the enum map (the number of key-value
   764      * @serialData The <i>size</i> of the enum map (the number of key-value
   764      *             mappings) is emitted (int), followed by the key (Object)
   765      *             mappings) is emitted (int), followed by the key (Object)
   765      *             and value (Object) for each key-value mapping represented
   766      *             and value (Object) for each key-value mapping represented
   766      *             by the enum map.
   767      *             by the enum map.
   767      */
   768      */
       
   769     @java.io.Serial
   768     private void writeObject(java.io.ObjectOutputStream s)
   770     private void writeObject(java.io.ObjectOutputStream s)
   769         throws java.io.IOException
   771         throws java.io.IOException
   770     {
   772     {
   771         // Write out the key type and any hidden stuff
   773         // Write out the key type and any hidden stuff
   772         s.defaultWriteObject();
   774         s.defaultWriteObject();
   788     /**
   790     /**
   789      * Reconstitute the {@code EnumMap} instance from a stream (i.e.,
   791      * Reconstitute the {@code EnumMap} instance from a stream (i.e.,
   790      * deserialize it).
   792      * deserialize it).
   791      */
   793      */
   792     @SuppressWarnings("unchecked")
   794     @SuppressWarnings("unchecked")
       
   795     @java.io.Serial
   793     private void readObject(java.io.ObjectInputStream s)
   796     private void readObject(java.io.ObjectInputStream s)
   794         throws java.io.IOException, ClassNotFoundException
   797         throws java.io.IOException, ClassNotFoundException
   795     {
   798     {
   796         // Read in the key type and any hidden stuff
   799         // Read in the key type and any hidden stuff
   797         s.defaultReadObject();
   800         s.defaultReadObject();