Skip to content

Lombok false positive: Var for "@EqualsAndHashCode" #1482

Closed

Description

@ksilz

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.

[...]/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

  1. msridhar commented on Jan 17, 2020

    @msridhar
    Contributor

    @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.

  2. ksilz commented on Jan 20, 2020

    @ksilz
    Author

    @msridhar Understood. Could this be documented on the official web page somehow?

  3. msridhar commented on Jan 20, 2020

    @msridhar
    Contributor
  4. cushon commented on Jan 19, 2021

    @cushon
    Collaborator

    This is a duplicate of #1417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions