Skip to content

Commit

Permalink
Opportunistically add a new @Nullable annotations to `ObjectInputFi…
Browse files Browse the repository at this point in the history
…lter`. (#91)

I looked at this class by accident when I was reviewing changes to
classes that are `@NullMarked`. (`ObjectInputFilter` is not.) Still,
since I saw a few places to add `@Nullable`, I'm doing that now, even as
I decline to fully null-mark the class.
  • Loading branch information
cpovirk authored Oct 7, 2024
1 parent f8acc90 commit dc252a2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/java.base/share/classes/java/io/ObjectInputFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

package java.io;

import org.jspecify.annotations.Nullable;

import jdk.internal.access.SharedSecrets;
import jdk.internal.util.StaticProperty;

Expand Down Expand Up @@ -379,7 +381,7 @@ static ObjectInputFilter rejectFilter(Predicate<Class<?>> predicate, Status othe
* @return an {@link ObjectInputFilter} that merges the status of the filter and another filter
* @since 17
*/
static ObjectInputFilter merge(ObjectInputFilter filter, ObjectInputFilter anotherFilter) {
static ObjectInputFilter merge(ObjectInputFilter filter, @Nullable ObjectInputFilter anotherFilter) {
Objects.requireNonNull(filter, "filter");
return (anotherFilter == null) ? filter : new Config.MergeFilter(filter, anotherFilter);
}
Expand Down Expand Up @@ -445,7 +447,7 @@ interface FilterInfo {
*
* @return class of an object being deserialized; may be null
*/
Class<?> serialClass();
@Nullable Class<?> serialClass();

/**
* The number of array elements when deserializing an array of the class.
Expand Down Expand Up @@ -717,7 +719,7 @@ private static void traceFilter(String msg, Object... args) {
* system property {@code jdk.serialFilter} or
* the security property {@code jdk.serialFilter} fails.
*/
public static ObjectInputFilter getSerialFilter() {
public static @Nullable ObjectInputFilter getSerialFilter() {
if (invalidFilterMessage != null) {
throw new IllegalStateException(invalidFilterMessage);
}
Expand Down

0 comments on commit dc252a2

Please sign in to comment.