google / google/error-prone

Compiler does not warn about invalid check names when using -XepPatchChecks

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

Description

### What version of Error Prone are you using?

2.3.1

### Does this issue reproduce with the latest release?

Yes

### What did you do?

I ran Errorprone and passed an invalid check name to the `-XepPatchChecks` option.

```bash
$ echo 'public class Foo {}' > Foo.java
$ java -Xbootclasspath/p:error_prone_ant-2.3.1.jar \
com.google.errorprone.ErrorProneCompiler \
-XepPatchChecks:NotAValidCheck \
-XepPatchLocation:`pwd` \
Foo.java
```

### What did you expect to see?

I expected the compiler to report an error, since an invalid check name was used and the `-XepIgnoreUnknownCheckNames` flag was not provided.

### What did you see instead?

No error was reported. The Errorprone compiler ran successfully on the file, apparently ignoring the invalid check.

Note that the compiler does report an error, as expected, when passing a flag like `-Xep:NotAValidCheck`. However, it doesn't report an error when passing a flag like `-XepPatchChecks:NotAValidCheck`.

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.