Skip to content

lombok.Generated annotation is ignored #1863

Closed

Description

@sergeykad

Description of the problem / feature request:

Enabling Lombok's @Generated annotation via lombok.addLombokGeneratedAnnotation = true does not reduce the number of reported issues.

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

Error Prone ignores the lombok.Generated annotation. Unlike the javax.annotation.processing.Generated annotation this one has @Retention(CLASS) instead of SOURCE.

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

Adding a few Lombok annotations is usually enough to trigger a violation. There are already some examples available here:
#1700
#1482
#1481

What version of Error Prone are you using?

2.4.0

Have you found anything relevant by searching the web?

No

Activity

  1. tbroyer commented on Oct 16, 2020

    @tbroyer
    Contributor

    It would actually be great if ErrorProne accepted any annotation named Generated whichever the package.

    The fact that javax.annotation.processing.Generated has SOURCE retention is a real problem, leading to many code generators to come with their own Generated annotation with CLASS retention (like the now-defunct javax.annotation.Generated): Lombok, Immutables, someone asked it for jOOQ, someone else for MapStruct, and I'm sure there are (many) others.

  2. cushon commented on Jan 7, 2021

    @cushon
    Collaborator

    #1984 is a related bug about org.immutables (which I think is supposed to try to use the javax.* annotations if they're available, but doesn't seem to be doing that).

  3. cushon commented on Jan 20, 2021

    @cushon
    Collaborator

    It would actually be great if ErrorProne accepted any annotation named Generated whichever the package.

    Done: 4d6a0cc

    That doesn't solve all of our problems with lombok (see #1250 (comment) for current thoughts on that), but it should be enough to recognize lombok's annotation in -XepDisableWarningsInGeneratedCode

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions