<Swing Dev> RFR: 8049301: Suspicious use of string identity checks in JComponent.setUIProperty [v2]
Sergey Bylokhov
serb at openjdk.java.net
Fri Jul 30 19:51:33 UTC 2021
On Fri, 30 Jul 2021 10:38:58 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> 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 for interned strings.
>> Rectified to use String.equals() check.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> Prevent NPE
FYI the "==" was used intentionally for the performance reason and it worked fine since the property's names are interned(used as string literals only).
-------------
PR: https://git.openjdk.java.net/jdk/pull/4943
More information about the swing-dev
mailing list