The `ImageIcon(Image)` constructor sets the description field to the value of 
"comment" property if it's a string. The `ImageIcon(Image, String)` constructor 
calls ImageIcon(Image). Since the two-parameter constructor explicitly provides 
the value for the description field, the implicitly set value for description 
is immediately overwritten, which is wasted work. 

Fix is to let `ImageIcon(Image, String) `constructor do the actual work of 
setting the fields and loading the image

-------------

Commit messages:
 - 8361610: Avoid wasted work in ImageIcon(Image) for setting description

Changes: https://git.openjdk.org/jdk/pull/26873/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26873&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8361610
  Stats: 15 lines in 1 file changed: 7 ins; 0 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/26873.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26873/head:pull/26873

PR: https://git.openjdk.org/jdk/pull/26873

Reply via email to