-
Notifications
You must be signed in to change notification settings - Fork 741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lombok.Generated annotation is ignored #1863
Comments
It would actually be great if ErrorProne accepted any annotation named The fact that |
- for more info see https://errorprone.info/ - add a separate maven profile for running errorprone analysis it is not active by default - Add top-level lombok.config file for configuring Lombok. This file doesn't contain any other settings that marks it as the top most config file with "config.stopBubbling = true" (see https://projectlombok.org/features/configuration for reference) - Before running the Error Prone analysis, it's necessary to manually configure Lombok to add @javax.annotation.Generated("lombok") annotation on all fields, methods, and types that are generated. This makes Error Prone skip the analysis for Lombok generated code. - this setting cannot be enabled by default since JDK9+ doesn't include the javax.annotation.Generated annotation by default and adding the required dependency will change the classpath dependency resolution results. - There is an open issue to support lombok.Generated annotion in ErrorProne, google/error-prone#1863 - example usage: Configure Lombok to add Generated annotations echo "lombok.addJavaxGeneratedAnnotation = true" >> lombok.config then, on JDK8 "mvn -Perrorprone,errorprone-jdk8,core-modules compile" on JDK11+ "mvn -Perrorprone,errorprone-jdk11,core-modules compile" - usability is better when used together with IntelliJ since one can click on the error message to navigate to the code location - also add configuration for Error Prone SLF4J plugin https://github.com/KengoTODA/errorprone-slf4j which helps detect misusage of SLF4J API
### Motivation Google's [Error Prone static code analysis tool](https://errorprone.info/) can detect typical programming mistakes (for more info see https://errorprone.info/). This PR adds configuration to Pulsar maven build so that Error Prone static code analysis can be run for the Pulsar code base. This additional configuration is not active by default and requires activating `errorprone` and `errorprone-jdk8` or `errorprone-jdk11` maven profiles in addition to `main` or `core-modules` profile for running the analysis. ### Modifications - add a separate maven profile for running errorprone analysis it is not active by default - Add top-level `lombok.config file` for configuring Lombok. This file doesn't contain any other settings that marks it as the top most config file with `config.stopBubbling = true` (see https://projectlombok.org/features/configuration for reference) - Before running the Error Prone analysis, it's necessary to manually configure Lombok to add `@javax.annotation.Generated("lombok")` annotation on all fields, methods, and types that are generated. This makes Error Prone skip the analysis for Lombok generated code. - this setting cannot be enabled by default since JDK9+ doesn't include the `javax.annotation.Generated` annotation by default and adding the required dependency will change the classpath dependency resolution results. - There is an open issue to support lombok.Generated annotion in ErrorProne, google/error-prone#1863 - example usage: Configure Lombok to add Generated annotations `echo "lombok.addJavaxGeneratedAnnotation = true" >> lombok.config` then, on JDK8 `mvn -Perrorprone,errorprone-jdk8,core-modules compile` on JDK11+ `mvn -Perrorprone,errorprone-jdk11,core-modules compile` - usability is better when used together with IntelliJ since one can click on the error message to navigate to the code location - also add configuration for Error Prone SLF4J plugin https://github.com/KengoTODA/errorprone-slf4j which helps detect misusage of SLF4J API
#1984 is a related bug about |
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 |
Description of the problem / feature request:
Enabling Lombok's
@Generated
annotation vialombok.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 ofSOURCE
.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
The text was updated successfully, but these errors were encountered: