Re: RFR: 8049301: Suspicious use of string identity checks in JComponent.setUIProperty [v2]

2021-09-02 Thread Alexey Ivanov
On Fri, 30 Jul 2021 20:50:05 GMT, Sergey Bylokhov wrote: > > I believe it was an optimisation to make comparison as quick as possible. > > There are many places in Swing where property keys are compared as object > > identity rather than using `equals`. If this place is changed, probably all

Re: RFR: 8049301: Suspicious use of string identity checks in JComponent.setUIProperty [v2]

2021-07-30 Thread Sergey Bylokhov
On Fri, 30 Jul 2021 18:26:56 GMT, Alexey Ivanov wrote: > I believe it was an optimisation to make comparison as quick as possible. > There are many places in Swing where property keys are compared as object > identity rather than using `equals`. If this place is changed, probably all > other

Re: RFR: 8049301: Suspicious use of string identity checks in JComponent.setUIProperty [v2]

2021-07-30 Thread Sergey Bylokhov
On Fri, 30 Jul 2021 10:38:58 GMT, Prasanta Sadhukhan wrote: >> JComponent.setUIProperty method uses string identity check (==) rather than >> string equality checks (.equals) when comparing against the property name. >> This is suspicious since string identity and equality and equivalent only

Re: RFR: 8049301: Suspicious use of string identity checks in JComponent.setUIProperty [v2]

2021-07-30 Thread Prasanta Sadhukhan
On Fri, 30 Jul 2021 15:17:41 GMT, Alexander Zvegintsev wrote: >> I have taken care of NPE..I am not sure of switch which probably might be a >> hindrance in backporting if needed to earlier release trains. >> CI is also run..link in JBS. > >> I am not sure of switch which probably might be a

Re: RFR: 8049301: Suspicious use of string identity checks in JComponent.setUIProperty [v2]

2021-07-30 Thread Alexander Zvegintsev
On Fri, 30 Jul 2021 10:38:58 GMT, Prasanta Sadhukhan wrote: >> JComponent.setUIProperty method uses string identity check (==) rather than >> string equality checks (.equals) when comparing against the property name. >> This is suspicious since string identity and equality and equivalent only

Re: RFR: 8049301: Suspicious use of string identity checks in JComponent.setUIProperty [v2]

2021-07-30 Thread Alexander Zvegintsev
On Fri, 30 Jul 2021 10:35:46 GMT, Prasanta Sadhukhan wrote: > I am not sure of switch which probably might be a hindrance in backporting if > needed to earlier release trains. You still can use the old switch statement with breaks. - PR:

Re: RFR: 8049301: Suspicious use of string identity checks in JComponent.setUIProperty [v2]

2021-07-30 Thread Prasanta Sadhukhan
On Fri, 30 Jul 2021 09:32:10 GMT, Alexander Zvegintsev wrote: >> Prasanta Sadhukhan has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Prevent NPE > > src/java.desktop/share/classes/javax/swing/JComponent.java line 4194: > >> 4192:

Re: RFR: 8049301: Suspicious use of string identity checks in JComponent.setUIProperty [v2]

2021-07-30 Thread Prasanta Sadhukhan
> JComponent.setUIProperty method uses string identity check (==) rather than > string equality checks (.equals) when comparing against the property name. > This is suspicious since string identity and equality and equivalent only for > interned strings. > Rectified to use String.equals()