On Wed, 7 May 2025 09:28:53 GMT, Michael Strauß <mstra...@openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/application/preferences/PreferenceProperties.java >> line 258: >> >>> 256: } >>> 257: >>> 258: // This method must only be called on the FX application >>> thread. >> >> add `Toolkit.getToolkit().checkFxUserThread();` then? > > The `Toolkit.getToolkit().checkFxUserThread()` check is in the calling method. since it's a public method accessible to the application via the same method, I think you either need to make it private or add the check. >> modules/javafx.graphics/src/main/java/com/sun/javafx/application/preferences/PreferenceProperties.java >> line 312: >> >>> 310: >>> 311: // This method must only be called when synchronized on >>> 'mutex'. >>> 312: public void updateEffectiveValue() { >> >> maybe make this method private then: the instance of this class is available >> via `Platform.getPreferences()` if I read this correctly > > No, the instance of `PreferenceProperties` is only stored as a private field > in `PlatformPreferences`. I'm usually using public methods in nested classes > to indicate that the method is supposed to be called from outside of the > nested class. That's not strictly necessary, but I think it serves to > differentiate them from "purely" private methods. let me try again: `Platform.getPreferences()` returns an instance of `PlatformPreferences` `PlatformPreferences.colorSchemeProperty()` returns a `ColorSchemeProperty` with a public `updateEffectiveValue()` the app can use reflection to invoke a public method, though admittedly in a convoluted way. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1655#discussion_r2077789898 PR Review Comment: https://git.openjdk.org/jfx/pull/1655#discussion_r2077785625