google / google/error-prone

false FormatStringAnnotation errors after one unrelated legit error

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

Description

# Description of the problem / feature request:

We have encountered a problem a couple of different times: After getting a legit error, such as `UnusedVariable`, a flood of non related errors are emitted, but they are all false positives. After fixing the first one, they go away. Note that they are in other files, and usually the compilation stops after the first file in error, so that is weird in this case.

The false errors all seem to be (those variables ARE effectively final) :
`error: [FormatStringAnnotation] All variables passed as @FormatString must be final or effectively final
[ERROR] (see https://errorprone.info/bugpattern/FormatStringAnnotation)`

Looking at the code generating this error, seems like the flags are not set correctly for some reason:
![image](https://user-images.githubusercontent.com/40778421/94317785-d5013180-ff3b-11ea-9446-3d2816f33a34.png)

### Feature requests: what underlying problem are you trying to solve with this feature?

Those false errors are quite startling, so ideally they should no longer appear.

### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

I really don't know what a minimal thing to reproduce it would be.

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

2.4.0

### Have you found anything relevant by searching the web?

No.

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.