RFR: 8159055: Clarify handling of null and invalid image data for ImageIcon constructors and setImage method [v24]
Phil Race
prr at openjdk.org
Fri Aug 1 20:12:07 UTC 2025
On Thu, 31 Jul 2025 02:31:50 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/swing/ImageIcon.java line 68:
>>
>>> 66: * If the image source parameter to a constructor or method is non-null,
>>> 67: * but does not reference valid accessible image data,
>>> 68: * no exceptions will be thrown but the image will be unset,
>>
>> "will behave as if unset" ?
>> or maybe
>> "will behave as if uninitialized " ?
>
> @prrace Any objection to my suggestion of statement? I guess that is succinct and describe what's the end result!!
> `no exceptions will be thrown but the image will behave as if unset/uninitialized/null` doesn't sound right in my opinion as then user need to know "how it would behave" when image is unset or null which is basically image icon not getting rendered so I thought to cut the chase and describe the final result
> “will behave as if the image is null”
That's got the same mention of null that Joe was questioning
>"no exceptions will be thrown but no image icon will be rendered"
That seems OK to me. I'd just drop the word 'icon'.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25767#discussion_r2248790134
More information about the client-libs-dev
mailing list