RFR: 8361286: Allow enabling of background loading for images loaded from an InputStream

Andy Goryachev angorya at openjdk.org
Thu Aug 21 14:32:09 UTC 2025


On Mon, 18 Aug 2025 20:42:20 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>>> `FXMLoader` uses the `@NamedArg` annotation to associate XML attribute values with constructor arguments.
>> 
>> I wonder if this should be explained in the @NamedArg javadoc.
>
>> > `FXMLoader` uses the `@NamedArg` annotation to associate XML attribute values with constructor arguments.
>> 
>> I wonder if this should be explained in the @NamedArg javadoc.
> 
> It probably should, I never use FXML, but I should have guessed it was for that purpose :)

@hjohn in case you missed my earlier comment:

Noticed it does not close the input stream with a synchronous constructor (it does with the async one).

you can try it with the monkey tester from this branch https://github.com/andy-goryachev-oracle/MonkeyTest/tree/image.from.stream

or simply


            byte[] b = ImageTools.writePNG(src);
            ByteArrayInputStream in = new ByteArrayInputStream(b) {
                @Override
                public void close() throws IOException {
                    System.out.println("Closed " + Thread.currentThread());
                }
            };

            // requires JDK-8361286: Allow enabling of background loading for images loaded from an InputStream
            Image im = new Image(in, loadInBackground);
            imageView.setImage(im);
        } catch (IOException e) {
            e.printStackTrace();
        }

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

PR Comment: https://git.openjdk.org/jfx/pull/1875#issuecomment-3210853055


More information about the openjfx-dev mailing list