From 7c891d35ce84a508494bb2de7494eb6f1b14aca5 Mon Sep 17 00:00:00 2001 From: Manu Sridharan Date: Thu, 12 Oct 2023 17:25:00 -0700 Subject: [PATCH] move null check --- .../main/java/com/uber/nullaway/GenericsChecks.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nullaway/src/main/java/com/uber/nullaway/GenericsChecks.java b/nullaway/src/main/java/com/uber/nullaway/GenericsChecks.java index ce31aebbef..b6416c77ee 100644 --- a/nullaway/src/main/java/com/uber/nullaway/GenericsChecks.java +++ b/nullaway/src/main/java/com/uber/nullaway/GenericsChecks.java @@ -879,11 +879,6 @@ public static Nullness getGenericMethodParameterNullness( VisitorState state, Config config) { Type enclosingType = getTypeForSymbol(enclosingSymbol, state); - if (enclosingType == null) { - // we have no additional information from generics, so return NONNULL (presence of a @Nullable - // annotation should have been handled by the caller) - return Nullness.NONNULL; - } return getGenericMethodParameterNullness(parameterIndex, method, enclosingType, state, config); } @@ -904,9 +899,14 @@ public static Nullness getGenericMethodParameterNullness( public static Nullness getGenericMethodParameterNullness( int parameterIndex, Symbol.MethodSymbol method, - Type enclosingType, + @Nullable Type enclosingType, VisitorState state, Config config) { + if (enclosingType == null) { + // we have no additional information from generics, so return NONNULL (presence of a @Nullable + // annotation should have been handled by the caller) + return Nullness.NONNULL; + } Type methodType = state.getTypes().memberType(enclosingType, method); Type paramType = methodType.getParameterTypes().get(parameterIndex); return getTypeNullness(paramType, config);