Provide an overloaded version of MergedAnnotations.from
that takes
an array of elements. This shortcut is particularly useful in property
situations where an annotation may be used on a getter, setter or field.
Closes gh-23327
Comment From: philwebb
I'm happy to just merge this one but I'd quite like another pair of eyes on it first. The one thing I'm not too sure about is having both a from(@Nullable AnnotatedElement element)
and and overloaded from(AnnotatedElement... elements)
. There's some precedent in LogMessage
for that pattern.
Comment From: sbrannen
@philwebb and @odrotbohm, is this feature request still relevant?
Comment From: odrotbohm
It is, yes. Not very urgent, but the sample code linked to from my original post still looks the same and would benefit from fix here.
Comment From: snicoll
@sbrannen unfortunately, there has been significant changes in the meantime and I am not sure if this can be rebased without breaking something. I've tried and I think the following check I've re-added is misplaced:
if (element == null || AnnotationsScanner.isKnownEmpty(element, searchStrategy, searchEnclosingClass)) {
return TypeMappedAnnotations.NONE;
}
It also unclear if the searchEnclosingClass
predicate should be applied to the new metheod.
Comment From: snicoll
@sbrannen would it be possible to get this triaged?
Comment From: sbrannen
Team Decision: we have decided to decline this PR on the basis that we do not want to introduce additional complexity in the MergedAnnotations
infrastructure to support this feature.