RFR: 8352682: Opensource JComponent tests [v2]

Prasanta Sadhukhan psadhukhan at openjdk.org
Mon Apr 14 12:54:41 UTC 2025


On Fri, 11 Apr 2025 16:46:47 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> test/jdk/javax/swing/JComponent/bug4247610.java line 122:
>> 
>>> 120:         return !passFlag;
>>> 121:     }
>>> 122:     private static synchronized void fail() {
>> 
>> I think these methods are a bit redundant, just add more code to read and understand. What about removing them and just renaming the flags `failed` and `traced`?
>> What do you think?
>
> I agree traceFlag and passFlag are declared as volatile vars , so all four synchronized methods look redundant and can be removed to simplify the code.
> 
>  These vars can be converted to CountDownLatch for stability.

Ok. Redundant methods removed...utiliesed the vars..
CountDownLatch not needed as there's not indeterministic sleep in it, it is relying on flags which are deterministic in itself..

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24562#discussion_r2041397571


More information about the client-libs-dev mailing list