Details
-
Bug
-
Status: Resolved
-
P1
-
Resolution: Fixed
-
2.26.0
-
Linux & OpenJDK 15
-
Important
Description
I'm facing an exception telling me that my JavaBean contained a setter for a field that had a mismatching nullable attribute, although both getter and setter (parameters) are annotated with @Nullable.
The code responsible for determining if a setter's parameter is nullable looks wrong to me, since it does check if the type (class) itself is annotated with @Nullable instead of checking the actual parameter's annotations only considers type annotations instead of looking at parameter annotations, too. Java distinguishes between parameter annotations and type annotations. Therefore annotations declared without java.lang.annotation.ElementType#TYPE_USE can't be accessed through Executable#getAnnotatedParameterTypes().
boolean nullable =
Arrays.stream(method.getParameters()[0].getAnnotatedType().getAnnotations())
.anyMatch(annotation -> isNullableAnnotation(annotation));
Attachments
Issue Links
- links to