Repository navigation
Closed
Labels
Description
Description of the problem / feature request:
I'm compiling my Java 11 Spring Boot program with Error Prone and get a false positive on Var in a class that has the Lombok annotation @EqualsAndHashCode.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I reproduced the error in a test case repo.
- Make sure that you have Java 11 installed.
- Clone https://github.com/ksilz/check-error-prone
- Run
gradlew.bat(Windows) or./gradlew(Mac, Linux). - The application runs fine.
- Edit
build.gradle:- Comment out the line with
excludedPaths = ".*/issues/.*", currently line 103. This would include all files for Error Prone. - Uncomment the
excludedPathsline for this issue Lombok false positive: Var for "@EqualsAndHashCode" #1482, which is currently line 129. - Save.
- Comment out the line with
- Run
gradlew.bat(Windows) or./gradlew(Mac, Linux) again. - You get the warning below. The error is in var/IssueShowCase.java
[...]/src/main/java/com/betterprojectsfaster/test/errorprone/lombokErrorProne/issues/var/IssueShowCase.java:14: warning: [Var] Non-constant variable missing @Var annotation
@EqualsAndHashCode
^
(see https://errorprone.info/bugpattern/Var)
Did you mean '@Var @EqualsAndHashCode'?
1 warning
What version of Error Prone are you using?
Here's my my environment:
- macOS Catalina 10.15.2
- Gradle 5.6.4
- AdoptOpenJDK Eclipse OpenJ9 11.0.5
- Lombok 1.18.10
- Error Prone Gradle plug-in 1.1.1
- Error Prone 2.3.4
Have you found anything relevant by searching the web?
Didn't find anything relevant in the mailing list. Here are related Lombox issues:
- #1479: Lombok - MultiVariableDeclaration: IllegalArgumentException "Start [449] should not be after end [-1]" (Preconditions.java:300)
- #1430:
IllegalArgumentException from AlmostJavadoc pattern on project using lombok - #1481: Lombok false positive: MissingOverride for "@EqualsAndHashCode(callSuper = true)" when extending base class
Activity
msridhar commentedon Jan 17, 2020
@ksilz FYI, as far as I know, Error Prone does not officially support running alongside Lombok. So, as Error Prone and Lombok evolve, you can expect these types of bugs to crop up from time to time. Assuming Lombok is a requirement for your project, I would suggest disabling individual Error Prone checks that cause issues as an intermediate solution.
ksilz commentedon Jan 20, 2020
@msridhar Understood. Could this be documented on the official web page somehow?
msridhar commentedon Jan 20, 2020
cushon commentedon Jan 19, 2021
This is a duplicate of #1417