From d46216fc43a20af8adb54e53c17a3f1e63d893cb Mon Sep 17 00:00:00 2001 From: mohamedsamehsalah Date: Wed, 31 May 2023 22:09:37 +0200 Subject: [PATCH] Add @Nullable annotation --- .../tech/picnic/errorprone/bugpatterns/NestedPublishers.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedPublishers.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedPublishers.java index 435f07f8033..e9566911f4b 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedPublishers.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedPublishers.java @@ -21,6 +21,7 @@ import com.sun.source.tree.MethodInvocationTree; import com.sun.tools.javac.code.Type; import java.util.function.Function; +import org.jspecify.annotations.Nullable; import org.reactivestreams.Publisher; import reactor.core.publisher.Flux; @@ -62,7 +63,7 @@ public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState } private static boolean isNestedPublisher( - VisitorState state, Type publisherOfPublisherType, Type treeType) { + VisitorState state, @Nullable Type publisherOfPublisherType, Type treeType) { return publisherOfPublisherType != null && state.getTypes().isSubtype(treeType, publisherOfPublisherType); } @@ -72,7 +73,7 @@ private static boolean isNestedPublisher( * Flux#groupBy(Function)}. */ private static boolean isTypeArgumentGroupedFlux( - VisitorState state, Type groupedFluxType, Type treeType) { + VisitorState state, @Nullable Type groupedFluxType, Type treeType) { return groupedFluxType != null && treeType.getTypeArguments().stream() .anyMatch(typez -> ASTHelpers.isSameType(typez, groupedFluxType, state));