<Swing Dev> [11] Review Request: JDK-5076761 : JList.setSelectedValue(null, ...) doesn't do anything

Pankaj Bansal pankaj.b.bansal at oracle.com
Thu Jan 18 14:47:54 UTC 2018


Hi Sergey/Semyon,

I have updated the code to clear selection if the object passed is null. It makes sense to do that as GetSelectedValue returns null if nothing is selected. This makes these two functions compatible in JList.
I think we can deal with clearing selection if the object passed is not present in the JList in some other bug. Present bug only talks about the case when the Object passed in null.

Please share your thoughts on this.

webrev:
http://cr.openjdk.java.net/~pbansal/5076761/webrev.06/

Regards,
Pankaj Bansal

-----Original Message-----
From: Sergey Bylokhov 
Sent: Wednesday, January 17, 2018 10:23 PM
To: Semyon Sadetsky; Pankaj Bansal; swing-dev at openjdk.java.net
Subject: Re: <Swing Dev> [11] Review Request: JDK-5076761 : JList.setSelectedValue(null, ...) doesn't do anything

On 17/01/2018 08:41, Semyon Sadetsky wrote:
>> I already listed a methods which use null as an absent of the value. 
>> And current methods were implemented with this intention.
> But JList is fully usable without them.

No because getSelectedValue() will return null if no elements is selected.

>>
>>>  as well as any pointer that JList couldn't contain null.
>>
>> There are no references to null in the javadoc which means that null 
>> is unsupported. By default the null value is unsupported, and it can 
>> be considered as supported only if spec accept that.
> That is a good argument that proves that null is not considered as a 
> special value.

What argument? There are no description that null is supported, but there are a description that null is used in somecases like getSelectedValue().


--
Best regards, Sergey.



More information about the swing-dev mailing list