RFR: 8351884: Refactor bug8033699.java test code
Alexey Ivanov
aivanov at openjdk.org
Thu Apr 17 16:52:49 UTC 2025
On Tue, 15 Apr 2025 19:49:43 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:
>> Details:
>> Refactored code as requested in the Bug description.
>>
>> Tested and verified the test passes.
>
> test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java line 181:
>
>> 179: mainFrame.getContentPane()
>> 180: .setLayout(new BoxLayout(mainFrame.getContentPane(),
>> 181: BoxLayout.Y_AXIS));
>
> Minor nit:
> Can be simplified by removing .getContentPane() from ln#170-173) as well similar to the following.
>
> Suggestion:
>
> mainFrame.setLayout(new BoxLayout(mainFrame.getContentPane(),
> BoxLayout.Y_AXIS));
This not necessary… it doesn't change the logic, and leaving adding components as they are (unless updated with a new vertical box) preserves attribution to the original author of the test.
Minor nit, the suggestion is incorrect, or rather it looks incorrect. The first parameter to `BoxLayout` constructor should be the component to which you set the layout, and preserving `.getContentPane()` makes the code look correct.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24384#discussion_r2049319828
More information about the client-libs-dev
mailing list