8325189: Enable this-escape javac warning in java.base

Reviewed-by: alanb, erikj, naoto, smarks, ihse, joehw, lancea, weijun
This commit is contained in:
Joe Darcy 2024-02-07 20:05:11 +00:00
parent 299a8ee68d
commit fbd15b2087
93 changed files with 151 additions and 2 deletions

View file

@ -133,6 +133,7 @@ public class FileInputStream extends InputStream
* @see java.io.File#getPath()
* @see java.lang.SecurityManager#checkRead(java.lang.String)
*/
@SuppressWarnings("this-escape")
public FileInputStream(File file) throws FileNotFoundException {
String name = (file != null ? file.getPath() : null);
@SuppressWarnings("removal")
@ -177,6 +178,7 @@ public class FileInputStream extends InputStream
* file descriptor.
* @see SecurityManager#checkRead(java.io.FileDescriptor)
*/
@SuppressWarnings("this-escape")
public FileInputStream(FileDescriptor fdObj) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();

View file

@ -208,6 +208,7 @@ public class FileOutputStream extends OutputStream
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
* @since 1.4
*/
@SuppressWarnings("this-escape")
public FileOutputStream(File file, boolean append)
throws FileNotFoundException
{
@ -254,6 +255,7 @@ public class FileOutputStream extends OutputStream
* write access to the file descriptor
* @see java.lang.SecurityManager#checkWrite(java.io.FileDescriptor)
*/
@SuppressWarnings("this-escape")
public FileOutputStream(FileDescriptor fdObj) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();

View file

@ -84,6 +84,7 @@ public class InputStreamReader extends Reader {
*
* @see Charset#defaultCharset()
*/
@SuppressWarnings("this-escape")
public InputStreamReader(InputStream in) {
super(in);
Charset cs = Charset.defaultCharset();
@ -102,6 +103,7 @@ public class InputStreamReader extends Reader {
* @throws UnsupportedEncodingException
* If the named charset is not supported
*/
@SuppressWarnings("this-escape")
public InputStreamReader(InputStream in, String charsetName)
throws UnsupportedEncodingException
{
@ -119,6 +121,7 @@ public class InputStreamReader extends Reader {
*
* @since 1.4
*/
@SuppressWarnings("this-escape")
public InputStreamReader(InputStream in, Charset cs) {
super(in);
if (cs == null)
@ -134,6 +137,7 @@ public class InputStreamReader extends Reader {
*
* @since 1.4
*/
@SuppressWarnings("this-escape")
public InputStreamReader(InputStream in, CharsetDecoder dec) {
super(in);
if (dec == null)

View file

@ -390,6 +390,7 @@ public class ObjectInputStream
* @see ObjectInputStream#readFields()
* @see ObjectOutputStream#ObjectOutputStream(OutputStream)
*/
@SuppressWarnings("this-escape")
public ObjectInputStream(InputStream in) throws IOException {
verifySubclass();
bin = new BlockDataInputStream(in);

View file

@ -246,6 +246,7 @@ public class ObjectOutputStream
* @see ObjectOutputStream#putFields()
* @see ObjectInputStream#ObjectInputStream(InputStream)
*/
@SuppressWarnings("this-escape")
public ObjectOutputStream(OutputStream out) throws IOException {
verifySubclass();
bout = new BlockDataOutputStream(out);

View file

@ -101,6 +101,7 @@ public class OutputStreamWriter extends Writer {
* @throws UnsupportedEncodingException
* If the named encoding is not supported
*/
@SuppressWarnings("this-escape")
public OutputStreamWriter(OutputStream out, String charsetName)
throws UnsupportedEncodingException
{
@ -118,6 +119,7 @@ public class OutputStreamWriter extends Writer {
* @param out An OutputStream
* @see Charset#defaultCharset()
*/
@SuppressWarnings("this-escape")
public OutputStreamWriter(OutputStream out) {
super(out);
se = StreamEncoder.forOutputStreamWriter(out, lockFor(this),
@ -135,6 +137,7 @@ public class OutputStreamWriter extends Writer {
*
* @since 1.4
*/
@SuppressWarnings("this-escape")
public OutputStreamWriter(OutputStream out, Charset cs) {
super(out);
if (cs == null)
@ -153,6 +156,7 @@ public class OutputStreamWriter extends Writer {
*
* @since 1.4
*/
@SuppressWarnings("this-escape")
public OutputStreamWriter(OutputStream out, CharsetEncoder enc) {
super(out);
if (enc == null)

View file

@ -122,6 +122,7 @@ public class PipedInputStream extends InputStream {
* @throws IllegalArgumentException if {@code pipeSize <= 0}.
* @since 1.6
*/
@SuppressWarnings("this-escape")
public PipedInputStream(PipedOutputStream src, int pipeSize)
throws IOException {
initPipe(pipeSize);

View file

@ -59,6 +59,7 @@ public class PipedOutputStream extends OutputStream {
* @param snk The piped input stream to connect to.
* @throws IOException if an I/O error occurs.
*/
@SuppressWarnings("this-escape")
public PipedOutputStream(PipedInputStream snk) throws IOException {
connect(snk);
}

View file

@ -95,6 +95,7 @@ public class PipedReader extends Reader {
* @throws IllegalArgumentException if {@code pipeSize <= 0}.
* @since 1.6
*/
@SuppressWarnings("this-escape")
public PipedReader(PipedWriter src, int pipeSize) throws IOException {
initPipe(pipeSize);
connect(src);

View file

@ -57,6 +57,7 @@ public class PipedWriter extends Writer {
* @param snk The piped reader to connect to.
* @throws IOException if an I/O error occurs.
*/
@SuppressWarnings("this-escape")
public PipedWriter(PipedReader snk) throws IOException {
connect(snk);
}

View file

@ -167,6 +167,7 @@ public class PrintStream extends FilterOutputStream
* @see java.io.PrintWriter#PrintWriter(java.io.OutputStream, boolean)
* @see Charset#defaultCharset()
*/
@SuppressWarnings("this-escape")
public PrintStream(OutputStream out, boolean autoFlush) {
this(autoFlush, requireNonNull(out, "Null output stream"));
}
@ -212,6 +213,7 @@ public class PrintStream extends FilterOutputStream
*
* @since 10
*/
@SuppressWarnings("this-escape")
public PrintStream(OutputStream out, boolean autoFlush, Charset charset) {
super(out);
this.autoFlush = autoFlush;
@ -255,6 +257,7 @@ public class PrintStream extends FilterOutputStream
*
* @since 1.5
*/
@SuppressWarnings("this-escape")
public PrintStream(String fileName) throws FileNotFoundException {
this(false, new FileOutputStream(fileName));
}
@ -356,6 +359,7 @@ public class PrintStream extends FilterOutputStream
*
* @since 1.5
*/
@SuppressWarnings("this-escape")
public PrintStream(File file) throws FileNotFoundException {
this(false, new FileOutputStream(file));
}

View file

@ -215,6 +215,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
* @see java.nio.channels.FileChannel#force(boolean)
*/
@SuppressWarnings("this-escape")
public RandomAccessFile(File file, String mode)
throws FileNotFoundException
{

View file

@ -228,6 +228,7 @@ public class StreamTokenizer {
* @see java.io.StreamTokenizer#StreamTokenizer(java.io.Reader)
*/
@Deprecated
@SuppressWarnings("this-escape")
public StreamTokenizer(InputStream is) {
this();
if (is == null) {
@ -242,6 +243,7 @@ public class StreamTokenizer {
* @param r a Reader object providing the input stream.
* @since 1.1
*/
@SuppressWarnings("this-escape")
public StreamTokenizer(Reader r) {
this();
if (r == null) {

View file

@ -57,6 +57,7 @@ public class WriteAbortedException extends ObjectStreamException {
* @param s String describing the exception.
* @param ex Exception causing the abort.
*/
@SuppressWarnings("this-escape")
public WriteAbortedException(String s, Exception ex) {
super(s);
initCause(null); // Disallow subsequent initCause

View file

@ -71,6 +71,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message
* @see Throwable#getCause()
*/
@SuppressWarnings("this-escape")
public AssertionError(Object detailMessage) {
this(String.valueOf(detailMessage));
if (detailMessage instanceof Throwable)

View file

@ -77,6 +77,7 @@ public class BootstrapMethodError extends LinkageError {
*
* @param cause the cause, may be {@code null}.
*/
@SuppressWarnings("this-escape")
public BootstrapMethodError(Throwable cause) {
// cf. Throwable(Throwable cause) constructor.
super(cause == null ? null : cause.toString());

View file

@ -431,6 +431,7 @@ public abstract class ClassLoader {
*
* @since 9
*/
@SuppressWarnings("this-escape")
protected ClassLoader(String name, ClassLoader parent) {
this(checkCreateClassLoader(name), name, parent);
}
@ -457,6 +458,7 @@ public abstract class ClassLoader {
*
* @since 1.2
*/
@SuppressWarnings("this-escape")
protected ClassLoader(ClassLoader parent) {
this(checkCreateClassLoader(), null, parent);
}
@ -476,6 +478,7 @@ public abstract class ClassLoader {
* {@code checkCreateClassLoader} method doesn't allow creation
* of a new class loader.
*/
@SuppressWarnings("this-escape")
protected ClassLoader() {
this(checkCreateClassLoader(), null, getSystemClassLoader());
}

View file

@ -52,6 +52,7 @@ public class ExceptionInInitializerError extends LinkageError {
* throwable object.
* A detail message is a String that describes this particular exception.
*/
@SuppressWarnings("this-escape")
public ExceptionInInitializerError() {
initCause(null); // Disallow subsequent initCause
}

View file

@ -162,6 +162,7 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
* thread in the specified thread group.
* @see java.lang.ThreadGroup#checkAccess()
*/
@SuppressWarnings("this-escape")
public ThreadGroup(ThreadGroup parent, String name) {
this(checkParentAccess(parent), parent, name);
}

View file

@ -260,6 +260,7 @@ public class Throwable implements Serializable {
* <p>The {@link #fillInStackTrace()} method is called to initialize
* the stack trace data in the newly created throwable.
*/
@SuppressWarnings("this-escape")
public Throwable() {
fillInStackTrace();
if (jfrTracing) {
@ -278,6 +279,7 @@ public class Throwable implements Serializable {
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
@SuppressWarnings("this-escape")
public Throwable(String message) {
fillInStackTrace();
detailMessage = message;
@ -303,6 +305,7 @@ public class Throwable implements Serializable {
* unknown.)
* @since 1.4
*/
@SuppressWarnings("this-escape")
public Throwable(String message, Throwable cause) {
fillInStackTrace();
detailMessage = message;
@ -329,6 +332,7 @@ public class Throwable implements Serializable {
* unknown.)
* @since 1.4
*/
@SuppressWarnings("this-escape")
public Throwable(Throwable cause) {
fillInStackTrace();
detailMessage = (cause==null ? null : cause.toString());
@ -378,6 +382,7 @@ public class Throwable implements Serializable {
* @see ArithmeticException
* @since 1.7
*/
@SuppressWarnings("this-escape")
protected Throwable(String message, Throwable cause,
boolean enableSuppression,
boolean writableStackTrace) {

View file

@ -266,6 +266,7 @@ public class ServerSocket implements java.io.Closeable {
* @see SecurityManager#checkListen
* @since 1.1
*/
@SuppressWarnings("this-escape")
public ServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException {
if (port < 0 || port > 0xFFFF)
throw new IllegalArgumentException("Port value out of range: " + port);

View file

@ -211,6 +211,7 @@ public class Socket implements java.io.Closeable {
*
* @since 1.5
*/
@SuppressWarnings("this-escape")
public Socket(Proxy proxy) {
// Create a copy of Proxy as a security measure
if (proxy == null) {
@ -319,6 +320,7 @@ public class Socket implements java.io.Closeable {
* @see java.net.SocketImpl
* @see SecurityManager#checkConnect
*/
@SuppressWarnings("this-escape")
public Socket(String host, int port)
throws UnknownHostException, IOException
{
@ -353,6 +355,7 @@ public class Socket implements java.io.Closeable {
* @see java.net.SocketImpl
* @see SecurityManager#checkConnect
*/
@SuppressWarnings("this-escape")
public Socket(InetAddress address, int port) throws IOException {
this(address != null ? new InetSocketAddress(address, port) : null,
(SocketAddress) null, true);
@ -394,6 +397,7 @@ public class Socket implements java.io.Closeable {
* @see SecurityManager#checkConnect
* @since 1.1
*/
@SuppressWarnings("this-escape")
public Socket(String host, int port, InetAddress localAddr,
int localPort) throws IOException {
this(host != null ? new InetSocketAddress(host, port) :
@ -436,6 +440,7 @@ public class Socket implements java.io.Closeable {
* @see SecurityManager#checkConnect
* @since 1.1
*/
@SuppressWarnings("this-escape")
public Socket(InetAddress address, int port, InetAddress localAddr,
int localPort) throws IOException {
this(address != null ? new InetSocketAddress(address, port) : null,
@ -483,6 +488,7 @@ public class Socket implements java.io.Closeable {
* @deprecated Use DatagramSocket instead for UDP transport.
*/
@Deprecated
@SuppressWarnings("this-escape")
public Socket(String host, int port, boolean stream) throws IOException {
this(host != null ? new InetSocketAddress(host, port) :
new InetSocketAddress(InetAddress.getByName(null), port),
@ -525,6 +531,7 @@ public class Socket implements java.io.Closeable {
* @deprecated Use DatagramSocket instead for UDP transport.
*/
@Deprecated
@SuppressWarnings("this-escape")
public Socket(InetAddress host, int port, boolean stream) throws IOException {
this(host != null ? new InetSocketAddress(host, port) : null,
new InetSocketAddress(0), stream);

View file

@ -184,6 +184,7 @@ public abstract class Charset$Coder$ {
* If the preconditions on the parameters do not hold
*/
{#if[encoder]?protected:private}
@SuppressWarnings("this-escape")
Charset$Coder$(Charset cs,
float average$ItypesPerOtype$,
float max$ItypesPerOtype$,
@ -227,6 +228,7 @@ public abstract class Charset$Coder$ {
* @throws IllegalArgumentException
* If the preconditions on the parameters do not hold
*/
@SuppressWarnings("this-escape")
protected Charset$Coder$(Charset cs,
float average$ItypesPerOtype$,
float max$ItypesPerOtype$)

View file

@ -89,6 +89,7 @@ public class DigestInputStream extends FilterInputStream {
*
* @param digest the message digest to associate with this stream.
*/
@SuppressWarnings("this-escape")
public DigestInputStream(InputStream stream, MessageDigest digest) {
super(stream);
setMessageDigest(digest);

View file

@ -67,6 +67,7 @@ public class DigestOutputStream extends FilterOutputStream {
*
* @param digest the message digest to associate with this stream.
*/
@SuppressWarnings("this-escape")
public DigestOutputStream(OutputStream stream, MessageDigest digest) {
super(stream);
setMessageDigest(digest);

View file

@ -116,6 +116,7 @@ public abstract class Identity implements Principal, Serializable {
* @throws KeyManagementException if there is already an {@code Identity}
* with the same name in the scope.
*/
@SuppressWarnings("this-escape")
public Identity(String name, IdentityScope scope) throws
KeyManagementException {
this(name);

View file

@ -187,6 +187,7 @@ public abstract class Provider extends Properties {
* @deprecated use {@link #Provider(String, String, String)} instead.
*/
@Deprecated(since="9")
@SuppressWarnings("this-escape")
protected Provider(String name, double version, String info) {
this.name = name;
this.version = version;
@ -227,6 +228,7 @@ public abstract class Provider extends Properties {
*
* @since 9
*/
@SuppressWarnings("this-escape")
protected Provider(String name, String versionStr, String info) {
this.name = name;
this.versionStr = versionStr;

View file

@ -98,6 +98,7 @@ public class PKIXBuilderParameters extends PKIXParameters {
* {@code trustAnchors} are not of type
* {@code java.security.cert.TrustAnchor}
*/
@SuppressWarnings("this-escape")
public PKIXBuilderParameters(Set<TrustAnchor> trustAnchors, CertSelector
targetConstraints) throws InvalidAlgorithmParameterException
{
@ -123,6 +124,7 @@ public class PKIXBuilderParameters extends PKIXParameters {
* @throws NullPointerException if {@code keystore} is
* {@code null}
*/
@SuppressWarnings("this-escape")
public PKIXBuilderParameters(KeyStore keystore,
CertSelector targetConstraints)
throws KeyStoreException, InvalidAlgorithmParameterException

View file

@ -114,6 +114,7 @@ public class PKIXParameters implements CertPathParameters {
* @throws ClassCastException if any of the elements in the {@code Set}
* are not of type {@code java.security.cert.TrustAnchor}
*/
@SuppressWarnings("this-escape")
public PKIXParameters(Set<TrustAnchor> trustAnchors)
throws InvalidAlgorithmParameterException
{
@ -138,6 +139,7 @@ public class PKIXParameters implements CertPathParameters {
* not contain at least one trusted certificate entry
* @throws NullPointerException if the keystore is {@code null}
*/
@SuppressWarnings("this-escape")
public PKIXParameters(KeyStore keystore)
throws KeyStoreException, InvalidAlgorithmParameterException
{

View file

@ -104,6 +104,7 @@ public interface AttributedCharacterIterator extends CharacterIterator {
*
* @param name the name of {@code Attribute}
*/
@SuppressWarnings("this-escape")
protected Attribute(String name) {
this.name = name;
if (this.getClass() == Attribute.class) {

View file

@ -223,6 +223,7 @@ public class AttributedString {
* beginIndex and endIndex is out of the text range.
* @see java.text.Annotation
*/
@SuppressWarnings("this-escape")
public AttributedString(AttributedCharacterIterator text,
int beginIndex,
int endIndex,

View file

@ -937,6 +937,7 @@ public abstract class DateFormat extends Format {
* be used, but {@code -1} should be used for values
* that don't correspond to legal {@code Calendar} values
*/
@SuppressWarnings("this-escape")
protected Field(String name, int calendarField) {
super(name);
this.calendarField = calendarField;

View file

@ -449,6 +449,7 @@ public class DecimalFormat extends NumberFormat {
* @see java.text.NumberFormat#getCurrencyInstance
* @see java.text.NumberFormat#getPercentInstance
*/
@SuppressWarnings("this-escape")
public DecimalFormat() {
// Get the pattern for the default locale.
Locale def = Locale.getDefault(Locale.Category.FORMAT);
@ -485,6 +486,7 @@ public class DecimalFormat extends NumberFormat {
* @see java.text.NumberFormat#getCurrencyInstance
* @see java.text.NumberFormat#getPercentInstance
*/
@SuppressWarnings("this-escape")
public DecimalFormat(String pattern) {
// Always applyPattern after the symbols are set
this.symbols = DecimalFormatSymbols.getInstance(Locale.getDefault(Locale.Category.FORMAT));
@ -515,6 +517,7 @@ public class DecimalFormat extends NumberFormat {
* @see java.text.NumberFormat#getPercentInstance
* @see java.text.DecimalFormatSymbols
*/
@SuppressWarnings("this-escape")
public DecimalFormat (String pattern, DecimalFormatSymbols symbols) {
// Always applyPattern after the symbols are set
this.symbols = (DecimalFormatSymbols)symbols.clone();
@ -4199,6 +4202,7 @@ public class DecimalFormat extends NumberFormat {
* @see #getMaximumIntegerDigits
* @since 1.5
*/
@SuppressWarnings("this-escape")
private int maximumIntegerDigits = super.getMaximumIntegerDigits();
/**
@ -4211,6 +4215,7 @@ public class DecimalFormat extends NumberFormat {
* @see #getMinimumIntegerDigits
* @since 1.5
*/
@SuppressWarnings("this-escape")
private int minimumIntegerDigits = super.getMinimumIntegerDigits();
/**
@ -4223,6 +4228,7 @@ public class DecimalFormat extends NumberFormat {
* @see #getMaximumFractionDigits
* @since 1.5
*/
@SuppressWarnings("this-escape")
private int maximumFractionDigits = super.getMaximumFractionDigits();
/**
@ -4235,6 +4241,7 @@ public class DecimalFormat extends NumberFormat {
* @see #getMinimumFractionDigits
* @since 1.5
*/
@SuppressWarnings("this-escape")
private int minimumFractionDigits = super.getMinimumFractionDigits();
/**

View file

@ -1258,6 +1258,7 @@ public abstract class NumberFormat extends Format {
*
* @param name Name of the attribute
*/
@SuppressWarnings("this-escape")
protected Field(String name) {
super(name);
if (this.getClass() == NumberFormat.Field.class) {

View file

@ -278,6 +278,7 @@ public class RuleBasedCollator extends Collator{
* example, build rule "a &lt; ? &lt; d" will cause the constructor to
* throw the ParseException because the '?' is not quoted.
*/
@SuppressWarnings("this-escape")
public RuleBasedCollator(String rules) throws ParseException {
this(rules, Collator.CANONICAL_DECOMPOSITION);
}

View file

@ -204,6 +204,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
* @param c the collection whose elements are to be placed into the deque
* @throws NullPointerException if the specified collection is null
*/
@SuppressWarnings("this-escape")
public ArrayDeque(Collection<? extends E> c) {
this(c.size());
copyElements(c);

View file

@ -165,6 +165,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
* {@code EnumMap} instance and contains no mappings
* @throws NullPointerException if {@code m} is null
*/
@SuppressWarnings("this-escape")
public EnumMap(Map<K, ? extends V> m) {
if (m instanceof EnumMap) {
EnumMap<K, ? extends V> em = (EnumMap<K, ? extends V>) m;

View file

@ -588,6 +588,7 @@ public class GregorianCalendar extends Calendar {
* in the default time zone with the default
* {@link Locale.Category#FORMAT FORMAT} locale.
*/
@SuppressWarnings("this-escape")
public GregorianCalendar() {
this(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT));
setZoneShared(true);
@ -612,6 +613,7 @@ public class GregorianCalendar extends Calendar {
* @param aLocale the given locale.
* @throws NullPointerException if {@code aLocale} is {@code null}
*/
@SuppressWarnings("this-escape")
public GregorianCalendar(Locale aLocale) {
this(TimeZone.getDefaultRef(), aLocale);
setZoneShared(true);
@ -625,6 +627,7 @@ public class GregorianCalendar extends Calendar {
* @param aLocale the given locale.
* @throws NullPointerException if {@code zone} or {@code aLocale} is {@code null}
*/
@SuppressWarnings("this-escape")
public GregorianCalendar(TimeZone zone, Locale aLocale) {
super(zone, aLocale);
gdate = gcal.newCalendarDate(zone);
@ -640,6 +643,7 @@ public class GregorianCalendar extends Calendar {
* Month value is 0-based. e.g., 0 for January.
* @param dayOfMonth the value used to set the {@code DAY_OF_MONTH} calendar field in the calendar.
*/
@SuppressWarnings("this-escape")
public GregorianCalendar(int year, int month, int dayOfMonth) {
this(year, month, dayOfMonth, 0, 0, 0, 0);
}
@ -657,6 +661,7 @@ public class GregorianCalendar extends Calendar {
* @param minute the value used to set the {@code MINUTE} calendar field
* in the calendar.
*/
@SuppressWarnings("this-escape")
public GregorianCalendar(int year, int month, int dayOfMonth, int hourOfDay,
int minute) {
this(year, month, dayOfMonth, hourOfDay, minute, 0, 0);
@ -677,6 +682,7 @@ public class GregorianCalendar extends Calendar {
* @param second the value used to set the {@code SECOND} calendar field
* in the calendar.
*/
@SuppressWarnings("this-escape")
public GregorianCalendar(int year, int month, int dayOfMonth, int hourOfDay,
int minute, int second) {
this(year, month, dayOfMonth, hourOfDay, minute, second, 0);

View file

@ -487,6 +487,7 @@ public class HashMap<K,V> extends AbstractMap<K,V>
* @param m the map whose mappings are to be placed in this map
* @throws NullPointerException if the specified map is null
*/
@SuppressWarnings("this-escape")
public HashMap(Map<? extends K, ? extends V> m) {
this.loadFactor = DEFAULT_LOAD_FACTOR;
putMapEntries(m, false);

View file

@ -116,6 +116,7 @@ public class HashSet<E>
* @param c the collection whose elements are to be placed into this set
* @throws NullPointerException if the specified collection is null
*/
@SuppressWarnings("this-escape")
public HashSet(Collection<? extends E> c) {
map = HashMap.newHashMap(Math.max(c.size(), 12));
addAll(c);

View file

@ -226,6 +226,7 @@ public class Hashtable<K,V>
* @throws NullPointerException if the specified map is null.
* @since 1.2
*/
@SuppressWarnings("this-escape")
public Hashtable(Map<? extends K, ? extends V> t) {
this(Math.max(2*t.size(), 11), 0.75f);
putAll(t);

View file

@ -273,6 +273,7 @@ public class IdentityHashMap<K,V>
* @param m the map whose mappings are to be placed into this map
* @throws NullPointerException if the specified map is null
*/
@SuppressWarnings("this-escape")
public IdentityHashMap(Map<? extends K, ? extends V> m) {
// Allow for a bit of growth
this((int) ((1 + m.size()) * 1.1));

View file

@ -55,6 +55,7 @@ public class InvalidPropertiesFormatException extends IOException {
* @param cause the cause (which is saved for later retrieval by the
* {@link Throwable#getCause()} method).
*/
@SuppressWarnings("this-escape")
public InvalidPropertiesFormatException(Throwable cause) {
super(cause==null ? null : cause.toString());
this.initCause(cause);

View file

@ -474,6 +474,7 @@ public class LinkedHashMap<K,V>
* @param m the map whose mappings are to be placed in this map
* @throws NullPointerException if the specified map is null
*/
@SuppressWarnings("this-escape")
public LinkedHashMap(Map<? extends K, ? extends V> m) {
super();
accessOrder = false;

View file

@ -177,6 +177,7 @@ public class LinkedHashSet<E>
* this set
* @throws NullPointerException if the specified collection is null
*/
@SuppressWarnings("this-escape")
public LinkedHashSet(Collection<? extends E> c) {
super(HashMap.calculateHashMapCapacity(Math.max(c.size(), 12)), .75f, true);
addAll(c);

View file

@ -125,6 +125,7 @@ public class LinkedList<E>
* @param c the collection whose elements are to be placed into this list
* @throws NullPointerException if the specified collection is null
*/
@SuppressWarnings("this-escape")
public LinkedList(Collection<? extends E> c) {
this();
addAll(c);

View file

@ -350,6 +350,7 @@ public class Random implements RandomGenerator, java.io.Serializable {
* @param seed the initial seed
* @see #setSeed(long)
*/
@SuppressWarnings("this-escape")
public Random(long seed) {
if (getClass() == Random.class)
this.seed = new AtomicLong(initialScramble(seed));

View file

@ -156,6 +156,7 @@ public class SimpleTimeZone extends TimeZone {
* @param rawOffset The base time zone offset in milliseconds to GMT.
* @param ID The time zone name that is given to this instance.
*/
@SuppressWarnings("this-escape")
public SimpleTimeZone(int rawOffset, String ID)
{
this.rawOffset = rawOffset;
@ -326,6 +327,7 @@ public class SimpleTimeZone extends TimeZone {
*
* @since 1.4
*/
@SuppressWarnings("this-escape")
public SimpleTimeZone(int rawOffset, String ID,
int startMonth, int startDay, int startDayOfWeek,
int startTime, int startTimeMode,

View file

@ -178,6 +178,7 @@ public class Timer {
* @throws NullPointerException if {@code name} is null
* @since 1.5
*/
@SuppressWarnings("this-escape")
public Timer(String name, boolean isDaemon) {
var threadReaper = new ThreadReaper(queue, thread);
this.cleanup = CleanerFactory.cleaner().register(this, threadReaper);

View file

@ -193,6 +193,7 @@ public class TreeMap<K,V>
* or are not mutually comparable
* @throws NullPointerException if the specified map is null
*/
@SuppressWarnings("this-escape")
public TreeMap(Map<? extends K, ? extends V> m) {
comparator = null;
putAll(m);

View file

@ -159,6 +159,7 @@ public class TreeSet<E> extends AbstractSet<E>
* not {@link Comparable}, or are not mutually comparable
* @throws NullPointerException if the specified collection is null
*/
@SuppressWarnings("this-escape")
public TreeSet(Collection<? extends E> c) {
this();
addAll(c);
@ -171,6 +172,7 @@ public class TreeSet<E> extends AbstractSet<E>
* @param s sorted set whose elements will comprise the new set
* @throws NullPointerException if the specified sorted set is null
*/
@SuppressWarnings("this-escape")
public TreeSet(SortedSet<E> s) {
this(s.comparator());
addAll(s);

View file

@ -256,6 +256,7 @@ public class WeakHashMap<K,V>
* @throws NullPointerException if the specified map is null
* @since 1.3
*/
@SuppressWarnings("this-escape")
public WeakHashMap(Map<? extends K, ? extends V> m) {
this(Math.max((int) Math.ceil(m.size() / (double)DEFAULT_LOAD_FACTOR),
DEFAULT_INITIAL_CAPACITY),

View file

@ -847,6 +847,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
*
* @param m the map
*/
@SuppressWarnings("this-escape")
public ConcurrentHashMap(Map<? extends K, ? extends V> m) {
this(m.size());
putAll(m);

View file

@ -1096,6 +1096,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* @throws NullPointerException if the specified map or any of its keys
* or values are null
*/
@SuppressWarnings("this-escape")
public ConcurrentSkipListMap(Map<? extends K, ? extends V> m) {
this.comparator = null;
putAll(m);
@ -1110,6 +1111,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* @throws NullPointerException if the specified sorted map or any of
* its keys or values are null
*/
@SuppressWarnings("this-escape")
public ConcurrentSkipListMap(SortedMap<K, ? extends V> m) {
this.comparator = m.comparator();
buildFromSorted(m); // initializes transients

View file

@ -137,6 +137,7 @@ public class ConcurrentSkipListSet<E>
* @throws NullPointerException if the specified collection or any
* of its elements are null
*/
@SuppressWarnings("this-escape")
public ConcurrentSkipListSet(Collection<? extends E> c) {
m = new ConcurrentSkipListMap<E,Object>();
addAll(c);
@ -150,6 +151,7 @@ public class ConcurrentSkipListSet<E>
* @throws NullPointerException if the specified sorted set or any
* of its elements are null
*/
@SuppressWarnings("this-escape")
public ConcurrentSkipListSet(SortedSet<E> s) {
m = new ConcurrentSkipListMap<E,Object>(s.comparator());
addAll(s);

View file

@ -141,6 +141,7 @@ public class DelayQueue<E extends Delayed> extends AbstractQueue<E>
* @throws NullPointerException if the specified collection or any
* of its elements are null
*/
@SuppressWarnings("this-escape")
public DelayQueue(Collection<? extends E> c) {
this.addAll(c);
}

View file

@ -99,6 +99,7 @@ public class ForkJoinWorkerThread extends Thread {
* @throws NullPointerException if pool is null
* @since 19
*/
@SuppressWarnings("this-escape")
protected ForkJoinWorkerThread(ThreadGroup group, ForkJoinPool pool,
boolean preserveThreadLocals) {
this(group, pool, false, !preserveThreadLocals);
@ -110,6 +111,7 @@ public class ForkJoinWorkerThread extends Thread {
* @param pool the pool this thread works in
* @throws NullPointerException if pool is null
*/
@SuppressWarnings("this-escape")
protected ForkJoinWorkerThread(ForkJoinPool pool) {
this(null, pool, false, false);
}

View file

@ -195,6 +195,7 @@ public class LinkedBlockingDeque<E>
* @throws NullPointerException if the specified collection or any
* of its elements are null
*/
@SuppressWarnings("this-escape")
public LinkedBlockingDeque(Collection<? extends E> c) {
this(Integer.MAX_VALUE);
addAll(c);

View file

@ -413,6 +413,7 @@ public class StructuredTaskScope<T> implements AutoCloseable {
* @param name the name of the task scope, can be null
* @param factory the thread factory
*/
@SuppressWarnings("this-escape")
public StructuredTaskScope(String name, ThreadFactory factory) {
this.factory = Objects.requireNonNull(factory, "'factory' is null");
if (name == null)

View file

@ -1297,6 +1297,7 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
* @throws NullPointerException if {@code workQueue}
* or {@code threadFactory} or {@code handler} is null
*/
@SuppressWarnings("this-escape")
public ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,

View file

@ -120,6 +120,7 @@ public class JarInputStream extends ZipInputStream {
* it is signed.
* @throws IOException if an I/O error has occurred
*/
@SuppressWarnings("this-escape")
public JarInputStream(InputStream in, boolean verify) throws IOException {
super(in);
this.doVerify = verify;

View file

@ -53,6 +53,7 @@ public class JarOutputStream extends ZipOutputStream {
* @param man the optional {@code Manifest}
* @throws IOException if an I/O error has occurred
*/
@SuppressWarnings("this-escape")
public JarOutputStream(OutputStream out, Manifest man) throws IOException {
super(out);
if (man == null) {

View file

@ -73,6 +73,7 @@ public class Manifest implements Cloneable {
* @param is the input stream containing manifest data
* @throws IOException if an I/O error has occurred
*/
@SuppressWarnings("this-escape")
public Manifest(InputStream is) throws IOException {
this(null, is, null);
}

View file

@ -196,6 +196,7 @@ public class Deflater {
* @param level the compression level (0-9)
* @param nowrap if true then use GZIP compatible compression
*/
@SuppressWarnings("this-escape")
public Deflater(int level, boolean nowrap) {
this.level = level;
this.strategy = DEFAULT_STRATEGY;

View file

@ -130,6 +130,7 @@ public class Inflater {
*
* @param nowrap if true then support GZIP compatible compression
*/
@SuppressWarnings("this-escape")
public Inflater(boolean nowrap) {
this.zsRef = new InflaterZStreamRef(this, init(nowrap));
}

View file

@ -227,6 +227,7 @@ public class ZipFile implements ZipConstants, Closeable {
*
* @since 1.7
*/
@SuppressWarnings("this-escape")
public ZipFile(File file, int mode, Charset charset) throws IOException
{
if (((mode & OPEN_READ) == 0) ||