Skip to content

Conversation

@mickleness
Copy link
Contributor

@mickleness mickleness commented Sep 10, 2025

Previously:

If DesktopProperty#updateAllUIs threw an exception, we would never reset the update-pending property to false. This means any subsequent call to updateUI() would not attempt to call updateAllUIs()

With this change:
Subsequent calls to DesktopProperty#updateUI() can still trigger at least one call to updateAllUIs().


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-8367376: Bad ButtonUI prevents other components from updating when system changes desktop properties (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27205

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

Using diff file

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

Using Webrev

Link to Webrev Comment

Previously:
If updateAllUIs threw an exception, we would never reset the update-pending property to false. This means any subsequent call to `updateUI()` would not attempt to call `updateAllUIs()`
@bridgekeeper
Copy link

bridgekeeper bot commented Sep 10, 2025

👋 Welcome back jwood! 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 Sep 10, 2025

@mickleness This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8367376: Bad ButtonUI prevents other components from updating when system changes desktop properties

Reviewed-by: aivanov, prr, psadhukhan

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 156 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@prrace, @aivanov-jdk, @prsadhuk) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk
Copy link

openjdk bot commented Sep 10, 2025

@mickleness 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.

@openjdk openjdk bot added client client-libs-dev@openjdk.org rfr Pull request is ready for review labels Sep 10, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 10, 2025

@mickleness mickleness changed the title 8367376: call setUpdatePending(false) in a finally block 8367376: Bad ButtonUI prevents other components from updating when system changes desktop properties Sep 11, 2025
Copy link
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me.
@prsadhuk please review.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 15, 2025
p.add(button);
getContentPane().add(p);
}
} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

A file should end with new line (\n) character.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, this is updated

import java.awt.Toolkit;
import java.util.concurrent.CountDownLatch;

public class Test8367376 extends JFrame {
Copy link
Member

Choose a reason for hiding this comment

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

Give the test a meaningful name? UninstallUIThrowsException?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. I used DesktopPropertyResetPendingFlagTest

mickleness and others added 2 commits September 17, 2025 16:32
Co-authored-by: Alexey Ivanov <alexey.ivanov@oracle.com>
Co-authored-by: Alexey Ivanov <alexey.ivanov@oracle.com>
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Sep 17, 2025
} finally {
setUpdatePending(false);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess same thing we need to do here too

public void run() {
updateAllUIs();
setUpdatePending(false);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

and here too

public void run() {
updateAllUIs();
setUpdatePending(false);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I updated Metal and Synth L&F.

The test in this PR does not currently test either of these new changes, though. Normally I'd feel nervous about that, but IMO the changes in this PR are acceptably low-risk.

Does anyone disagree? If so: should I split this into 2-3 separate tickets/PRs? The original steps involved the Windows L&F and changing the OS's accessibility contrast settings; I don't know if those steps affect Metal/Synth L&F's at all.

private static void setLookAndFeel() {
try {
String lf = UIManager.getSystemLookAndFeelClassName();
UIManager.setLookAndFeel(lf);
Copy link
Contributor

Choose a reason for hiding this comment

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

Guess we should iterate for all L&F s, not just test the default..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went the opposite direction for now: I removed any reference to the L&F. This test is structured so it emulates what the Windows L&F was doing, but it's platform/L&F-independent (for the sake of full automation).

I tested on Mac and Windows and confirmed the test still fails against master, and it passes in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you do not want to tinker with the current test, maybe you can have another test testing the L&F s, handling exception gracefully in updateUI

Copy link
Member

Choose a reason for hiding this comment

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

Since the changes are in look-and-feels, you should iterate over installed look-and-feels. Otherwise you test Aqua L&F on macOS and Metal on Windows only, which means an exception may still cause problems in other L&Fs.

Creating several tests if needed is fine, yet I don't think it's needed.

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 with Alexey. I think we should definitely iterate across all L&Fs and it can be done without creating more tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the test to iterate over all available L&F's

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 19, 2025
Copy link
Member

@aivanov-jdk aivanov-jdk left a comment

Choose a reason for hiding this comment

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

Other L&F have the same problem, so it would be good to resolve it and update the test to iterate over all installed L&Fs.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Sep 19, 2025
This was probably left over from an earlier draft; this test uses the TestDesktopProperty class so it doesn't rely on/test any particular L&F.
@@ -100,16 +89,25 @@ protected void dispatchEvent(AWTEvent event) {
};
Toolkit.getDefaultToolkit().getSystemEventQueue().push(newEventQueue);

SwingUtilities.invokeLater(
DesktopPropertyResetPendingFlagTest::setLookAndFeel);
for (UIManager.LookAndFeelInfo info :
Copy link
Contributor

Choose a reason for hiding this comment

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

UIManager import is missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks; this is updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

you can also dispose of the frame in try-finally block to be safe and consistent with headful regression tests
and you need to add @key headful to the jtreg tag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, this is updated

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 8, 2025
…agTest.java

Co-authored-by: Alexey Ivanov <alexey.ivanov@oracle.com>
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 8, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 8, 2025
@mickleness
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Oct 8, 2025
@openjdk
Copy link

openjdk bot commented Oct 8, 2025

@mickleness
Your change (at version aa565ef) is now ready to be sponsored by a Committer.

@aivanov-jdk
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Oct 9, 2025

Going to push as commit 7c75cb3.
Since your change was applied there have been 180 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 9, 2025
@openjdk openjdk bot closed this Oct 9, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Oct 9, 2025
@openjdk
Copy link

openjdk bot commented Oct 9, 2025

@aivanov-jdk @mickleness Pushed as commit 7c75cb3.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client client-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

5 participants