Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opportunistically add a few @Nullable annotations to ObjectInputFilter. #91

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading