RFR: JDK-8315876 Open source several Swing CSS related tests [v2]

Alexey Ivanov aivanov at openjdk.org
Mon Sep 18 19:10:45 UTC 2023


On Mon, 18 Sep 2023 18:16:38 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> test/jdk/javax/swing/text/html/CSS/bug4174871.java line 41:
>> 
>>> 39:     private static JFrame frame;
>>> 40:     private static JTextPane pane;
>>> 41:     private static volatile boolean passed = false;
>> 
>> Explicitly assigning the default value is redundant.
>> 
>> Moreover, you always assign a value in the `testUI` method.
>> 
>> This comment also applies to the tests below.
>
> I agree. There are some tests that start with passed as 'true', hence explicitly assigned 'false' to boolean var in these tests even though it is redundant as to add clarity when running the tests.

With volatile, it makes the test slightly slower. Other than that, there's not much harm.

In most of these tests, there's no need for the `passed` field at all: you can throw the exception from the code where you set the value to `passed`, however, the stack trace will be less pretty because it will come from EDT.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15769#discussion_r1329167488


More information about the client-libs-dev mailing list