google / google/error-prone

Patching no longer works for experimental checks like StatementSwitchToExpressionSwitch

Open
#4,395 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

On my code base, running Error Prone with `-Xep:StatementSwitchToExpressionSwitch:WARN -XepOpt:StatementSwitchToExpressionSwitch:EnableDirectConversion=true` produces findings.

However, if I want to enable patching and pass `-Xep:StatementSwitchToExpressionSwitch:WARN -XepOpt:StatementSwitchToExpressionSwitch:EnableDirectConversion=true -XepPatchChecks:StatementSwitchToExpressionSwitch -XepPatchLocation:...`, no findings are shown and no `error-prone.patch` is generated anymore since 2.26.0.

If I go back to Error Prone 2.25.0, producing patches for `StatementSwitchToExpressionSwitch` works as expected with these command-line parameters. Version 2.26.0 and 2.27.1 both disable `StatementSwitchToExpressionSwitch` if I ask for patches from it.

I suspect that this is due to #4028 and that other experimental (disabled by default) checks suffer from the same problem, but I did not test this.

IMHO Error Prone could just enable an experimental check if it is used with `-XepPatchChecks`, even if it is not enabled explicitly, but I am also fine with having to pass both `-Xep:StatementSwitchToExpressionSwitch:WARN` and `-XepPatchChecks:StatementSwitchToExpressionSwitch`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.