[ 
https://issues.apache.org/jira/browse/SLING-6609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15897075#comment-15897075
 ] 

Konrad Windszus commented on SLING-6609:
----------------------------------------

Even if it was historically supported, I don't think it was useful with a 2nd 
parameter being {{null}}. Also the annotations don't touch the implementation 
(so passing {{null}} will still work). 

It is just that if you use findbugs or Eclipse with null analysis enabled this 
will emit a warning if you pass a {{null}} parameter. The other alternative 
would be to annotate the return value to {{@CheckForNull}} which is not true in 
99% of the cases and therefore requires you to more often check for a null 
return value.

> Fix JSR305 annotations for ValueMap.get
> ---------------------------------------
>
>                 Key: SLING-6609
>                 URL: https://issues.apache.org/jira/browse/SLING-6609
>             Project: Sling
>          Issue Type: Bug
>          Components: API
>    Affects Versions: API 2.16.2
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>             Fix For: API 2.16.4
>
>
> Currently {{<T> T get(@Nonnull String name, T defaultValue);}} does neither 
> define a JSR 305 annotation for the return value nor for the 2nd parameter. 
> It makes sense to define them both as {{@Nonnull}}, because if you intend to 
> get {{null}} as return value you are supposed to take the other get method 
> ({{@CheckForNull <T> T get(@Nonnull String name, @Nonnull Class<T> type)}})



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to