On Fri, 16 May 2025 07:03:38 GMT, Lukasz Kostyra <lkost...@openjdk.org> wrote:

>> This follow-up change finishes the earlier changes to 
>> `ImageStorage.loadAll()` and adds support for loading specific scale 
>> requested in the input.
>> 
>> `loadAll()` will now first check if the input path ends with a scaling level 
>> specified, and if that is the case it will attempt creating a Stream. If 
>> requested resource does not exist it will throw an Exception, skipping the 
>> rest of the load process. If the resource does _not_ have a scaled name in 
>> its path, it will continue loading as normal - looking for all scale levels, 
>> trying to load the main resource and falling back to trying to load "@1x" 
>> variant.
>> 
>> Added tests to check the new `ImageTools.hasScaledName()` method + new 
>> behavior.
>
> Lukasz Kostyra has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Replace hasScaledName logic with regex

modules/javafx.graphics/src/main/java/com/sun/javafx/iio/common/ImageTools.java 
line 55:

> 53:      * Regex pattern for hasScaledName
> 54:      */
> 55:     private static final Pattern SCALED_FILE_PATTERN = 
> Pattern.compile(".*@[1-9][0-9]?x(\\.[^\\.]+)?");

You can use a non-capturing group instead of a capturing group if you don't 
intend to retrieve its value:
Suggestion:

    private static final Pattern SCALED_FILE_PATTERN = 
Pattern.compile(".*@[1-9][0-9]?x(?:\.[^\.]+)?");

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1809#discussion_r2093474688

Reply via email to