-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Compilation errors with @NotNull #365
Comments
👤 osa8aso 🕗 Oct 25, 2011 at 18:37 UTC When a property is annotated with @ NotNull, lombok's @ Data, @ Getter and @ Setter use this annotation class to annotate methods and method and constructor parameters. However, if @ NotNull targets do not include METHOD or PARAMETER element types, it fails to compile. Example:import static java.lang.annotation.ElementType.FIELD; @ Target({ FIELD }) @ Setter }Trying to compile it with lombok 0.10.1 produces the following error: $ javac -cp ../lib/lombok-0.10.1.jar Foo.java From delombok output it is easy to see that error was caused by adding @ NotNull annotation to the setter parameter:// Generated by delombok at Tue Oct 25 13:32:26 CDT 2011 @ Target({FIELD})
}This is a real problem if @ NotNull annotation is provided by another library and there is no way to change targets it supports. For example, Ebean @ NotNull works only for METHOD and FIELD: http://www.avaje.org/static/javadoc/pub/com/avaje/ebean/validation/NotNull.html I think lombok should check supported @ NotNull targets before applying it to generated methods and method parameters to prevent such errors. Additional information: |
👤 pe.fips 🕗 Oct 26, 2011 at 06:48 UTC |
👤 pe.fips 🕗 Oct 26, 2011 at 06:48 UTC Duplicate of issue #360 |
End of migration |
….. and 'varl' -> producing lombok.experimental.var foo = ... resolves projectlombok#365
Migrated from Google Code (issue 292)
The text was updated successfully, but these errors were encountered: