mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8325189
: Enable this-escape javac warning in java.base
Reviewed-by: alanb, erikj, naoto, smarks, ihse, joehw, lancea, weijun
This commit is contained in:
parent
299a8ee68d
commit
fbd15b2087
93 changed files with 151 additions and 2 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue