From e514b70f5f068d5e52392fa76e0b52a72be4b89a Mon Sep 17 00:00:00 2001 From: ghm Date: Fri, 13 Dec 2024 16:20:37 -0800 Subject: [PATCH] Rip out `ImpossibleNullComparison:CheckSwitches` flag. PiperOrigin-RevId: 706035417 --- .../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); }