On Thu, 15 Jan 2026 01:57:41 GMT, Christopher Schnick <[email protected]> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGGroup.java
>> line 259:
>>
>>> 257: NGNode child;
>>> 258: try {
>>> 259: child = orderedChildren.get(i);
>>
>> You should remove the try-catch block as your change ensures that
>> `List.get()` is never called with an invalid index.
>
> Judging from the comment below, the catch block was mainly meant to handle
> concurrent modifications of the list. That scenario might still happen
It does say that, but I don't believe it to be necessary or effective. First of
all, there should be no concurrent modifications. The rest of this class
assumes this to be true, as `getOrderedChildren()` is iterated over in six
other places in the same class, all without wrapping the getter in a try-catch
block. Second, you've removed the only scenario where the getter is called with
an objectively wrong index (-1), and actually throws an exception.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2037#discussion_r2694566221