RFR: 8306996: Open source Swing MenuItem related tests

Phil Race prr at openjdk.org
Fri May 5 18:12:19 UTC 2023


On Fri, 5 May 2023 04:56:22 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

> This PR is to open source JMenuItem related swing tests.

test/jdk/javax/swing/JMenuItem/bug4304129.java line 47:

> 45:     public static void main(String args[]) throws Exception {
> 46:         bug4304129 test = new bug4304129();
> 47:         test.init();

I don't see why we need an instance here.
The body of init() can be moved into main() and mnemonic and accelerator made static

test/jdk/javax/swing/JMenuItem/bug4839464.java line 79:

> 77:     public static JButton changeShortDescButton;
> 78: 
> 79:     public JMenuItem item;

it seems a bit odd that this and some below are instance vars  and the ones above are static

Should you make them all static  ?.. and then you don't need an instance of the test class either
Or make them all instance .. either way ...

I also find it odd that this test creates TWO Robots - one AWT Robot and one JRobot.
Can you consolidate these ?

test/jdk/javax/swing/JMenuItem/bug4966168.java line 46:

> 44:     public static void main(String args[]) throws Exception {
> 45:         bug4966168 test = new bug4966168();
> 46:         test.init();

No need I can see for the instance. Collapse init() into main()

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13822#discussion_r1186370032
PR Review Comment: https://git.openjdk.org/jdk/pull/13822#discussion_r1186374563
PR Review Comment: https://git.openjdk.org/jdk/pull/13822#discussion_r1186375045



More information about the client-libs-dev mailing list