From 81e5350080c508cac8cf6eb86943823706abe86e Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 25 Nov 2024 12:32:10 -0800 Subject: [PATCH] Make DuplicateBranches a warning PiperOrigin-RevId: 700067125 --- .../com/google/errorprone/bugpatterns/DuplicateBranches.java | 4 ++-- .../google/errorprone/scanner/BuiltInCheckerSuppliers.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/DuplicateBranches.java b/core/src/main/java/com/google/errorprone/bugpatterns/DuplicateBranches.java index 297c57de3df..7e2f5d393fe 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/DuplicateBranches.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/DuplicateBranches.java @@ -17,7 +17,7 @@ package com.google.errorprone.bugpatterns; import static com.google.common.collect.Iterables.getLast; -import static com.google.errorprone.BugPattern.SeverityLevel.ERROR; +import static com.google.errorprone.BugPattern.SeverityLevel.WARNING; import static com.google.errorprone.matchers.Description.NO_MATCH; import static com.google.errorprone.util.ASTHelpers.getStartPosition; import static java.util.stream.Collectors.joining; @@ -36,7 +36,7 @@ import com.sun.source.tree.Tree.Kind; /** A {@link BugChecker}; see the associated {@link BugPattern} annotation for details. */ -@BugPattern(summary = "Both branches contain identical code", severity = ERROR) +@BugPattern(summary = "Both branches contain identical code", severity = WARNING) public class DuplicateBranches extends BugChecker implements IfTreeMatcher, ConditionalExpressionTreeMatcher { @Override diff --git a/core/src/main/java/com/google/errorprone/scanner/BuiltInCheckerSuppliers.java b/core/src/main/java/com/google/errorprone/scanner/BuiltInCheckerSuppliers.java index c4eab2295ac..916515a5e95 100644 --- a/core/src/main/java/com/google/errorprone/scanner/BuiltInCheckerSuppliers.java +++ b/core/src/main/java/com/google/errorprone/scanner/BuiltInCheckerSuppliers.java @@ -709,7 +709,6 @@ public static ScannerSupplier warningChecks() { DoNotCallChecker.class, DoNotMockChecker.class, DoubleBraceInitialization.class, - DuplicateBranches.class, DuplicateMapKeys.class, DurationFrom.class, DurationGetTemporalUnit.class, @@ -912,6 +911,7 @@ public static ScannerSupplier warningChecks() { DoNotClaimAnnotations.class, DoNotMockAutoValue.class, DoubleCheckedLocking.class, + DuplicateBranches.class, DuplicateDateFormatField.class, EmptyBlockTag.class, EmptyCatch.class,