Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8350924: javax/swing/JMenu/4213634/bug4213634.java fails #23837

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

prsadhuk
Copy link
Contributor

@prsadhuk prsadhuk commented Feb 28, 2025

Test fails in ubuntu OCI system..Made it more robust my adding waitForIdle/delay before commencing test..
OCI system is ok with the fix.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8350924: javax/swing/JMenu/4213634/bug4213634.java fails (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23837/head:pull/23837
$ git checkout pull/23837

Update a local copy of the PR:
$ git checkout pull/23837
$ git pull https://git.openjdk.org/jdk.git pull/23837/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23837

View PR using the GUI difftool:
$ git pr show -t 23837

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23837.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 28, 2025

👋 Welcome back psadhukhan! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Feb 28, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 28, 2025
@openjdk
Copy link

openjdk bot commented Feb 28, 2025

@prsadhuk The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented Feb 28, 2025

Webrevs

test();
}

public void createAndShowGUI() {
public static void createAndShowGUI() {
frame = new JFrame("TEST");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use a more specific title?

}
SwingUtilities.invokeAndWait(() -> {
frame.dispose();
if (!menu.isSelected()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, the condition !menu.isSelected() was verified before the frame was disposed of.

I think you should verify whether menu is select before disposing of the frame; once the frame is disposed of, the state of components is not well-defined.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, frame.dispose() can be added within finally block instead of here.

@@ -39,35 +39,29 @@
* @test
* @key headful
* @bug 4213634 8017187
* @author Scott Violet
* @library ../../regtesthelpers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @library ../../regtesthelpers
* @library /java/awt/regtesthelpers

Robot robot = new Robot();
robot.setAutoDelay(50);
robot.waitForIdle();
private static void test() throws AWTException, InterruptedException, InvocationTargetException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static void test() throws AWTException, InterruptedException, InvocationTargetException {
private static void test() throws Exception {

}
SwingUtilities.invokeAndWait(() -> {
frame.dispose();
if (!menu.isSelected()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, frame.dispose() can be added within finally block instead of here.

@@ -77,33 +71,30 @@ public void createAndShowGUI() {
frame.getContentPane().add("Center", ta);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text area seems redundant, especially the text inside which looks like an Easter egg.

@@ -116,8 +107,9 @@ public void actionPerformed(ActionEvent e) {
"Failed: Mnemonic activated");
}
});
if(bFlag)
Copy link
Contributor

@DamonGuy DamonGuy Mar 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can also fix the for-loop above into:

for (int i = 0; i < 10; i++) {

And can make a lambda expression by using:

    menuitem.addActionListener(e -> {
                throw new RuntimeException(
                        "Failed: Mnemonic activated");
            });

Comment on lines +55 to 57
SwingUtilities.invokeAndWait(() -> {
createAndShowGUI();
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SwingUtilities.invokeAndWait(() -> {
createAndShowGUI();
});
SwingUtilities.invokeAndWait(() -> createAndShowGUI());

@@ -77,33 +71,30 @@ public void createAndShowGUI() {
frame.getContentPane().add("Center", ta);
JButton button = new JButton("Test");
frame.getContentPane().add("South", button);
frame.setBounds(100, 100, 400, 400);
frame.setSize(400, 400);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the best frame size? I see the text area has text to output, but the full sentence isn't even shown and there's no word wrap. Can change the text to anything else, especially since the TextArea text exceeds the line char limit. There's also a lot of empty space in this test frame. So, this can be changed in a variety of ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client [email protected] rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants