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

Kevin Rushforth kcr at openjdk.org
Tue Sep 30 16:54:12 UTC 2025


On Sat, 23 Aug 2025 14:26:51 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> Support background loading of raw input streams
>> 
>> - Fixed generics (mix up of two ImageLoader types)
>> - Removed unused code for handling headers, methods, request parameters
>> - Use `long` for progress as streams may exceed 2 GB
>> - Improved documentation of Image regarding background loading
>
> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Clarify documentation with regards to stream closing

The new API and code changes look good with one comment on the docs. In a few places you say "the image loading is performed immediately and is completed _after_ this constructor returns". The word "after" is misleading in that it could imply some sort of async behavior. I recommend changing it to "when", which you already use in other places.

I left one other minor formatting issue that I happened to spot.

I think that this is ready for the CSR once you change "after" to "when" in the various places.

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java line 829:

> 827:             String protocol = u.getProtocol();
> 828: 
> 829:             if(protocol.equals("http") || protocol.equals("https")) {

Minor: add a space after `if`.

modules/javafx.graphics/src/main/java/javafx/scene/image/Image.java line 625:

> 623:      * <p>
> 624:      * The image loading is performed immediately and is completed after this
> 625:      * constructor returns.

I think it would it be clearer to say that it is completed "when" this constructor returns, as you do in a couple other places. As it is "after ... returns" could mislead someone into thinking that the operation might not be complete upon return.

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

PR Review: https://git.openjdk.org/jfx/pull/1875#pullrequestreview-3285769936
PR Review Comment: https://git.openjdk.org/jfx/pull/1875#discussion_r2392152597
PR Review Comment: https://git.openjdk.org/jfx/pull/1875#discussion_r2392164552


More information about the openjfx-dev mailing list