Skip to content

Commit e6d13c5

Browse files
markhbradyError Prone Team
authored andcommitted
[RefactorSwitch] flip flag to enable arrow-style switches to be converted to return switches
PiperOrigin-RevId: 899743356
1 parent b282fa2 commit e6d13c5

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

core/src/main/java/com/google/errorprone/bugpatterns/RefactorSwitch.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public final class RefactorSwitch extends BugChecker
105105
@Inject
106106
RefactorSwitch(ErrorProneFlags flags) {
107107
enableAssignmentSwitch = flags.getBoolean("RefactorSwitch:EnableAssignmentSwitch").orElse(true);
108-
enableReturnSwitch = flags.getBoolean("RefactorSwitch:EnableReturnSwitch").orElse(false);
108+
enableReturnSwitch = flags.getBoolean("RefactorSwitch:EnableReturnSwitch").orElse(true);
109109
enableSimplifySwitch = flags.getBoolean("RefactorSwitch:EnableSimplifySwitch").orElse(false);
110110
}
111111

@@ -1108,11 +1108,11 @@ private static ImmutableList<ErrorProneComment> computeOrphanedComments(
11081108
.collect(toImmutableList());
11091109
}
11101110

1111-
record AnalysisResult(
1111+
private record AnalysisResult(
11121112
// A list of conversions that can be performed on the switch
11131113
ImmutableList<Convertible> convertibleFindings) {}
11141114

1115-
record AssignmentSwitchAnalysisState(
1115+
private record AssignmentSwitchAnalysisState(
11161116
// Current qualification for conversion based on cases examined so far
11171117
CaseQualifications assignmentSwitchCaseQualifications,
11181118
// What is being assigned to (if any)
@@ -1122,7 +1122,7 @@ record AssignmentSwitchAnalysisState(
11221122
// The tree of the assignment being performed (if any)
11231123
Optional<ExpressionTree> assignmentTreeOptional) {}
11241124

1125-
record AssignmentSwitchAnalysisResult(
1125+
private record AssignmentSwitchAnalysisResult(
11261126
// The switch can be converted to an assignment switch
11271127
boolean canConvertToAssignmentSwitch,
11281128
// The variable declaration that preceded the switch (if any)
@@ -1142,7 +1142,7 @@ public SuggestedFix convert(SwitchTree switchTree, VisitorState state) {
11421142
}
11431143
}
11441144

1145-
record ReturnSwitchAnalysisResult(
1145+
private record ReturnSwitchAnalysisResult(
11461146
// The switch can be converted to a return switch
11471147
boolean canConvertToReturnSwitch,
11481148
// Whether the default case can be removed
@@ -1156,7 +1156,7 @@ public SuggestedFix convert(SwitchTree switchTree, VisitorState state) {
11561156
}
11571157
}
11581158

1159-
record SimplifyAnalysisResult(
1159+
private record SimplifyAnalysisResult(
11601160
// At least one case can be simplified
11611161
boolean canSimplify,
11621162
// Whether the default case can be removed

0 commit comments

Comments
 (0)