102 |
|
* |
103 |
|
* @serial |
104 |
|
*/ |
105 |
+ |
@SuppressWarnings("serial") // Conditionally serializable |
106 |
|
protected Object[] elementData; |
107 |
|
|
108 |
|
/** |
125 |
|
protected int capacityIncrement; |
126 |
|
|
127 |
|
/** use serialVersionUID from JDK 1.0.2 for interoperability */ |
128 |
+ |
// OPENJDK @java.io.Serial |
129 |
|
private static final long serialVersionUID = -2767605614048989439L; |
130 |
|
|
131 |
|
/** |
179 |
|
* @since 1.2 |
180 |
|
*/ |
181 |
|
public Vector(Collection<? extends E> c) { |
182 |
< |
elementData = c.toArray(); |
183 |
< |
elementCount = elementData.length; |
184 |
< |
// defend against c.toArray (incorrectly) not returning Object[] |
185 |
< |
// (see e.g. https://bugs.openjdk.java.net/browse/JDK-6260652) |
186 |
< |
if (elementData.getClass() != Object[].class) |
187 |
< |
elementData = Arrays.copyOf(elementData, elementCount, Object[].class); |
182 |
> |
Object[] a = c.toArray(); |
183 |
> |
elementCount = a.length; |
184 |
> |
if (c.getClass() == ArrayList.class) { |
185 |
> |
elementData = a; |
186 |
> |
} else { |
187 |
> |
elementData = Arrays.copyOf(a, elementCount, Object[].class); |
188 |
> |
} |
189 |
|
} |
190 |
|
|
191 |
|
/** |
1160 |
|
* @throws ClassNotFoundException if the stream contains data |
1161 |
|
* of a non-existing class |
1162 |
|
*/ |
1163 |
+ |
// OPENJDK @java.io.Serial |
1164 |
|
private void readObject(ObjectInputStream in) |
1165 |
|
throws IOException, ClassNotFoundException { |
1166 |
|
ObjectInputStream.GetField gfields = in.readFields(); |
1182 |
|
* @param s the stream |
1183 |
|
* @throws java.io.IOException if an I/O error occurs |
1184 |
|
*/ |
1185 |
+ |
// OPENJDK @java.io.Serial |
1186 |
|
private void writeObject(java.io.ObjectOutputStream s) |
1187 |
|
throws java.io.IOException { |
1188 |
|
final java.io.ObjectOutputStream.PutField fields = s.putFields(); |