diff --git a/nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java b/nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java index d067bcd4d7..b4c0e7a3bc 100644 --- a/nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java +++ b/nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java @@ -898,36 +898,37 @@ public static Nullness getGenericParameterNullnessAtInvocation( // Substitute the argument and return types within the MethodType substitutedParamTypes = - state - .getTypes() - .subst( - methodTypeInsideForAll.argtypes, - forAllType.tvars, // The type variables from the ForAll - explicitTypeArgs // The actual type arguments from the method invocation - ); + state + .getTypes() + .subst( + methodTypeInsideForAll.argtypes, + forAllType.tvars, // The type variables from the ForAll + explicitTypeArgs // The actual type arguments from the method invocation + ); if (Objects.equals( - getTypeNullness(substitutedParamTypes.get(paramIndex), config), Nullness.NULLABLE)) { + getTypeNullness(substitutedParamTypes.get(paramIndex), config), Nullness.NULLABLE)) { return Nullness.NULLABLE; } } -// } else { -// // If it's not a ForAll type, handle it as a normal MethodType -// Type.MethodType methodTypeElse = (Type.MethodType) invokedMethodSymbol.type; -// substitutedParamTypes = -// state -// .getTypes() -// .subst( -// methodTypeElse.argtypes, -// invokedMethodSymbol.type.getTypeArguments(), -// explicitTypeArgs); -// } + // } else { + // // If it's not a ForAll type, handle it as a normal MethodType + // Type.MethodType methodTypeElse = (Type.MethodType) invokedMethodSymbol.type; + // substitutedParamTypes = + // state + // .getTypes() + // .subst( + // methodTypeElse.argtypes, + // invokedMethodSymbol.type.getTypeArguments(), + // explicitTypeArgs); + // } -// if (Objects.equals( -// getTypeNullness(substitutedParamTypes.get(paramIndex), config), Nullness.NULLABLE)) { -// return Nullness.NULLABLE; -// } + // if (Objects.equals( + // getTypeNullness(substitutedParamTypes.get(paramIndex), config), Nullness.NULLABLE)) { + // return Nullness.NULLABLE; + // } - // problem is that it returns nullable from the declaration even though the parameter itself is nonnull + // problem is that it returns nullable from the declaration even though the parameter itself is + // nonnull if (!(tree.getMethodSelect() instanceof MemberSelectTree) || invokedMethodSymbol.isStatic()) { return Nullness.NONNULL; }