Skip to content

8359430: Test 'javax/swing/plaf/windows/bug4991587.java' automatically failed on Windows 2025 x64 with message "Failed. Compilation failed: Compilation failed" #25883

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

DamonGuy
Copy link
Contributor

@DamonGuy DamonGuy commented Jun 18, 2025

Compilation error on windows with WindowsButtonUI used. Replaced it with BasicButtonUI to maintain overriding the paintText method but this was not the same as Windows L&F buttons. I attempted to import WindowsButtonUI and extending it, but the class is final. Instead, I chose to add a LineBorder in the same way as when a Rectangle was drawn to keep the same test behavior. It seems the extra 1 pixel width is unnecessary now when testing, so the changes only include removing MyButtonUI and adding a LineBorder.

This updated test now compiles and runs as expected. The test has all of the text within the blue button border. There does not seem to be any overlapping or out of bounds text as originally described with the original test.


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-8359430: Test 'javax/swing/plaf/windows/bug4991587.java' automatically failed on Windows 2025 x64 with message "Failed. Compilation failed: Compilation failed" (Bug - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25883

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 18, 2025

👋 Welcome back dnguyen! 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 Jun 18, 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 Jun 18, 2025
@openjdk
Copy link

openjdk bot commented Jun 18, 2025

@DamonGuy 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 Jun 18, 2025

Webrevs

@mrserb
Copy link
Member

mrserb commented Jun 18, 2025

Please confirm that you can reproduce JDK-4991587 by the updated test.

@DamonGuy
Copy link
Contributor Author

Please confirm that you can reproduce JDK-4991587 by the updated test.

The updated test does contain all of the text within the blue border now as expected (instead of overlapping or being outside the borders of the textRect, as described in the original issue). I have updated the summary to this PR as well. Thanks!

@mrserb
Copy link
Member

mrserb commented Jun 19, 2025

You could also take this opportunity to automate the test. I believe it should be possible to verify that the border is not distorted.

f.add(button2);

return f;
}

static class MyButtonUI extends WindowsButtonUI {
Copy link
Member

Choose a reason for hiding this comment

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

Use composition here: extend BasicButtonUI, create a WindowsButtonUI¹ object and forward all the methods² to the instance of WindowsButtonUI. In the paintText method, draw the rectangle and then call the implementation of your WindowsButtonUI.

¹ Use WindowsButtonUI.createUI to create an instance.
² All the overridden methods in WindowsButtonUI.

Copy link
Member

Choose a reason for hiding this comment

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

It would be good if we could eliminate the reference to WindowsButtonUI. It might also be useful to check the behavior across all L&Fs.

Copy link
Member

Choose a reason for hiding this comment

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

It would be good if we could eliminate the reference to WindowsButtonUI.

But we want the regression to reproduce the original problem. The problem was specific to WindowsButtonUI, in WindowsGraphicsUtils according to comments in the bug.

It may be impossible to reproduce the problem without referencing WindowsButtonUI. If it's possible, I'm all for it.

It might also be useful to check the behavior across all L&Fs.

The bug was in Windows L&F, I don't think it's applicable to other L&F.

On Windows, the disabled text was painted with “shadow” with offset of (1, 1) which could be painted over another part of the button. Other L&Fs are free to paint the button differently.

Copy link
Member

Choose a reason for hiding this comment

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

It may be impossible to reproduce the problem without referencing WindowsButtonUI. If it's possible, I'm all for it.

That should be checked on old jdk build.

The bug was in Windows L&F, I don't think it's applicable to other L&F.

It depends on how these offsets were used previously, maybe we displayed the text outside the button, which shouldn't happen for all L&Fs.

@aivanov-jdk
Copy link
Member

Please confirm that you can reproduce JDK-4991587 by the updated test.

The updated test does contain all of the text within the blue border now as expected (instead of overlapping or being outside the borders of the textRect, as described in the original issue). I have updated the summary to this PR as well. Thanks!

Did you run the test with Java 5 where JDK-4991587 isn't fixed?

I don't expect a border added to a button will reproduce the problem. I may be wrong.

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.

3 participants