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 d43e34aa10..cae79a1213 100644 --- a/nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java +++ b/nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java @@ -78,7 +78,7 @@ public final class GenericsChecks { /** Marker interface for results of attempting to infer nullability of type variables at a call */ - private interface MethodInferenceResult {} + private interface CallInferenceResult {} /** * Indicates successful inference of nullability of type variables at a call. Stores the inferred @@ -86,11 +86,11 @@ private interface MethodInferenceResult {} */ private record InferenceSuccess( Map typeVarNullability) - implements MethodInferenceResult {} + implements CallInferenceResult {} /** Indicates failed inference of nullability of type variables at a call */ private record InferenceFailure(@SuppressWarnings("UnusedVariable") @Nullable String errorMessage) - implements MethodInferenceResult { + implements CallInferenceResult { private InferenceFailure(@Nullable String errorMessage) { this.errorMessage = errorMessage; } @@ -101,7 +101,7 @@ private InferenceFailure(@Nullable String errorMessage) { * its type argument nullability. The call must not have any explicit type arguments. If a tree is * not present as a key in this map, it means inference has not yet been attempted for that call. */ - private final Map + private final Map inferredTypeVarNullabilityForGenericCalls = new LinkedHashMap<>(); /** @@ -1177,7 +1177,7 @@ private Type inferGenericMethodCallType( Verify.verify(isGenericCallNeedingInference(invocationTree)); Symbol.MethodSymbol methodSymbol = ASTHelpers.getSymbol(invocationTree); Map typeVarNullability = null; - MethodInferenceResult result = inferredTypeVarNullabilityForGenericCalls.get(invocationTree); + CallInferenceResult result = inferredTypeVarNullabilityForGenericCalls.get(invocationTree); if (result == null) { // have not yet attempted inference for this call result = runInferenceForCall( @@ -1215,7 +1215,7 @@ private Type inferGenericMethodCallType( * @return the inference result, either success with inferred type variable nullability or failure * with an error message */ - private MethodInferenceResult runInferenceForCall( + private CallInferenceResult runInferenceForCall( VisitorState state, @Nullable TreePath path, MethodInvocationTree invocationTree, @@ -2376,7 +2376,7 @@ private Type.MethodType getInferredMethodTypeForGenericMethodReference( Tree parentTree = parentPath != null ? parentPath.getLeaf() : null; if (parentTree instanceof MethodInvocationTree methodInvocationTree && isGenericCallNeedingInference(methodInvocationTree)) { - MethodInferenceResult inferenceResult = + CallInferenceResult inferenceResult = inferredTypeVarNullabilityForGenericCalls.get(methodInvocationTree); if (inferenceResult instanceof InferenceSuccess successResult) { return TypeSubstitutionUtils.updateMethodTypeWithInferredNullability( @@ -2613,7 +2613,7 @@ private Type substituteTypeArgsInGenericMethodType( // There are no explicit type arguments, so use the inferred types if (explicitTypeArgs.isEmpty() && tree instanceof MethodInvocationTree invocationTree) { - MethodInferenceResult result = inferredTypeVarNullabilityForGenericCalls.get(tree); + CallInferenceResult result = inferredTypeVarNullabilityForGenericCalls.get(tree); if (result == null) { // have not yet attempted inference for this call InvocationAndContext invocationAndType =