RFR: 8364149: Conditional stylesheet imports [v3]

Michael Strauß mstrauss at openjdk.org
Thu Feb 26 00:49:24 UTC 2026


On Wed, 25 Feb 2026 21:33:09 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - Merge branch 'master' into feature/conditional-import
>>  - Merge branch 'master' into feature/conditional-import
>>  - Conditional stylesheet imports
>
> modules/javafx.graphics/src/main/java/javafx/css/Stylesheet.java line 315:
> 
>> 313:     private void readBinaryImports(int bssVersion, DataInputStream is, String[] strings) throws IOException {
>> 314:         for (int i = 0, max = is.readInt(); i < max; i++) {
>> 315:             int queryCount = is.readInt();
> 
> should we validate input here, at least make sure it's `>= 0` ?

`MediaQueryList(int)` will throw an exception if a capacity < 0 is passed to the constructor.

> modules/javafx.graphics/src/main/java/javafx/css/Stylesheet.java line 316:
> 
>> 314:         for (int i = 0, max = is.readInt(); i < max; i++) {
>> 315:             int queryCount = is.readInt();
>> 316:             var importConditions = new MediaQueryList();
> 
> minor: could explicitly specify the capacity via `MediaQueryList(int)`

Yes, good idea.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2031#discussion_r2856232926
PR Review Comment: https://git.openjdk.org/jfx/pull/2031#discussion_r2856233189


More information about the openjfx-dev mailing list