Skip to content

Commit dad7446

Browse files
committed
Annotated io/nio/concurrent exceptions
1 parent 4690577 commit dad7446

29 files changed

+144
-38
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
package java.io;
2727

28+
import org.checkerframework.checker.nullness.qual.Nullable;
29+
import org.checkerframework.framework.qual.AnnotatedFor;
30+
2831
/**
2932
* Signals that an end of file or end of stream has been reached
3033
* unexpectedly during input.
@@ -38,6 +41,7 @@
3841
* @see java.io.IOException
3942
* @since 1.0
4043
*/
44+
@AnnotatedFor({"nullness"})
4145
public class EOFException extends IOException {
4246
@java.io.Serial
4347
private static final long serialVersionUID = 6433858223774886977L;
@@ -58,7 +62,7 @@ public EOFException() {
5862
*
5963
* @param s the detail message.
6064
*/
61-
public EOFException(String s) {
65+
public EOFException(@Nullable String s) {
6266
super(s);
6367
}
6468
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
package java.io;
2727

28+
import org.checkerframework.checker.nullness.qual.Nullable;
29+
import org.checkerframework.framework.qual.AnnotatedFor;
2830

2931
/**
3032
* Signals that an attempt to open the file denoted by a specified pathname
@@ -39,6 +41,7 @@
3941
* @since 1.0
4042
*/
4143

44+
@AnnotatedFor({"nullness"})
4245
public class FileNotFoundException extends IOException {
4346
@java.io.Serial
4447
private static final long serialVersionUID = -897856973823710492L;
@@ -60,7 +63,7 @@ public FileNotFoundException() {
6063
*
6164
* @param s the detail message.
6265
*/
63-
public FileNotFoundException(String s) {
66+
public FileNotFoundException(@Nullable String s) {
6467
super(s);
6568
}
6669

@@ -73,7 +76,7 @@ public FileNotFoundException(String s) {
7376
*
7477
* @since 1.2
7578
*/
76-
private FileNotFoundException(String path, String reason) {
79+
private FileNotFoundException(String path, @Nullable String reason) {
7780
super(path + ((reason == null)
7881
? ""
7982
: " (" + reason + ")"));

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@
2525

2626
package java.io;
2727

28+
import org.checkerframework.checker.nullness.qual.Nullable;
29+
import org.checkerframework.framework.qual.AnnotatedFor;
2830
/**
2931
* Thrown when a serious I/O error has occurred.
3032
*
3133
* @author Xueming Shen
3234
* @since 1.6
3335
*/
36+
@AnnotatedFor({"nullness"})
3437
public class IOError extends Error {
3538
/**
3639
* Constructs a new instance of IOError with the specified cause. The
@@ -42,7 +45,7 @@ public class IOError extends Error {
4245
* The cause of this error, or {@code null} if the cause
4346
* is not known
4447
*/
45-
public IOError(Throwable cause) {
48+
public IOError(@Nullable Throwable cause) {
4649
super(cause);
4750
}
4851

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@
2525

2626
package java.io;
2727

28+
import org.checkerframework.checker.nullness.qual.Nullable;
29+
import org.checkerframework.framework.qual.AnnotatedFor;
30+
2831
/**
2932
* Thrown when serialization or deserialization is not active.
3033
*
3134
* @since 1.1
3235
*/
36+
@AnnotatedFor({"nullness"})
3337
public class NotActiveException extends ObjectStreamException {
3438

3539
@java.io.Serial
@@ -40,7 +44,7 @@ public class NotActiveException extends ObjectStreamException {
4044
*
4145
* @param reason a String describing the reason for the exception.
4246
*/
43-
public NotActiveException(String reason) {
47+
public NotActiveException(@Nullable String reason) {
4448
super(reason);
4549
}
4650

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@
2525

2626
package java.io;
2727

28+
import org.checkerframework.checker.nullness.qual.Nullable;
29+
import org.checkerframework.framework.qual.AnnotatedFor;
30+
2831
/**
2932
* Thrown when an instance is required to have a Serializable interface.
3033
* The serialization runtime or the class of the instance can throw
3134
* this exception. The argument should be the name of the class.
3235
*
3336
* @since 1.1
3437
*/
38+
@AnnotatedFor({"nullness"})
3539
public class NotSerializableException extends ObjectStreamException {
3640

3741
@java.io.Serial
@@ -42,7 +46,7 @@ public class NotSerializableException extends ObjectStreamException {
4246
*
4347
* @param classname Class of the instance being serialized/deserialized.
4448
*/
45-
public NotSerializableException(String classname) {
49+
public NotSerializableException(@Nullable String classname) {
4650
super(classname);
4751
}
4852

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525
package java.io;
2626

27+
import org.checkerframework.framework.qual.AnnotatedFor;
28+
2729
/**
2830
* Exception indicating the failure of an object read operation due to
2931
* unread primitive data, or the end of data belonging to a serialized
@@ -44,6 +46,7 @@
4446
*
4547
* @since 1.1
4648
*/
49+
@AnnotatedFor({"nullness"})
4750
public class OptionalDataException extends ObjectStreamException {
4851

4952
@java.io.Serial

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@
2525

2626
package java.io;
2727

28+
import org.checkerframework.checker.nullness.qual.Nullable;
29+
import org.checkerframework.framework.qual.AnnotatedFor;
2830
/**
2931
* Thrown when control information that was read from an object stream
3032
* violates internal consistency checks.
3133
*
3234
* @since 1.1
3335
*/
36+
@AnnotatedFor({"nullness"})
3437
public class StreamCorruptedException extends ObjectStreamException {
3538

3639
@java.io.Serial
@@ -41,7 +44,7 @@ public class StreamCorruptedException extends ObjectStreamException {
4144
*
4245
* @param reason String describing the reason for the exception.
4346
*/
44-
public StreamCorruptedException(String reason) {
47+
public StreamCorruptedException(@Nullable String reason) {
4548
super(reason);
4649
}
4750

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
package java.io;
2727

28+
import org.checkerframework.checker.nullness.qual.Nullable;
29+
import org.checkerframework.framework.qual.AnnotatedFor;
30+
2831
/**
2932
* Signals that a sync operation has failed.
3033
*
@@ -33,6 +36,7 @@
3336
* @see java.io.IOException
3437
* @since 1.1
3538
*/
39+
@AnnotatedFor({"nullness"})
3640
public class SyncFailedException extends IOException {
3741
@java.io.Serial
3842
private static final long serialVersionUID = -2353342684412443330L;
@@ -43,7 +47,7 @@ public class SyncFailedException extends IOException {
4347
*
4448
* @param desc a String describing the exception.
4549
*/
46-
public SyncFailedException(String desc) {
50+
public SyncFailedException(@Nullable String desc) {
4751
super(desc);
4852
}
4953
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
package java.io;
2727

28+
import org.checkerframework.checker.nullness.qual.Nullable;
29+
import org.checkerframework.framework.qual.AnnotatedFor;
30+
2831
/**
2932
* Signals that a malformed string in
3033
* <a href="DataInput.html#modified-utf-8">modified UTF-8</a>
@@ -42,6 +45,7 @@
4245
* @see java.io.IOException
4346
* @since 1.0
4447
*/
48+
@AnnotatedFor({"nullness"})
4549
public class UTFDataFormatException extends IOException {
4650
@java.io.Serial
4751
private static final long serialVersionUID = 420743449228280612L;
@@ -63,7 +67,7 @@ public UTFDataFormatException() {
6367
*
6468
* @param s the detail message.
6569
*/
66-
public UTFDataFormatException(String s) {
70+
public UTFDataFormatException(@Nullable String s) {
6771
super(s);
6872
}
6973
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@
2424
*/
2525
package java.io;
2626

27+
import org.checkerframework.checker.nullness.qual.Nullable;
28+
import org.checkerframework.framework.qual.AnnotatedFor;
29+
2730
/**
2831
* The Character Encoding is not supported.
2932
*
3033
* @author Asmus Freytag
3134
* @since 1.1
3235
*/
36+
@AnnotatedFor({"nullness"})
3337
public class UnsupportedEncodingException
3438
extends IOException
3539
{
@@ -47,7 +51,7 @@ public UnsupportedEncodingException() {
4751
* Constructs an UnsupportedEncodingException with a detail message.
4852
* @param s Describes the reason for the exception.
4953
*/
50-
public UnsupportedEncodingException(String s) {
54+
public UnsupportedEncodingException(@Nullable String s) {
5155
super(s);
5256
}
5357
}

0 commit comments

Comments
 (0)