Skip to content

Commit 5f460e1

Browse files
authored
Annotate GeneralSecurityException. (#137)
It would be nice if the type had explicit documentation to say that a null message is allowed. But it doesn't, so I appeal to the policy that we already have in place for types like `Exception`.
1 parent 434a7e9 commit 5f460e1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/java.base/share/classes/java/security/GeneralSecurityException.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
package java.security;
2727

28+
import org.jspecify.annotations.NullMarked;
29+
import org.jspecify.annotations.Nullable;
30+
2831
/**
2932
* The {@code GeneralSecurityException} class is a generic
3033
* security exception class that provides type safety for all the
@@ -33,7 +36,7 @@
3336
* @author Jan Luehe
3437
* @since 1.2
3538
*/
36-
39+
@NullMarked
3740
public class GeneralSecurityException extends Exception {
3841

3942
@java.io.Serial
@@ -54,7 +57,7 @@ public GeneralSecurityException() {
5457
*
5558
* @param msg the detail message.
5659
*/
57-
public GeneralSecurityException(String msg) {
60+
public GeneralSecurityException(@Nullable String msg) {
5861
super(msg);
5962
}
6063

@@ -69,7 +72,7 @@ public GeneralSecurityException(String msg) {
6972
* and indicates that the cause is nonexistent or unknown.)
7073
* @since 1.5
7174
*/
72-
public GeneralSecurityException(String message, Throwable cause) {
75+
public GeneralSecurityException(@Nullable String message, @Nullable Throwable cause) {
7376
super(message, cause);
7477
}
7578

@@ -84,7 +87,7 @@ public GeneralSecurityException(String message, Throwable cause) {
8487
* and indicates that the cause is nonexistent or unknown.)
8588
* @since 1.5
8689
*/
87-
public GeneralSecurityException(Throwable cause) {
90+
public GeneralSecurityException(@Nullable Throwable cause) {
8891
super(cause);
8992
}
9093
}

0 commit comments

Comments
 (0)