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

Duo Zhang commented on HBASE-18878:
-----------------------------------

I’ve already used lots of Optional parameters in the code. So if IDEA think 
this is not the right case then let’s clean up those usage first instead of fix 
this one?

And I’m not fully convinced by the reason that why Optional should not be used 
as a parameter. They suggest to use method overload to hide the nullable 
parameter, and an Optional parameter requires extra wrapping. But what if the 
parameter is gotten from an method which returns an Optional? So I need to 
check if the parameter is present and then call different method?

But anyway, if a common used IDE shows warnings, I think it is better to remove 
theses usages as it may confuse a lot of developers. Any way, let’s instead 
adding Nullable annotations to indicate that a parameter could be null? My 
experience is that it is really a pain that we do not know if a variable could 
be null or not when implementing a class, especially if it is used everywhere 
in the class... Doing Null check everywhere but missing at some places is 
really confusing...

> Use Optional instead of Nullable annotation in ObserverContext to better 
> describe that the caller may not be presented
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-18878
>                 URL: https://issues.apache.org/jira/browse/HBASE-18878
>             Project: HBase
>          Issue Type: Sub-task
>          Components: Coprocessors
>            Reporter: Duo Zhang
>            Assignee: Duo Zhang
>             Fix For: 2.0.0-alpha-4
>
>         Attachments: HBASE-18878.patch, HBASE-18878-v1.patch
>
>
> I've already done lots of Nullable to Optional change when purging the 
> interfaces for CP. This is a big one so open a separated issue for it.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to