RFR: JDK-8353755 : Add a helper method to Util - findComponent() [v2]

Harshitha Onkar honkar at openjdk.org
Thu Oct 23 21:17:58 UTC 2025


On Thu, 23 Oct 2025 13:41:54 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 update
>
> test/jdk/javax/swing/regtesthelpers/Util.java line 153:
> 
>> 151:      * Find a component based on predicate.
>> 152:      * Always run this method on the EDT thread
>> 153:      */
> 
> The documentation could then explain the parameters, don't you think?
> 
>> Always run this method on the EDT thread
> 
> The utility method could ensure this automatically. This *public* method will be a wrapper around a *private* implementation, the implementation will run directly or on EDT using `invokeOnEDT` which already exists in the `Util` class.

There are some tests where EDT calls are interleaved between calls to robot (non-EDT) (e.g bug4759934.java - findCancelButton()) and few other tests (e.g FileSizeCheck.java - findDetailsButton() and findTable() that are within upper level method which is called on EDT). Is it better to leave it as-is for flexibility rather than add a wrapper?

If a wrapper is added we might need to check if it is already on EDT thread or not as below:


if (isEventDispatchThread()) {
   return _findComponent(container, predicate);
} else {
  return Util.invokeOnEDT(() -> _findComponent(container, predicate));
}

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27944#discussion_r2457391594


More information about the client-libs-dev mailing list