RFR: 8339902: Open source couple TextField related tests [v4]

Alexander Zuev kizune at openjdk.org
Tue Sep 17 00:23:35 UTC 2024


On Mon, 16 Sep 2024 23:25:02 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> Alexander Zuev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Make varible volatile
>
> test/jdk/java/awt/TextField/CaretPositionTest/CaretPositionTest.java line 51:
> 
>> 49:     private Dimension size;
>> 50:     String text = "12 45 789";
>> 51:     private static int position = -1;
> 
> Since position var is accessed in 2 different threads, should it be changed to volatile?

Can be.

> test/jdk/java/awt/TextField/CaretPositionTest/CaretPositionTest.java line 53:
> 
>> 51:     private static int position = -1;
>> 52: 
>> 53:     public static void main(String[] args) throws InterruptedException,
> 
> Can be simplified to throw generic Exception
> Suggestion:
> 
>     public static void main(String[] args) throws Exception

Same, i prefer to list all checked exceptions that i intentionally do not catch - makes it safer to modify if needed later.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21026#discussion_r1762109327
PR Review Comment: https://git.openjdk.org/jdk/pull/21026#discussion_r1762110230


More information about the client-libs-dev mailing list