mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +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
|
@ -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)
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue