JDK-8049301 : Suspicious use of string identity checks in JComponent.setUIProperty
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 9,11,17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-07-03
  • Updated: 2021-08-05
  • Resolved: 2021-07-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 18
18 b09Fixed
Related Reports
Relates :  
Description
During the course of fixing JDK-8043550, it was observed that 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.

If equality checks are semantically correct, this method could be rewritten to use strings in switch.
Comments
Changeset: baf7797b Author: Prasanta Sadhukhan <psadhukhan@openjdk.org> Date: 2021-07-30 15:37:30 +0000 URL: https://git.openjdk.java.net/jdk/commit/baf7797b092704d7dc9401db8b3dda19b91be303
30-07-2021