On Fri, 11 Apr 2025 05:52:47 GMT, Jayathirth D V <[email protected]> wrote:
> Few swing JList tests are open sourced.
test/jdk/javax/swing/JList/bug4618767.java line 29:
> 27: * @summary First letter navigation in JList interferes with mnemonics
> 28: * @key headful
> 29: * @run main bug4618767
Nitpick: is this line necessary?
test/jdk/javax/swing/JList/bug4618767.java line 55:
> 53: public static void main(String[] args) throws Exception {
> 54: try {
> 55: listGainedFocusLatch = new CountDownLatch(1);
Do you think it might be better to initialise it directly on line 52?
private static CountDownLatch listGainedFocusLatch = new CountDownLatch(1);
test/jdk/javax/swing/JList/bug4618767.java line 86:
> 84: });
> 85:
> 86: list = new JList(new String[] {"one", "two", "three",
> "four"});
Do you think it might be easier to read if this is initialised on line 49?
private static final JList list = new JList(new String[] {"one", "two",
"three", "four"});
and the same for line 69 `f = new JFrame("bug4618767");`
I feel it is going to be easier to read if global variables were initialised at
class level when possible, especially if they are not reassigned further. This
way they can also be finalised. But if you feel it's ok as it is, I'm fine with
it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2039272750
PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2039253130
PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2039255012