RFR: 8159055: ImageIcon.setImage and ImageIcon(Image) constructor can't handle null parameter [v9]

Alexey Ivanov aivanov at openjdk.org
Fri Jun 20 11:53:30 UTC 2025


On Fri, 20 Jun 2025 05:04:12 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> If we leave it to throw NPE, then JCK might crib, if at some point they decide to add test to test null image and since javadoc doesn't mention it can throw NPE, it will result in non-compliance and then we have to modify javadoc to clarify it, so I guess it's best to take preventive action now..

But it is *consistent* with the current behaviour and it is not specified at the moment.

If we explicitly specify the constructors throw NPE if a `null` parameter is passed, then JCK will add a test that confirms the specified behaviour. All the constructors come into picture then, which seems out of scope for this issue…

If we don't change the behaviour of constructors and JCK challenges the implementation, then such a JCK test has no foundation in the API specification; yet it also leads to JCK challenge of the clarity of the specification.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25767#discussion_r2158779998


More information about the client-libs-dev mailing list