RFR: 8375561: Class NGGroup is in need of some cleanup [v2]
Christopher Schnick
duke at openjdk.org
Fri Jan 16 22:25:42 UTC 2026
On Fri, 16 Jan 2026 22:01:09 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> Christopher Schnick has updated the pull request incrementally with three additional commits since the last revision:
>>
>> - Remove space
>> - Use for loops again
>> - Remove unused method
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGGroup.java line 204:
>
>> 202: * @param blendMode cannot be null
>> 203: */
>> 204: public void setBlendMode(Blend.Mode blendMode) {
>
> This method looks unused, may as well remove if we're cleaning up stuff.
Good catch, removed it
> modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGGroup.java line 287:
>
>> 285: } while (bot == null || !idValid);
>> 286:
>> 287: bot.unref();
>
> This `null` check could be important if a `Group` is empty. Please verify.
It can't reach that part if the value is null. The preceding while loop will loop until it is not null
> modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGGroup.java line 451:
>
>> 449: NGNode child;
>> 450: List<NGNode> orderedChildren = getOrderedChildren();
>> 451: for (NGNode orderedChild : orderedChildren) {
>
> You may want to stick with the normal `for` loops as they don't require allocating an iterator object.
Is that nowadays still not optimized internally to some degree? Since for each loops are so common now, I thought that the compiler would perform good enough optimizations.
I chose for each loops here because the original issue was caused by the indicies in the for loop
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2043#discussion_r2700144429
PR Review Comment: https://git.openjdk.org/jfx/pull/2043#discussion_r2700142140
PR Review Comment: https://git.openjdk.org/jfx/pull/2043#discussion_r2700138945
More information about the openjfx-dev
mailing list