Enabling Lombok's @Generated annotation via lombok.addLombokGeneratedAnnotation = true does not reduce the number of reported issues.
Error Prone ignores the lombok.Generated annotation. Unlike the javax.annotation.processing.Generated annotation this one has @Retention(CLASS) instead of SOURCE.
Adding a few Lombok annotations is usually enough to trigger a violation. There are already some examples available here:
https://github.com/google/error-prone/issues/1700
https://github.com/google/error-prone/issues/1482
https://github.com/google/error-prone/issues/1481
2.4.0
No
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.
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).It would actually be great if ErrorProne accepted any annotation named Generated whichever the package.
Done: https://github.com/google/error-prone/commit/4d6a0cce2d2ccc6a945352c2ba38201f753994bd
That doesn't solve all of our problems with lombok (see https://github.com/google/error-prone/issues/1250#issuecomment-763097162 for current thoughts on that), but it should be enough to recognize lombok's annotation in -XepDisableWarningsInGeneratedCode
Most helpful comment
It would actually be great if ErrorProne accepted any annotation named
Generatedwhichever the package.The fact that
javax.annotation.processing.GeneratedhasSOURCEretention is a real problem, leading to many code generators to come with their ownGeneratedannotation withCLASSretention (like the now-defunctjavax.annotation.Generated): Lombok, Immutables, someone asked it for jOOQ, someone else for MapStruct, and I'm sure there are (many) others.