Skip to content

Commit 0b9421a

Browse files
authored
Rename MethodInferenceResult to CallInferenceResult (#1692)
Refactoring in preparation for #1544 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Updated internal generic-call inference naming for consistency. * No user-visible behavior or functionality changes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent d427643 commit 0b9421a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,19 @@
8080
public final class GenericsChecks {
8181

8282
/** Marker interface for results of attempting to infer nullability of type variables at a call */
83-
private interface MethodInferenceResult {}
83+
private interface CallInferenceResult {}
8484

8585
/**
8686
* Indicates successful inference of nullability of type variables at a call. Stores the inferred
8787
* type variable nullability.
8888
*/
8989
private record InferenceSuccess(
9090
Map<Element, ConstraintSolver.InferredNullability> typeVarNullability)
91-
implements MethodInferenceResult {}
91+
implements CallInferenceResult {}
9292

9393
/** Indicates failed inference of nullability of type variables at a call */
9494
private record InferenceFailure(@SuppressWarnings("UnusedVariable") @Nullable String errorMessage)
95-
implements MethodInferenceResult {
95+
implements CallInferenceResult {
9696
private InferenceFailure(@Nullable String errorMessage) {
9797
this.errorMessage = errorMessage;
9898
}
@@ -103,7 +103,7 @@ private InferenceFailure(@Nullable String errorMessage) {
103103
* its type argument nullability. The call must not have any explicit type arguments. If a tree is
104104
* not present as a key in this map, it means inference has not yet been attempted for that call.
105105
*/
106-
private final Map<MethodInvocationTree, MethodInferenceResult>
106+
private final Map<MethodInvocationTree, CallInferenceResult>
107107
inferredTypeVarNullabilityForGenericCalls = new LinkedHashMap<>();
108108

109109
/**
@@ -1182,7 +1182,7 @@ private Type inferGenericMethodCallType(
11821182
Verify.verify(isGenericCallNeedingInference(invocationTree));
11831183
Symbol.MethodSymbol methodSymbol = ASTHelpers.getSymbol(invocationTree);
11841184
Map<Element, ConstraintSolver.InferredNullability> typeVarNullability = null;
1185-
MethodInferenceResult result = inferredTypeVarNullabilityForGenericCalls.get(invocationTree);
1185+
CallInferenceResult result = inferredTypeVarNullabilityForGenericCalls.get(invocationTree);
11861186
if (result == null) { // have not yet attempted inference for this call
11871187
result =
11881188
runInferenceForCall(
@@ -1220,7 +1220,7 @@ private Type inferGenericMethodCallType(
12201220
* @return the inference result, either success with inferred type variable nullability or failure
12211221
* with an error message
12221222
*/
1223-
private MethodInferenceResult runInferenceForCall(
1223+
private CallInferenceResult runInferenceForCall(
12241224
VisitorState state,
12251225
@Nullable TreePath path,
12261226
MethodInvocationTree invocationTree,
@@ -2416,7 +2416,7 @@ private Type.MethodType getInferredMethodTypeForGenericMethodReference(
24162416
Tree parentTree = parentPath != null ? parentPath.getLeaf() : null;
24172417
if (parentTree instanceof MethodInvocationTree methodInvocationTree
24182418
&& isGenericCallNeedingInference(methodInvocationTree)) {
2419-
MethodInferenceResult inferenceResult =
2419+
CallInferenceResult inferenceResult =
24202420
inferredTypeVarNullabilityForGenericCalls.get(methodInvocationTree);
24212421
if (inferenceResult instanceof InferenceSuccess successResult) {
24222422
return TypeSubstitutionUtils.updateMethodTypeWithInferredNullability(
@@ -2810,7 +2810,7 @@ private Type substituteTypeArgsInGenericMethodType(
28102810

28112811
// There are no explicit type arguments, so use the inferred types
28122812
if (explicitTypeArgs.isEmpty() && tree instanceof MethodInvocationTree invocationTree) {
2813-
MethodInferenceResult result = inferredTypeVarNullabilityForGenericCalls.get(tree);
2813+
CallInferenceResult result = inferredTypeVarNullabilityForGenericCalls.get(tree);
28142814
if (result == null) {
28152815
// have not yet attempted inference for this call
28162816
InvocationAndContext invocationAndType =

0 commit comments

Comments
 (0)