-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix combination of lombok.Builder with Introspected without builder #11347
Conversation
@@ -722,7 +722,8 @@ private void writeIntrospectionClass(ClassWriterOutputVisitor classWriterOutputV | |||
dispatchWriter.buildGetTargetMethodByIndex(classWriter); | |||
buildFindIndexedProperty(classWriter); | |||
buildGetIndexedProperties(classWriter); | |||
boolean hasBuilder = annotationMetadata != null && annotationMetadata.isPresent(Introspected.class, "builder"); | |||
boolean hasBuilder = annotationMetadata != null && | |||
(annotationMetadata.isPresent(Introspected.class, "builder") || annotationMetadata.hasDeclaredAnnotation("lombok.Builder")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an annotation remapper to avoid referencing the Lombok here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but also are we sure we want to generate an instrospection for all Lombok annotated builders?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we can add a visitor that will only remap it if the builder annotation is present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I move the reference to Lombok from one place to another?
// unfortunately sometimes we don't see the Lombok transformations | ||
// so assume if the class is annotated with Lombok builder we cannot | ||
// access the constructor. | ||
if (!ce.hasDeclaredAnnotation(ANN_LOMBOK_BUILDER)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be added as an option to the introspected or builder annotation and use a remapper to avoid the lombok reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I understand how
.orElse(null); | ||
if (methodElement == null) { | ||
// Lombok processing not done yet, try again in the next round. | ||
throw new ElementPostponedToNextRoundException(element); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should deprecate PostponedToNextRoundException
and use only ElementPostponedToNextRoundException
Quality Gate failedFailed conditions |
Currently users have to manually defined
@Introspected(builder=..)
when using Lombok. This change adds native processing of Lombok builder. Not a huge fan of the direct references to Lombok annotation names but I don't see many other options.Fixes #11344