- 
                Notifications
    You must be signed in to change notification settings 
- Fork 41.6k
Description
In #12020 support for optional parameters was introduced which is great. We have been using this happily for a while internally. Recently we decided as part of streamlining efforts to deduplicate several annotations that have been used (mostly) interchangeably within our code base. One such annotation was @Nullable. As we also have (Maven) modules that do not rely on Spring, we decided to only use javax.annotation.Nullable from that point on, because as far as we know, this is supported by Spring. After settling on this rule, and migrating our code base (where we have now banned the other annotations at the build level), a custom endpoint of the following form started to fail:
@Endpoint(id = "endpoint")
final class Endpoint {
    @WriteOperation
    void adjust(@Selector someSelector, @Nullable optionalParameter) {
        ...
    }
}The @Nullable annotation was migrated from org.springframework.lang.Nullable to javax.annotation.Nullable, and thus support for the optional parameter broke as a result of:
Line 58 in 1fb32fc
| return ObjectUtils.isEmpty(this.parameter.getAnnotationsByType(Nullable.class)); | 
Now we realize that this is indeed documented as such here, so this is definitely not a bug report, but rather a feature request. This would allow us to keep the consistency within our code base and keep our strict rule set without having to support exceptions. Moreover, it could be less of a surprise for others since there's support for it in other parts of Spring. If it helps, I'm willing to do the legwork required and file a PR.
If any more info is required, let me know.