google / google/error-prone

Varifier doesn't always trigger

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

Description

Varifier doesn't always seem to correctly trigger.

It does work for:
```java
Optional test = Optional.of(1);
```
But not for:
```java
var optInt = Optional.of(1);
Optional test = optInt;
```
And also not for:
```java
private static Optional getOptInt() {
return Optional.of(1);
}
...
Optional test = getOptInt();
```

Using the following versions:
Java: 25.0.2
Gradle: 9.4.1
Errorprone: 2.50.0
Errorprone gradle plugin: 5.1.0

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Varifier behavior with the three Java snippets in the issue under Java 25.0.2, Error Prone 2.50.0, and the Error Prone Gradle plugin 5.1.0. Compare which snippets produce diagnostics, then locate the Varifier implementation and add regression coverage showing the expected trigger behavior for each form.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.