This commit is contained in:
Henry Jen 2019-10-14 21:01:25 +00:00
commit 8d141f1048
561 changed files with 10985 additions and 8895 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, Azul Systems, Inc. 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
@ -2004,6 +2005,17 @@ public abstract class ClassLoader {
return scl;
}
/*
* Initialize default paths for native libraries search.
* Must be done early as JDK may load libraries during bootstrap.
*
* @see java.lang.System#initPhase1
*/
static void initLibraryPaths() {
usr_paths = initializePath("java.library.path");
sys_paths = initializePath("sun.boot.library.path");
}
// Returns true if the specified class loader can be found in this class
// loader's delegation chain.
boolean isAncestor(ClassLoader cl) {
@ -2473,8 +2485,7 @@ public abstract class ClassLoader {
*
* We use a static stack to hold the list of libraries we are
* loading because this can happen only when called by the
* same thread because Runtime.load and Runtime.loadLibrary
* are synchronous.
* same thread because this block is synchronous.
*
* If there is a pending load operation for the library, we
* immediately return success; otherwise, we raise
@ -2619,10 +2630,9 @@ public abstract class ClassLoader {
boolean isAbsolute) {
ClassLoader loader =
(fromClass == null) ? null : fromClass.getClassLoader();
if (sys_paths == null) {
usr_paths = initializePath("java.library.path");
sys_paths = initializePath("sun.boot.library.path");
}
assert sys_paths != null : "should be initialized at this point";
assert usr_paths != null : "should be initialized at this point";
if (isAbsolute) {
if (loadLibrary0(fromClass, new File(name))) {
return;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, Azul Systems, Inc. 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
@ -732,7 +733,7 @@ public class Runtime {
load0(Reflection.getCallerClass(), filename);
}
synchronized void load0(Class<?> fromClass, String filename) {
void load0(Class<?> fromClass, String filename) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkLink(filename);
@ -794,14 +795,14 @@ public class Runtime {
loadLibrary0(Reflection.getCallerClass(), libname);
}
synchronized void loadLibrary0(Class<?> fromClass, String libname) {
void loadLibrary0(Class<?> fromClass, String libname) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkLink(libname);
}
if (libname.indexOf((int)File.separatorChar) != -1) {
throw new UnsatisfiedLinkError(
"Directory separator should not appear in library name: " + libname);
"Directory separator should not appear in library name: " + libname);
}
ClassLoader.loadLibrary(fromClass, libname, false);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, 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
@ -191,6 +191,12 @@ class StringCoding {
return result.with(StringLatin1.inflate(ba, off, len), UTF16);
}
}
// fastpath for always Latin1 decodable single byte
if (COMPACT_STRINGS && cd instanceof ArrayDecoder && ((ArrayDecoder)cd).isLatin1Decodable()) {
byte[] dst = new byte[len];
((ArrayDecoder)cd).decodeToLatin1(ba, off, len, dst);
return result.with(dst, LATIN1);
}
int en = scale(len, cd.maxCharsPerByte());
char[] ca = new char[en];
if (cd instanceof ArrayDecoder) {
@ -278,6 +284,13 @@ class StringCoding {
((ArrayDecoder)cd).isASCIICompatible() && !hasNegatives(ba, off, len)) {
return decodeLatin1(ba, off, len);
}
// fastpath for always Latin1 decodable single byte
if (COMPACT_STRINGS && cd instanceof ArrayDecoder && ((ArrayDecoder)cd).isLatin1Decodable()) {
byte[] dst = new byte[len];
((ArrayDecoder)cd).decodeToLatin1(ba, off, len, dst);
return new Result().with(dst, LATIN1);
}
int en = scale(len, cd.maxCharsPerByte());
if (len == 0) {
return new Result().with();

View file

@ -2045,6 +2045,8 @@ public final class System {
// register shared secrets
setJavaLangAccess();
ClassLoader.initLibraryPaths();
// Subsystems that are invoked during initialization can invoke
// VM.isBooted() in order to avoid doing things that should
// wait until the VM is fully initialized. The initialization level

View file

@ -230,6 +230,7 @@ public class Throwable implements Serializable {
* @serial
* @since 1.7
*/
@SuppressWarnings("serial") // Not statically typed as Serializable
private List<Throwable> suppressedExceptions = SUPPRESSED_SENTINEL;
/** Message for trying to suppress a null exception. */

View file

@ -76,6 +76,7 @@ public final class SerializedLambda implements Serializable {
private final String implMethodSignature;
private final int implMethodKind;
private final String instantiatedMethodType;
@SuppressWarnings("serial") // Not statically typed as Serializable
private final Object[] capturedArgs;
/**

View file

@ -308,6 +308,7 @@ public class Proxy implements java.io.Serializable {
* the invocation handler for this proxy instance.
* @serial
*/
@SuppressWarnings("serial") // Not statically typed as Serializable
protected InvocationHandler h;
/**

View file

@ -434,14 +434,15 @@ class DatagramSocket implements java.io.Closeable {
* verify that datagrams are permitted to be sent and received
* respectively.
*
* <p> When a socket is connected, {@link #receive receive} and
* {@link #send send} <b>will not perform any security checks</b>
* on incoming and outgoing packets, other than matching the packet's
* and the socket's address and port. On a send operation, if the
* packet's address is set and the packet's address and the socket's
* address do not match, an {@code IllegalArgumentException} will be
* thrown. A socket connected to a multicast address may only be used
* to send packets.
* <p> Care should be taken to ensure that a connected datagram socket
* is not shared with untrusted code. When a socket is connected,
* {@link #receive receive} and {@link #send send} <b>will not perform
* any security checks</b> on incoming and outgoing packets, other than
* matching the packet's and the socket's address and port. On a send
* operation, if the packet's address is set and the packet's address
* and the socket's address do not match, an {@code IllegalArgumentException}
* will be thrown. A socket connected to a multicast address may only
* be used to send packets.
*
* @param address the remote address for the socket
*
@ -708,9 +709,11 @@ class DatagramSocket implements java.io.Closeable {
* the length of the received message. If the message is longer than
* the packet's length, the message is truncated.
* <p>
* If there is a security manager, a packet cannot be received if the
* security manager's {@code checkAccept} method
* does not allow it.
* If there is a security manager, and the socket is not currently
* connected to a remote address, a packet cannot be received if the
* security manager's {@code checkAccept} method does not allow it.
* Datagrams that are not permitted by the security manager are silently
* discarded.
*
* @param p the {@code DatagramPacket} into which to place
* the incoming data.
@ -896,12 +899,15 @@ class DatagramSocket implements java.io.Closeable {
*
* @param timeout the specified timeout in milliseconds.
* @throws SocketException if there is an error in the underlying protocol, such as an UDP error.
* @throws IllegalArgumentException if {@code timeout} is negative
* @since 1.1
* @see #getSoTimeout()
*/
public synchronized void setSoTimeout(int timeout) throws SocketException {
if (isClosed())
throw new SocketException("Socket is closed");
if (timeout < 0)
throw new IllegalArgumentException("timeout < 0");
getImpl().setOption(SocketOptions.SO_TIMEOUT, timeout);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, 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
@ -265,7 +265,10 @@ public abstract class DatagramChannel
* java.lang.SecurityManager#checkAccept checkAccept} and {@link
* java.lang.SecurityManager#checkConnect checkConnect} methods permit
* datagrams to be received from and sent to, respectively, the given
* remote address.
* remote address. Once connected, no further security checks are performed
* for datagrams received from, or sent to, the given remote address. Care
* should be taken to ensure that a connected datagram channel is not shared
* with untrusted code.
*
* <p> This method may be invoked at any time. It will not have any effect
* on read or write operations that are already in progress at the moment
@ -325,6 +328,10 @@ public abstract class DatagramChannel
* <p> If this channel's socket is not connected, or if the channel is
* closed, then invoking this method has no effect. </p>
*
* @apiNote If this method throws an IOException, the channel's socket
* may be left in an unspecified state. It is strongly recommended that
* the channel be closed when disconnect fails.
*
* @return This datagram channel
*
* @throws IOException
@ -369,9 +376,10 @@ public abstract class DatagramChannel
* to a specific remote address and a security manager has been installed
* then for each datagram received this method verifies that the source's
* address and port number are permitted by the security manager's {@link
* java.lang.SecurityManager#checkAccept checkAccept} method. The overhead
* of this security check can be avoided by first connecting the socket via
* the {@link #connect connect} method.
* java.lang.SecurityManager#checkAccept checkAccept} method. Datagrams
* that are not permitted by the security manager are silently discarded.
* The overhead of this security check can be avoided by first connecting
* the socket via the {@link #connect connect} method.
*
* <p> This method may be invoked at any time. If another thread has
* already initiated a read operation upon this channel, however, then an
@ -401,11 +409,6 @@ public abstract class DatagramChannel
* closing the channel and setting the current thread's
* interrupt status
*
* @throws SecurityException
* If a security manager has been installed
* and it does not permit datagrams to be accepted
* from the datagram's sender
*
* @throws IOException
* If some other I/O error occurs
*/

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, 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
@ -25,7 +25,8 @@
package java.nio.channels;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
/**
* A token representing the registration of a {@link SelectableChannel} with a
@ -428,13 +429,17 @@ public abstract class SelectionKey {
// -- Attachments --
private static final VarHandle ATTACHMENT;
static {
try {
MethodHandles.Lookup l = MethodHandles.lookup();
ATTACHMENT = l.findVarHandle(SelectionKey.class, "attachment", Object.class);
} catch (Exception e) {
throw new InternalError(e);
}
}
private volatile Object attachment;
private static final AtomicReferenceFieldUpdater<SelectionKey,Object>
attachmentUpdater = AtomicReferenceFieldUpdater.newUpdater(
SelectionKey.class, Object.class, "attachment"
);
/**
* Attaches the given object to this key.
*
@ -450,7 +455,7 @@ public abstract class SelectionKey {
* otherwise {@code null}
*/
public final Object attach(Object ob) {
return attachmentUpdater.getAndSet(this, ob);
return ATTACHMENT.getAndSet(this, ob);
}
/**

View file

@ -3550,8 +3550,8 @@ public final class Files {
// ensure lines is not null before opening file
Objects.requireNonNull(lines);
CharsetEncoder encoder = cs.newEncoder();
OutputStream out = newOutputStream(path, options);
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, encoder))) {
try (OutputStream out = newOutputStream(path, options);
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, encoder))) {
for (CharSequence line: lines) {
writer.append(line);
writer.newLine();

View file

@ -52,7 +52,9 @@ public class GuardedObject implements java.io.Serializable {
@java.io.Serial
private static final long serialVersionUID = -5240450096227834308L;
@SuppressWarnings("serial") // Not statically typed as Serializable
private Object object; // the object we are guarding
@SuppressWarnings("serial") // Not statically typed as Serializable
private Guard guard; // the guard
/**

View file

@ -1043,6 +1043,7 @@ public class SecureRandom extends java.util.Random {
/**
* @serial
*/
@SuppressWarnings("serial") // Not statically typed as Serializable
private MessageDigest digest = null;
/**
* @serial

View file

@ -641,6 +641,7 @@ public abstract class Clock {
static final class OffsetClock extends Clock implements Serializable {
@java.io.Serial
private static final long serialVersionUID = 2007484719125426256L;
@SuppressWarnings("serial") // Not statically typed as Serializable
private final Clock baseClock;
private final Duration offset;
@ -692,6 +693,7 @@ public abstract class Clock {
static final class TickClock extends Clock implements Serializable {
@java.io.Serial
private static final long serialVersionUID = 6504659149906368850L;
@SuppressWarnings("serial") // Not statically typed as Serializable
private final Clock baseClock;
private final long tickNanos;

View file

@ -109,6 +109,7 @@ final class ChronoPeriodImpl
/**
* The chronology.
*/
@SuppressWarnings("serial") // Not statically typed as Serializable
private final Chronology chrono;
/**
* The number of years.

View file

@ -607,7 +607,9 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
@java.io.Serial
private static final long serialVersionUID = -8499721149061103585L;
@SuppressWarnings("serial") // Conditionally serializable
private final K key;
@SuppressWarnings("serial") // Conditionally serializable
private V value;
/**
@ -738,7 +740,9 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
@java.io.Serial
private static final long serialVersionUID = 7138329143949025153L;
@SuppressWarnings("serial") // Not statically typed as Serializable
private final K key;
@SuppressWarnings("serial") // Not statically typed as Serializable
private final V value;
/**

View file

@ -103,10 +103,15 @@ class ArrayPrefixHelpers {
static final int MIN_PARTITION = 16;
static final class CumulateTask<T> extends CountedCompleter<Void> {
@SuppressWarnings("serial") // Not statically typed as Serializable
final T[] array;
@SuppressWarnings("serial") // Not statically typed as Serializable
final BinaryOperator<T> function;
CumulateTask<T> left, right;
T in, out;
@SuppressWarnings("serial") // Not statically typed as Serializable
T in;
@SuppressWarnings("serial") // Not statically typed as Serializable
T out;
final int lo, hi, origin, fence, threshold;
/** Root task constructor */
@ -257,6 +262,7 @@ class ArrayPrefixHelpers {
static final class LongCumulateTask extends CountedCompleter<Void> {
final long[] array;
@SuppressWarnings("serial") // Not statically typed as Serializable
final LongBinaryOperator function;
LongCumulateTask left, right;
long in, out;
@ -408,6 +414,7 @@ class ArrayPrefixHelpers {
static final class DoubleCumulateTask extends CountedCompleter<Void> {
final double[] array;
@SuppressWarnings("serial") // Not statically typed as Serializable
final DoubleBinaryOperator function;
DoubleCumulateTask left, right;
double in, out;
@ -559,6 +566,7 @@ class ArrayPrefixHelpers {
static final class IntCumulateTask extends CountedCompleter<Void> {
final int[] array;
@SuppressWarnings("serial") // Not statically typed as Serializable
final IntBinaryOperator function;
IntCumulateTask left, right;
int in, out;

View file

@ -4339,6 +4339,7 @@ public class Arrays {
{
@java.io.Serial
private static final long serialVersionUID = -2764017481108945198L;
@SuppressWarnings("serial") // Conditionally serializable
private final E[] a;
ArrayList(E[] array) {

View file

@ -115,8 +115,12 @@ import java.util.concurrent.CountedCompleter;
static final class Sorter<T> extends CountedCompleter<Void> {
@java.io.Serial
static final long serialVersionUID = 2446542900576103244L;
final T[] a, w;
@SuppressWarnings("serial") // Not statically typed as Serializable
final T[] a;
@SuppressWarnings("serial") // Not statically typed as Serializable
final T[] w;
final int base, size, wbase, gran;
@SuppressWarnings("serial") // Not statically typed as Serializable
Comparator<? super T> comparator;
Sorter(CountedCompleter<?> par, T[] a, T[] w, int base, int size,
int wbase, int gran,
@ -153,8 +157,13 @@ import java.util.concurrent.CountedCompleter;
static final class Merger<T> extends CountedCompleter<Void> {
@java.io.Serial
static final long serialVersionUID = 2446542900576103244L;
final T[] a, w; // main and workspace arrays
// main and workspace arrays
@SuppressWarnings("serial") // Not statically typed as Serializable
final T[] a;
@SuppressWarnings("serial") // Not statically typed as Serializable
final T[] w;
final int lbase, lsize, rbase, rsize, wbase, gran;
@SuppressWarnings("serial") // Not statically typed as Serializable
Comparator<? super T> comparator;
Merger(CountedCompleter<?> par, T[] a, T[] w,
int lbase, int lsize, int rbase,

View file

@ -188,6 +188,38 @@ import java.util.stream.StreamSupport;
* or if the only reference to the backing collection is through an
* unmodifiable view, the view can be considered effectively immutable.
*
* <h2><a id="serializable">Serializability of Collections</a></h2>
*
* <p>Serializability of collections is optional. As such, none of the collections
* interfaces are declared to implement the {@link java.io.Serializable} interface.
* However, serializability is regarded as being generally useful, so most collection
* implementations are serializable.
*
* <p>The collection implementations that are public classes (such as {@code ArrayList}
* or {@code HashMap}) are declared to implement the {@code Serializable} interface if they
* are in fact serializable. Some collections implementations are not public classes,
* such as the <a href="#unmodifiable">unmodifiable collections.</a> In such cases, the
* serializability of such collections is described in the specification of the method
* that creates them, or in some other suitable place. In cases where the serializability
* of a collection is not specified, there is no guarantee about the serializability of such
* collections. In particular, many <a href="#view">view collections</a> are not serializable.
*
* <p>A collection implementation that implements the {@code Serializable} interface cannot
* be guaranteed to be serializable. The reason is that in general, collections
* contain elements of other types, and it is not possible to determine statically
* whether instances of some element type are actually serializable. For example, consider
* a serializable {@code Collection<E>}, where {@code E} does not implement the
* {@code Serializable} interface. The collection may be serializable, if it contains only
* elements of some serializable subtype of {@code E}, or if it is empty. Collections are
* thus said to be <i>conditionally serializable,</i> as the serializability of the collection
* as a whole depends on whether the collection itself is serializable and on whether all
* contained elements are also serializable.
*
* <p>An additional case occurs with instances of {@link SortedSet} and {@link SortedMap}.
* These collections can be created with a {@link Comparator} that imposes an ordering on
* the set elements or map keys. Such a collection is serializable only if the provided
* {@code Comparator} is also serializable.
*
* <p>This interface is a member of the
* <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
* Java Collections Framework</a>.

View file

@ -1024,6 +1024,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 1820017752578914078L;
@SuppressWarnings("serial") // Conditionally serializable
final Collection<? extends E> c;
UnmodifiableCollection(Collection<? extends E> c) {
@ -1164,6 +1165,7 @@ public class Collections {
implements SortedSet<E>, Serializable {
@java.io.Serial
private static final long serialVersionUID = -4929149591599911165L;
@SuppressWarnings("serial") // Conditionally serializable
private final SortedSet<E> ss;
UnmodifiableSortedSet(SortedSet<E> s) {super(s); ss = s;}
@ -1244,6 +1246,7 @@ public class Collections {
/**
* The instance we are protecting.
*/
@SuppressWarnings("serial") // Conditionally serializable
private final NavigableSet<E> ns;
UnmodifiableNavigableSet(NavigableSet<E> s) {super(s); ns = s;}
@ -1304,6 +1307,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = -283967356065247728L;
@SuppressWarnings("serial") // Conditionally serializable
final List<? extends E> list;
UnmodifiableList(List<? extends E> list) {
@ -1450,6 +1454,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = -1034234728574286014L;
@SuppressWarnings("serial") // Conditionally serializable
private final Map<? extends K, ? extends V> m;
UnmodifiableMap(Map<? extends K, ? extends V> m) {
@ -1809,6 +1814,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = -8806743815996713206L;
@SuppressWarnings("serial") // Conditionally serializable
private final SortedMap<K, ? extends V> sm;
UnmodifiableSortedMap(SortedMap<K, ? extends V> m) {super(m); sm = m; }
@ -1886,6 +1892,7 @@ public class Collections {
/**
* The instance we wrap and protect.
*/
@SuppressWarnings("serial") // Conditionally serializable
private final NavigableMap<K, ? extends V> nm;
UnmodifiableNavigableMap(NavigableMap<K, ? extends V> m)
@ -2017,7 +2024,9 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 3053995032091335093L;
@SuppressWarnings("serial") // Conditionally serializable
final Collection<E> c; // Backing Collection
@SuppressWarnings("serial") // Conditionally serializable
final Object mutex; // Object on which to synchronize
SynchronizedCollection(Collection<E> c) {
@ -2219,6 +2228,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 8695801310862127406L;
@SuppressWarnings("serial") // Conditionally serializable
private final SortedSet<E> ss;
SynchronizedSortedSet(SortedSet<E> s) {
@ -2314,6 +2324,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = -5505529816273629798L;
@SuppressWarnings("serial") // Conditionally serializable
private final NavigableSet<E> ns;
SynchronizedNavigableSet(NavigableSet<E> s) {
@ -2424,6 +2435,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = -7754090372962971524L;
@SuppressWarnings("serial") // Conditionally serializable
final List<E> list;
SynchronizedList(List<E> list) {
@ -2591,7 +2603,9 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 1978198479659022715L;
@SuppressWarnings("serial") // Conditionally serializable
private final Map<K,V> m; // Backing Map
@SuppressWarnings("serial") // Conditionally serializable
final Object mutex; // Object on which to synchronize
SynchronizedMap(Map<K,V> m) {
@ -2788,6 +2802,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = -8798146769416483793L;
@SuppressWarnings("serial") // Conditionally serializable
private final SortedMap<K,V> sm;
SynchronizedSortedMap(SortedMap<K,V> m) {
@ -2891,6 +2906,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 699392247599746807L;
@SuppressWarnings("serial") // Conditionally serializable
private final NavigableMap<K,V> nm;
SynchronizedNavigableMap(NavigableMap<K,V> m) {
@ -3070,7 +3086,9 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 1578914078182001775L;
@SuppressWarnings("serial") // Conditionally serializable
final Collection<E> c;
@SuppressWarnings("serial") // Conditionally serializable
final Class<E> type;
@SuppressWarnings("unchecked")
@ -3126,6 +3144,7 @@ public class Collections {
public boolean add(E e) { return c.add(typeCheck(e)); }
@SuppressWarnings("serial") // Conditionally serializable
private E[] zeroLengthElementArray; // Lazily initialized
private E[] zeroLengthElementArray() {
@ -3219,6 +3238,7 @@ public class Collections {
{
@java.io.Serial
private static final long serialVersionUID = 1433151992604707767L;
@SuppressWarnings("serial") // Conditionally serializable
final Queue<E> queue;
CheckedQueue(Queue<E> queue, Class<E> elementType) {
@ -3323,6 +3343,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 1599911165492914959L;
@SuppressWarnings("serial") // Conditionally serializable
private final SortedSet<E> ss;
CheckedSortedSet(SortedSet<E> s, Class<E> type) {
@ -3387,6 +3408,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = -5429120189805438922L;
@SuppressWarnings("serial") // Conditionally serializable
private final NavigableSet<E> ns;
CheckedNavigableSet(NavigableSet<E> s, Class<E> type) {
@ -3470,6 +3492,7 @@ public class Collections {
{
@java.io.Serial
private static final long serialVersionUID = 65247728283967356L;
@SuppressWarnings("serial") // Conditionally serializable
final List<E> list;
CheckedList(List<E> list, Class<E> type) {
@ -3619,8 +3642,11 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 5742860141034234728L;
@SuppressWarnings("serial") // Conditionally serializable
private final Map<K, V> m;
@SuppressWarnings("serial") // Conditionally serializable
final Class<K> keyType;
@SuppressWarnings("serial") // Conditionally serializable
final Class<V> valueType;
private void typeCheck(Object key, Object value) {
@ -4019,6 +4045,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 1599671320688067438L;
@SuppressWarnings("serial") // Conditionally serializable
private final SortedMap<K, V> sm;
CheckedSortedMap(SortedMap<K, V> m,
@ -4094,6 +4121,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = -4852462692372534096L;
@SuppressWarnings("serial") // Conditionally serializable
private final NavigableMap<K, V> nm;
CheckedNavigableMap(NavigableMap<K, V> m,
@ -4825,6 +4853,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 3193687207550431679L;
@SuppressWarnings("serial") // Conditionally serializable
private final E element;
SingletonSet(E e) {element = e;}
@ -4879,6 +4908,7 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = 3093736618740652951L;
@SuppressWarnings("serial") // Conditionally serializable
private final E element;
SingletonList(E obj) {element = obj;}
@ -4948,7 +4978,9 @@ public class Collections {
@java.io.Serial
private static final long serialVersionUID = -6979724477215052911L;
@SuppressWarnings("serial") // Conditionally serializable
private final K k;
@SuppressWarnings("serial") // Conditionally serializable
private final V v;
SingletonMap(K key, V value) {
@ -5087,6 +5119,7 @@ public class Collections {
private static final long serialVersionUID = 2739099268398711800L;
final int n;
@SuppressWarnings("serial") // Conditionally serializable
final E element;
CopiesList(int n, E e) {
@ -5320,6 +5353,7 @@ public class Collections {
*
* @serial
*/
@SuppressWarnings("serial") // Conditionally serializable
final Comparator<T> cmp;
ReverseComparator2(Comparator<T> cmp) {
@ -5601,6 +5635,7 @@ public class Collections {
private static class SetFromMap<E> extends AbstractSet<E>
implements Set<E>, Serializable
{
@SuppressWarnings("serial") // Conditionally serializable
private final Map<E, Boolean> m; // The backing map
private transient Set<E> s; // Its keySet
@ -5686,6 +5721,7 @@ public class Collections {
implements Queue<E>, Serializable {
@java.io.Serial
private static final long serialVersionUID = 1802017725587941708L;
@SuppressWarnings("serial") // Conditionally serializable
private final Deque<E> q;
AsLIFOQueue(Deque<E> q) { this.q = q; }
public boolean add(E e) { q.addFirst(e); return true; }

View file

@ -66,6 +66,7 @@ class Comparators {
private static final long serialVersionUID = -7569533591570686392L;
private final boolean nullFirst;
// if null, non-null Ts are considered equal
@SuppressWarnings("serial") // Not statically typed as Serializable
private final Comparator<T> real;
@SuppressWarnings("unchecked")

View file

@ -111,6 +111,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
* The comparator, or null if priority queue uses elements'
* natural ordering.
*/
@SuppressWarnings("serial") // Conditionally serializable
private final Comparator<? super E> comparator;
/**

View file

@ -118,6 +118,7 @@ public class TreeMap<K,V>
*
* @serial
*/
@SuppressWarnings("serial") // Conditionally serializable
private final Comparator<? super K> comparator;
private transient Entry<K,V> root;
@ -1353,7 +1354,10 @@ public class TreeMap<K,V>
* if loInclusive is true, lo is the inclusive bound, else lo
* is the exclusive bound. Similarly for the upper bound.
*/
final K lo, hi;
@SuppressWarnings("serial") // Conditionally serializable
final K lo;
@SuppressWarnings("serial") // Conditionally serializable
final K hi;
final boolean fromStart, toEnd;
final boolean loInclusive, hiInclusive;
@ -1936,6 +1940,7 @@ public class TreeMap<K,V>
super(m, fromStart, lo, loInclusive, toEnd, hi, hiInclusive);
}
@SuppressWarnings("serial") // Conditionally serializable
private final Comparator<? super K> reverseComparator =
Collections.reverseOrder(m.comparator);
@ -2024,7 +2029,10 @@ public class TreeMap<K,V>
@java.io.Serial
private static final long serialVersionUID = -6520786458950516097L;
private boolean fromStart = false, toEnd = false;
private K fromKey, toKey;
@SuppressWarnings("serial") // Conditionally serializable
private K fromKey;
@SuppressWarnings("serial") // Conditionally serializable
private K toKey;
@java.io.Serial
private Object readResolve() {
return new AscendingSubMap<>(TreeMap.this,

View file

@ -102,6 +102,7 @@ public class Vector<E>
*
* @serial
*/
@SuppressWarnings("serial") // Conditionally serializable
protected Object[] elementData;
/**

View file

@ -590,6 +590,7 @@ class JarVerifier {
URL vlocation;
CodeSigner[] vsigners;
java.security.cert.Certificate[] vcerts;
@SuppressWarnings("serial") // Not statically typed as Serializable
Object csdomain;
VerifierCodeSource(Object csdomain, URL location, CodeSigner[] signers) {