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

John Hendrikx jhendrikx at openjdk.org
Mon Aug 18 20:12:54 UTC 2025


On Mon, 18 Aug 2025 20:01:57 GMT, Andy Goryachev <angorya 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
>
> modules/javafx.graphics/src/main/java/javafx/scene/image/Image.java line 743:
> 
>> 741:      * @throws NullPointerException if input stream is null
>> 742:      */
>> 743:     public Image(@NamedArg("is") InputStream is, @NamedArg("backgroundLoading") boolean backgroundLoading) {
> 
> suggestion: swap the arguments to avoid explicit typecasting in the case of `(null, boolean)`

`null` isn't allowed, so this is only in the test.  Also, the cast is only to select the correct method overload, there won't actually be a cast.  I also think it is better to keep the same order (there is another constructor that takes an `InputStream` + parameters, and there are similar constructors for URL + parameters)

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1875#discussion_r2283352941


More information about the openjfx-dev mailing list