From f8acc90a186ea1bfd59122d4ed5ba58574d9a39c Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Mon, 7 Oct 2024 11:43:15 -0400 Subject: [PATCH] Annotate some new APIs in `Exception` classes. (#82) --- .../share/classes/java/io/InvalidObjectException.java | 2 +- .../share/classes/java/io/ObjectStreamException.java | 4 ++-- .../share/classes/java/lang/NullPointerException.java | 2 +- src/java.base/share/classes/java/net/SocketException.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/java.base/share/classes/java/io/InvalidObjectException.java b/src/java.base/share/classes/java/io/InvalidObjectException.java index 8379682f040..5c930450dda 100644 --- a/src/java.base/share/classes/java/io/InvalidObjectException.java +++ b/src/java.base/share/classes/java/io/InvalidObjectException.java @@ -61,7 +61,7 @@ public InvalidObjectException(@Nullable String reason) { * @see ObjectInputValidation * @since 19 */ - public InvalidObjectException(String reason, Throwable cause) { + public InvalidObjectException(@Nullable String reason, @Nullable Throwable cause) { super(reason, cause); } } diff --git a/src/java.base/share/classes/java/io/ObjectStreamException.java b/src/java.base/share/classes/java/io/ObjectStreamException.java index a5478498704..c6c9d51dad8 100644 --- a/src/java.base/share/classes/java/io/ObjectStreamException.java +++ b/src/java.base/share/classes/java/io/ObjectStreamException.java @@ -56,7 +56,7 @@ protected ObjectStreamException(@Nullable String message) { * @param cause the cause * @since 19 */ - protected ObjectStreamException(String message, Throwable cause) { + protected ObjectStreamException(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } @@ -73,7 +73,7 @@ protected ObjectStreamException() { * @param cause the cause * @since 19 */ - protected ObjectStreamException(Throwable cause) { + protected ObjectStreamException(@Nullable Throwable cause) { super(cause); } } diff --git a/src/java.base/share/classes/java/lang/NullPointerException.java b/src/java.base/share/classes/java/lang/NullPointerException.java index bceb775add9..7c8e46e89bb 100644 --- a/src/java.base/share/classes/java/lang/NullPointerException.java +++ b/src/java.base/share/classes/java/lang/NullPointerException.java @@ -112,7 +112,7 @@ public synchronized Throwable fillInStackTrace() { * * @return the detail message string, which may be {@code null}. */ - public String getMessage() { + public @Nullable String getMessage() { String message = super.getMessage(); if (message == null) { synchronized(this) { diff --git a/src/java.base/share/classes/java/net/SocketException.java b/src/java.base/share/classes/java/net/SocketException.java index 18c1c0eff49..4cd8912c8eb 100644 --- a/src/java.base/share/classes/java/net/SocketException.java +++ b/src/java.base/share/classes/java/net/SocketException.java @@ -65,7 +65,7 @@ public SocketException() { * @param cause the cause * @since 19 */ - public SocketException(String msg, Throwable cause) { + public SocketException(@Nullable String msg, @Nullable Throwable cause) { super(msg, cause); } @@ -76,7 +76,7 @@ public SocketException(String msg, Throwable cause) { * @param cause the cause * @since 19 */ - public SocketException(Throwable cause) { + public SocketException(@Nullable Throwable cause) { super(cause); } }