Skip to content

Commit

Permalink
Rip out ImpossibleNullComparison:CheckSwitches flag.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 705822547
  • Loading branch information
graememorgan authored and Error Prone Team committed Dec 13, 2024
1 parent 6195480 commit 65c9f9c
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,13 @@ private static boolean isNull(ExpressionTree tree) {
private final boolean matchTestAssertions;
private final boolean checkPrimitives;
private final boolean checkValueOf;
private final boolean checkSwitches;

@Inject
ImpossibleNullComparison(ErrorProneFlags flags) {
this.matchTestAssertions =
flags.getBoolean("ProtoFieldNullComparison:MatchTestAssertions").orElse(true);
this.checkPrimitives = flags.getBoolean("ImmutableNullComparison:CheckPrimitives").orElse(true);
this.checkValueOf = flags.getBoolean("ImpossibleNullComparison:CheckValueOf").orElse(true);
this.checkSwitches = flags.getBoolean("ImpossibleNullComparison:CheckSwitches").orElse(true);
}

@Override
Expand Down Expand Up @@ -220,17 +218,13 @@ public ExpressionTree visitTypeCast(TypeCastTree node, Void unused) {

@Override
public Void visitSwitch(SwitchTree tree, Void unused) {
if (checkSwitches) {
handleSwitch(tree.getExpression(), tree.getCases());
}
handleSwitch(tree.getExpression(), tree.getCases());
return super.visitSwitch(tree, null);
}

@Override
public Void visitSwitchExpression(SwitchExpressionTree tree, Void unused) {
if (checkSwitches) {
handleSwitch(tree.getExpression(), tree.getCases());
}
handleSwitch(tree.getExpression(), tree.getCases());
return super.visitSwitchExpression(tree, null);
}

Expand Down

0 comments on commit 65c9f9c

Please sign in to comment.