src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java
changeset 47423 4fc2a4a29f3d
parent 47216 71c04702a3d5
child 48541 946e34c2dec9
equal deleted inserted replaced
47422:7a4b85711089 47423:4fc2a4a29f3d
    49 import java.util.Spliterator;
    49 import java.util.Spliterator;
    50 import java.util.Spliterators;
    50 import java.util.Spliterators;
    51 import java.util.function.Consumer;
    51 import java.util.function.Consumer;
    52 import java.util.function.Predicate;
    52 import java.util.function.Predicate;
    53 import java.util.function.UnaryOperator;
    53 import java.util.function.UnaryOperator;
       
    54 import jdk.internal.misc.SharedSecrets;
    54 
    55 
    55 /**
    56 /**
    56  * A thread-safe variant of {@link java.util.ArrayList} in which all mutative
    57  * A thread-safe variant of {@link java.util.ArrayList} in which all mutative
    57  * operations ({@code add}, {@code set}, and so on) are implemented by
    58  * operations ({@code add}, {@code set}, and so on) are implemented by
    58  * making a fresh copy of the underlying array.
    59  * making a fresh copy of the underlying array.
   931         // bind to new lock
   932         // bind to new lock
   932         resetLock();
   933         resetLock();
   933 
   934 
   934         // Read in array length and allocate array
   935         // Read in array length and allocate array
   935         int len = s.readInt();
   936         int len = s.readInt();
       
   937         SharedSecrets.getJavaObjectInputStreamAccess().checkArray(s, Object[].class, len);
   936         Object[] elements = new Object[len];
   938         Object[] elements = new Object[len];
   937 
   939 
   938         // Read in all elements in the proper order.
   940         // Read in all elements in the proper order.
   939         for (int i = 0; i < len; i++)
   941         for (int i = 0; i < len; i++)
   940             elements[i] = s.readObject();
   942             elements[i] = s.readObject();