On Mon, 28 Jul 2025 20:53:23 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

> Currently, [JDK-8159055](https://bugs.openjdk.org/browse/JDK-8159055) is an 
> enhancement which made sense while the goal of this PR was to change 
> `Image.setImage` so that it accepts `null` as parameter.
> 
> After a month of discussions, that solution has been abandoned, instead it is 
> stated that `Image.setImage` will throw `NullPointerException` if `image` 
> parameter is `null`.

I think the proposed fix to accept `null` for `Image.setImage` should've been 
accepted, specifically 
https://github.com/openjdk/jdk/compare/master...340254ecceab48f5a0037b32e477a0e168ab2779

Then for documenting handling `null` and invalid parameters, a new bug 
should've been created, as per [this 
discussion](https://github.com/openjdk/jdk/pull/25767#issuecomment-3063379284):

> This class is a bit of a mess of accidental behaviours and scant 
> documentation.
>
> Let's document all the NPE behaviours and include a test that verifies it.
> 
> And invalid data like "new byte[0]" or null for a file name, or pointing to 
> something that isn't an image file, or an invalid URL .. etc .. results in an 
> Image instance being present, but it will never be completed so can never be 
> drawn.

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

PR Comment: https://git.openjdk.org/jdk/pull/25767#issuecomment-3129978878

Reply via email to