Skip to content

Commit fbd15b2

Browse files
committed
8325189: Enable this-escape javac warning in java.base
Reviewed-by: alanb, erikj, naoto, smarks, ihse, joehw, lancea, weijun
1 parent 299a8ee commit fbd15b2

File tree

93 files changed

+151
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+151
-2
lines changed

make/modules/java.base/Java.gmk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
# questions.
2424
#
2525

26-
DISABLED_WARNINGS_java += this-escape
26+
# The base module should be built with all warnings enabled. When a
27+
# new warning is added to javac, it can be temporarily added to the
28+
# disabled warnings list.
29+
#
30+
# DISABLED_WARNINGS_java +=
2731

2832
DOCLINT += -Xdoclint:all/protected \
2933
'-Xdoclint/package:java.*,javax.*'

src/java.base/share/classes/com/sun/security/ntlm/Server.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public abstract class Server extends NTLM {
6464
* @param domain the domain, must not be null
6565
* @throws NTLMException if {@code domain} is null.
6666
*/
67+
@SuppressWarnings("this-escape")
6768
public Server(String version, String domain) throws NTLMException {
6869
super(version);
6970
if (domain == null) {

src/java.base/share/classes/java/io/FileInputStream.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ public FileInputStream(String name) throws FileNotFoundException {
133133
* @see java.io.File#getPath()
134134
* @see java.lang.SecurityManager#checkRead(java.lang.String)
135135
*/
136+
@SuppressWarnings("this-escape")
136137
public FileInputStream(File file) throws FileNotFoundException {
137138
String name = (file != null ? file.getPath() : null);
138139
@SuppressWarnings("removal")
@@ -177,6 +178,7 @@ public FileInputStream(File file) throws FileNotFoundException {
177178
* file descriptor.
178179
* @see SecurityManager#checkRead(java.io.FileDescriptor)
179180
*/
181+
@SuppressWarnings("this-escape")
180182
public FileInputStream(FileDescriptor fdObj) {
181183
@SuppressWarnings("removal")
182184
SecurityManager security = System.getSecurityManager();

src/java.base/share/classes/java/io/FileOutputStream.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ public FileOutputStream(File file) throws FileNotFoundException {
208208
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
209209
* @since 1.4
210210
*/
211+
@SuppressWarnings("this-escape")
211212
public FileOutputStream(File file, boolean append)
212213
throws FileNotFoundException
213214
{
@@ -254,6 +255,7 @@ public FileOutputStream(File file, boolean append)
254255
* write access to the file descriptor
255256
* @see java.lang.SecurityManager#checkWrite(java.io.FileDescriptor)
256257
*/
258+
@SuppressWarnings("this-escape")
257259
public FileOutputStream(FileDescriptor fdObj) {
258260
@SuppressWarnings("removal")
259261
SecurityManager security = System.getSecurityManager();

src/java.base/share/classes/java/io/InputStreamReader.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ private static Object lockFor(InputStreamReader reader) {
8484
*
8585
* @see Charset#defaultCharset()
8686
*/
87+
@SuppressWarnings("this-escape")
8788
public InputStreamReader(InputStream in) {
8889
super(in);
8990
Charset cs = Charset.defaultCharset();
@@ -102,6 +103,7 @@ public InputStreamReader(InputStream in) {
102103
* @throws UnsupportedEncodingException
103104
* If the named charset is not supported
104105
*/
106+
@SuppressWarnings("this-escape")
105107
public InputStreamReader(InputStream in, String charsetName)
106108
throws UnsupportedEncodingException
107109
{
@@ -119,6 +121,7 @@ public InputStreamReader(InputStream in, String charsetName)
119121
*
120122
* @since 1.4
121123
*/
124+
@SuppressWarnings("this-escape")
122125
public InputStreamReader(InputStream in, Charset cs) {
123126
super(in);
124127
if (cs == null)
@@ -134,6 +137,7 @@ public InputStreamReader(InputStream in, Charset cs) {
134137
*
135138
* @since 1.4
136139
*/
140+
@SuppressWarnings("this-escape")
137141
public InputStreamReader(InputStream in, CharsetDecoder dec) {
138142
super(in);
139143
if (dec == null)

src/java.base/share/classes/java/io/ObjectInputStream.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ private static class Logging {
390390
* @see ObjectInputStream#readFields()
391391
* @see ObjectOutputStream#ObjectOutputStream(OutputStream)
392392
*/
393+
@SuppressWarnings("this-escape")
393394
public ObjectInputStream(InputStream in) throws IOException {
394395
verifySubclass();
395396
bin = new BlockDataInputStream(in);

src/java.base/share/classes/java/io/ObjectOutputStream.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ protected Boolean computeValue(Class<?> type) {
246246
* @see ObjectOutputStream#putFields()
247247
* @see ObjectInputStream#ObjectInputStream(InputStream)
248248
*/
249+
@SuppressWarnings("this-escape")
249250
public ObjectOutputStream(OutputStream out) throws IOException {
250251
verifySubclass();
251252
bout = new BlockDataOutputStream(out);

src/java.base/share/classes/java/io/OutputStreamWriter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ private static Object lockFor(OutputStreamWriter writer) {
101101
* @throws UnsupportedEncodingException
102102
* If the named encoding is not supported
103103
*/
104+
@SuppressWarnings("this-escape")
104105
public OutputStreamWriter(OutputStream out, String charsetName)
105106
throws UnsupportedEncodingException
106107
{
@@ -118,6 +119,7 @@ public OutputStreamWriter(OutputStream out, String charsetName)
118119
* @param out An OutputStream
119120
* @see Charset#defaultCharset()
120121
*/
122+
@SuppressWarnings("this-escape")
121123
public OutputStreamWriter(OutputStream out) {
122124
super(out);
123125
se = StreamEncoder.forOutputStreamWriter(out, lockFor(this),
@@ -135,6 +137,7 @@ public OutputStreamWriter(OutputStream out) {
135137
*
136138
* @since 1.4
137139
*/
140+
@SuppressWarnings("this-escape")
138141
public OutputStreamWriter(OutputStream out, Charset cs) {
139142
super(out);
140143
if (cs == null)
@@ -153,6 +156,7 @@ public OutputStreamWriter(OutputStream out, Charset cs) {
153156
*
154157
* @since 1.4
155158
*/
159+
@SuppressWarnings("this-escape")
156160
public OutputStreamWriter(OutputStream out, CharsetEncoder enc) {
157161
super(out);
158162
if (enc == null)

src/java.base/share/classes/java/io/PipedInputStream.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public PipedInputStream(PipedOutputStream src) throws IOException {
122122
* @throws IllegalArgumentException if {@code pipeSize <= 0}.
123123
* @since 1.6
124124
*/
125+
@SuppressWarnings("this-escape")
125126
public PipedInputStream(PipedOutputStream src, int pipeSize)
126127
throws IOException {
127128
initPipe(pipeSize);

src/java.base/share/classes/java/io/PipedOutputStream.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ more sophisticated. Either using thread groups (but what about
5959
* @param snk The piped input stream to connect to.
6060
* @throws IOException if an I/O error occurs.
6161
*/
62+
@SuppressWarnings("this-escape")
6263
public PipedOutputStream(PipedInputStream snk) throws IOException {
6364
connect(snk);
6465
}

0 commit comments

Comments
 (0)