Skip to content

Commit

Permalink
Rip out ImmutableNullComparison:EmitEmptyFixes.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 617789741
  • Loading branch information
graememorgan authored and Error Prone Team committed Mar 21, 2024
1 parent 437293d commit 58473c5
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,12 @@ private static boolean isNull(ExpressionTree tree) {
"com.google.protobuf.GeneratedMessageLite", "com.google.protobuf.GeneratedMessage");

private final boolean matchTestAssertions;
private final boolean emitEmptyFixes;
private final boolean checkPrimitives;

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

Expand Down Expand Up @@ -251,9 +249,7 @@ public Void visitMethodInvocation(MethodInvocationTree node, Void unused) {
return super.visitMethodInvocation(node, null);
}
getFixer(argument, subState)
.map(f -> problemType.fix(f, node, subState))
.filter(f -> emitEmptyFixes || !f.isEmpty())
.map(f -> describeMatch(node, f))
.map(f -> describeMatch(node, problemType.fix(f, node, subState)))
.ifPresent(state::reportMatch);

return super.visitMethodInvocation(node, null);
Expand Down

0 comments on commit 58473c5

Please sign in to comment.