From 65c9f9c7b5e32ec0153b8674710f5f51c835ffde Mon Sep 17 00:00:00 2001 From: ghm Date: Fri, 13 Dec 2024 03:26:40 -0800 Subject: [PATCH] Rip out `ImpossibleNullComparison:CheckSwitches` flag. PiperOrigin-RevId: 705822547 --- .../bugpatterns/ImpossibleNullComparison.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/ImpossibleNullComparison.java b/core/src/main/java/com/google/errorprone/bugpatterns/ImpossibleNullComparison.java index 558a6cfa392..fd0e543add3 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/ImpossibleNullComparison.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/ImpossibleNullComparison.java @@ -151,7 +151,6 @@ 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) { @@ -159,7 +158,6 @@ private static boolean isNull(ExpressionTree tree) { 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 @@ -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); }