Skip to content

Commit

Permalink
Add missing @Nullable annotations in serialization streams. (eisop#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpovirk authored Aug 21, 2023
1 parent b1924a2 commit 24179f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/io/ObjectInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public interface ObjectInput extends DataInput, AutoCloseable {
* @exception IOException If any of the usual Input/Output
* related exceptions occur.
*/
public Object readObject()
public @Nullable Object readObject()
throws ClassNotFoundException, IOException;

/**
Expand Down
10 changes: 5 additions & 5 deletions src/java.base/share/classes/java/io/ObjectInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ protected ObjectInputStream() throws IOException, SecurityException {
* stream instead of objects.
* @throws IOException Any of the usual Input/Output related exceptions.
*/
public final Object readObject()
public final @Nullable Object readObject()
throws IOException, ClassNotFoundException
{
if (enableOverride) {
Expand Down Expand Up @@ -467,7 +467,7 @@ public final Object readObject()
* @see #readObject()
* @since 1.2
*/
protected Object readObjectOverride()
protected @Nullable Object readObjectOverride()
throws IOException, ClassNotFoundException
{
return null;
Expand Down Expand Up @@ -522,7 +522,7 @@ protected Object readObjectOverride()
* @throws IOException if an I/O error occurs during deserialization
* @since 1.4
*/
public Object readUnshared() throws IOException, ClassNotFoundException {
public @Nullable Object readUnshared() throws IOException, ClassNotFoundException {
// if nested read, passHandle contains handle of enclosing object
int outerHandle = passHandle;
try {
Expand Down Expand Up @@ -1167,7 +1167,7 @@ public String readUTF() throws IOException {
* @return the serialization filter for the stream; may be null
* @since 9
*/
public final ObjectInputFilter getObjectInputFilter() {
public final @Nullable ObjectInputFilter getObjectInputFilter() {
return serialFilter;
}

Expand Down Expand Up @@ -1240,7 +1240,7 @@ public final ObjectInputFilter getObjectInputFilter() {
* is not {@code null} and is not the process-wide filter
* @since 9
*/
public final void setObjectInputFilter(ObjectInputFilter filter) {
public final void setObjectInputFilter(@Nullable ObjectInputFilter filter) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ObjectStreamConstants.SERIAL_FILTER_PERMISSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public final void writeObject(@Nullable Object obj) throws IOException {
* @see #writeObject(Object)
* @since 1.2
*/
protected void writeObjectOverride(Object obj) throws IOException {
protected void writeObjectOverride(@Nullable Object obj) throws IOException {
}

/**
Expand Down

0 comments on commit 24179f8

Please sign in to comment.