Skip to content

Commit fbedd9c

Browse files
committed
Merge branch 'master' into infer-generics
2 parents 24241b5 + 50cb4ab commit fbedd9c

File tree

4 files changed

+116
-87
lines changed

4 files changed

+116
-87
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.google.errorprone.VisitorState;
44
import com.sun.tools.javac.code.Type;
55
import com.sun.tools.javac.code.Types;
6+
import com.uber.nullaway.Config;
67
import java.util.List;
78
import javax.lang.model.type.NullType;
89
import javax.lang.model.type.TypeKind;
@@ -14,9 +15,11 @@
1415
*/
1516
public class CheckIdenticalNullabilityVisitor extends Types.DefaultTypeVisitor<Boolean, Type> {
1617
private final VisitorState state;
18+
private final Config config;
1719

18-
CheckIdenticalNullabilityVisitor(VisitorState state) {
20+
CheckIdenticalNullabilityVisitor(VisitorState state, Config config) {
1921
this.state = state;
22+
this.config = config;
2023
}
2124

2225
@Override
@@ -60,8 +63,8 @@ public Boolean visitClassType(Type.ClassType lhsType, Type rhsType) {
6063
// TODO Handle wildcard types
6164
continue;
6265
}
63-
boolean isLHSNullableAnnotated = GenericsChecks.isNullableAnnotated(lhsTypeArgument, state);
64-
boolean isRHSNullableAnnotated = GenericsChecks.isNullableAnnotated(rhsTypeArgument, state);
66+
boolean isLHSNullableAnnotated = GenericsChecks.isNullableAnnotated(lhsTypeArgument, config);
67+
boolean isRHSNullableAnnotated = GenericsChecks.isNullableAnnotated(rhsTypeArgument, config);
6568
if (isLHSNullableAnnotated != isRHSNullableAnnotated) {
6669
return false;
6770
}
@@ -91,8 +94,8 @@ public Boolean visitArrayType(Type.ArrayType lhsType, Type rhsType) {
9194
Type.ArrayType arrRhsType = (Type.ArrayType) rhsType;
9295
Type lhsComponentType = lhsType.getComponentType();
9396
Type rhsComponentType = arrRhsType.getComponentType();
94-
boolean isLHSNullableAnnotated = GenericsChecks.isNullableAnnotated(lhsComponentType, state);
95-
boolean isRHSNullableAnnotated = GenericsChecks.isNullableAnnotated(rhsComponentType, state);
97+
boolean isLHSNullableAnnotated = GenericsChecks.isNullableAnnotated(lhsComponentType, config);
98+
boolean isRHSNullableAnnotated = GenericsChecks.isNullableAnnotated(rhsComponentType, config);
9699
if (isRHSNullableAnnotated != isLHSNullableAnnotated) {
97100
return false;
98101
}

0 commit comments

Comments
 (0)