On Fri, 20 Mar 2026 06:41:14 GMT, Renjith Kannath Pariyangad
<[email protected]> wrote:
>> Hi Reviewers,
>>
>> I have updated the method with `for loop` and `==` so the code will mach
>> with `addInvalidComponent`
>>
>> Please review and let me know your suggestions
>
> Renjith Kannath Pariyangad has updated the pull request incrementally with
> two additional commits since the last revision:
>
> - Adde line at end
> - Fixed white space error
Looks good to me except for some minor possible improvements to the test.
Since I'm a contributor now, we need another reviewer's approval is required.
test/jdk/javax/swing/RepaintManager/RemoveInvalidComponentTest.java line 43:
> 41: private static int counter;
> 42:
> 43: private final int id = ++counter;
The `counter` and `id` aren't really used, we can safely remove them and modify
`validate` to just print a generic message ("validate called").
The `validate` method can't be called on any other object but `label1`.
test/jdk/javax/swing/RepaintManager/RemoveInvalidComponentTest.java line 59:
> 57: public boolean equals(Object obj) {
> 58: return obj instanceof EqualLabel el
> 59: && el.getText().equals(getText());
Suggestion:
return obj instanceof EqualLabel el
&& el.getText().equals(getText());
I prefer aligning `&&` directly under `obj`… but it's minor…
test/jdk/javax/swing/RepaintManager/RemoveInvalidComponentTest.java line 76:
> 74: System.out.println(label1.equals(label2));
> 75:
> 76: JFrame frame = new JFrame("RepaintManagerTest");
Suggestion:
JFrame frame = new JFrame("RemoveInvalidComponentTest");
For consistency with the class name.
test/jdk/javax/swing/RepaintManager/RemoveInvalidComponentTest.java line 88:
> 86: repaintManager.removeInvalidComponent(label2);
> 87:
> 88: repaintManager.validateInvalidComponents();
Suggestion:
repaintManager.addInvalidComponent(label1);
repaintManager.removeInvalidComponent(label2);
repaintManager.validateInvalidComponents();
We can remove the blank lines to make the test code more succinct.
-------------
Marked as reviewed by aivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/30184#pullrequestreview-3982522282
PR Comment: https://git.openjdk.org/jdk/pull/30184#issuecomment-4099312727
PR Review Comment: https://git.openjdk.org/jdk/pull/30184#discussion_r2966638366
PR Review Comment: https://git.openjdk.org/jdk/pull/30184#discussion_r2966665508
PR Review Comment: https://git.openjdk.org/jdk/pull/30184#discussion_r2966679467
PR Review Comment: https://git.openjdk.org/jdk/pull/30184#discussion_r2966665893