-
-
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
[BUG] Custom nullable annotations are not copied to constructors and methods for Value/Data classes #3318
Comments
I suppose the reason is because copyable, nullable and non-null annotations are mostly hardcoded:
|
A contribution of a simple test case (it's just a matter of writing self-contained java files along with what you think lombok should do with em and putting them into the right dirs ( |
Sorry @rzwitserloot , I don't think I quite understand what you're asking of me to contribute or what's unclear, would you please elaborate? I was expecting lombok to copy field annotations to the respective constructor parameters, not only for Nullability annotations but favorably also for copyable annotations. |
Lombok has a copy system and there are a ton of places where annotations may or may not be copied. This isn't exactly a high traffic bug report and we have various tests about copying annotations that all pass. So, exactly, which annotations are and aren't being copied? You have posted a sample project - it sounds like all you'd really have to do is take the output of |
Describe the bug
In my project and libs I use custom nullability annotations that are almost one-to-one copies of spring ones, the purpose is to avoid depending on spring-core. I wanted to configure lombok to add them from fields to constructors and methods (getters/setters) for Value/Data annotated classes, but for some reason annotations are not added.
At the same time, when lombok is configured to use
spring
orcheckerframework
annotations they are added correctly.In other words, sample class
Produce different results depending on
Nullable
annotation.For spring with (
lombok.addLombokGeneratedAnnotation=true, lombok.addNullAnnotations=spring
)For custom (
lombok.addLombokGeneratedAnnotation=true, lombok.addNullAnnotations=CUSTOM:com.example.annotations.NonNull:com.example.annotations.Nullable
)To Reproduce
I've prepared a sample project that shows the problem: https://github.com/zeldigas/lombok-custom-nullable-problem. In
spring
module you can find usage of spring annotations and incustom
- custom ones that are defined in this module as well (for simplicity)Expected behavior
Both modules in sample project are working the same way.
Version info (please complete the following information):
1.18.24
The text was updated successfully, but these errors were encountered: