Integrated: 8361610: Avoid wasted work in ImageIcon(Image) for setting description

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Aug 26 02:56:46 UTC 2025


On Thu, 21 Aug 2025 02:30:11 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: e5077660
Author:    Prasanta Sadhukhan <psadhukhan at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/e5077660c4e66decc9291b09cb2efaf2f5ae982f
Stats:     15 lines in 1 file changed: 7 ins; 0 del; 8 mod

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

Reviewed-by: kizune, aivanov

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

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


More information about the client-libs-dev mailing list