RFR: JDK-8353755 : Add a helper method to Util - findComponent() [v3]
Harshitha Onkar
honkar at openjdk.org
Mon Nov 3 21:56:47 UTC 2025
On Thu, 23 Oct 2025 13:58:20 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Review changes: EDT check
>
> test/jdk/javax/swing/regtesthelpers/Util.java line 1:
>
>> 1: /*
>
>> Existing `Util.findSubComponent()` finds component by class name
>
> To eliminate code duplication, the existing `findSubComponent` should use the new `findComponent` which is more flexible. Just pass `parent.getClass().getName().contains(className)` as the predicate to the new method.
Tested by in turn calling findComponent() from findSubComponent() it does not work as expected since the recursive logic to find the component differs for both methods.
Replacing findSubComponent() as below with the latest changes does not work. To verify run javax/swing/JColorChooser/Test7194184.java by replacing the findSubComponent() as below.
public static Component findSubComponent(Component parent, String className) {
String parentClassName = parent.getClass().getName();
if (parentClassName.contains(className)) {
return parent;
}
return findComponent((Container) parent,
c -> parent.getClass().getName().contains(className));
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27944#discussion_r2487943726
More information about the client-libs-dev
mailing list