On Wed, 7 Oct 2026 13:48:44 GMT, Marius Hanl <[email protected]> wrote:

>> The new responsibility:
>> 
>> - `GlassPlatform` for everything that is glass related, including all 
>> properties like:
>>   - `use.egl` - `useEGL()`
>>   - the glass platform factory - `getPlatformFactory()`
>>   - `isHeadless()`
>>   - `isMonocle()`
>>   - `com.sun.javafx.isEmbedded` - `isEmbedded()`
>>   - `isSWT()`
>>   - `glass.accessible.force` - `isAccessibilityEnabled()`
>> 
>> - `PlatformUtil`
>>   - `isWindows()`
>>   - `isMac()`
>>   - `isLinux()`
>>   - `isUnix()`
>>   - `isIOS()`
>>   - `isAndroid()`
>>   - `isStaticBuild()`
>>   - May loads a property file (is therefore always initialized first)
>> 
>> ---
>> 
>> Something that was first discussed in 
>> https://github.com/openjdk/jfx/pull/1864 and I also saw when I did the 
>> cleanup some months ago in PR https://github.com/openjdk/jfx/pull/2190.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Marius Hanl has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 13 commits:
> 
>  - change references in test and comments
>  - Move isEmbedded(), and move the SWT check as well into GlassPlatform
>  - Merge branch 'master' of https://github.com/openjdk/jfx into 
> 8365309-move-PlatformUtil-to-javafx.graphics
>  - Merge branch 'master' of https://github.com/openjdk/jfx into 
> 8365309-move-PlatformUtil-to-javafx.graphics
>  - proper getter now
>  - Move platform factory to GlassPlatform
>  - Move accessible handling to GlassPlatform
>  - Move headless, egl embedded type (now monocle) to GlassPlatform
>  - rename to GlassPlatform, improve code a bit
>  - revert back
>  - ... and 3 more: https://git.openjdk.org/jfx/compare/68b0b112...3d429bb6

Looks good with one recommended change (the accessibility default) and a couple 
minor comments that probably don't warrant a change.

I tested this on our Jenkins system with a closed build on all platforms.

modules/javafx.graphics/src/main/java/com/sun/glass/ui/GlassPlatform.java line 
55:

> 53:         // PlatformUtil must be initialized first (in getPlatform()), as 
> it may set the system properties read below.
> 54:         String platform = getPlatform();
> 55:         PLATFORM_FACTORY = "com.sun.glass.ui." + 
> platform.toLowerCase(Locale.ROOT) + "." + platform + "PlatformFactory";

Very minor: if `getPlatform()` returns null -- which can only happen for an 
unrecognized platform where `glass.platform` was not set -- it will now throw 
an exception in the static initializer of GlassPlatform, which prevents the 
class from being initialized. This is an error condition that would have failed 
anyway, but it will now cause an earlier failure than it used to.

I don't see a need to change anything.

modules/javafx.graphics/src/main/java/com/sun/glass/ui/GlassPlatform.java line 
73:

> 71: 
> 72:     /**
> 73:      * Returns the Glass platform in use, or {@code null} if it could not 
> be determined.

Minor: maybe say "Returns the fully qualified Glass platform class"?

-------------

PR Review: https://git.openjdk.org/jfx/pull/2299#pullrequestreview-5805212867
PR Review Comment: https://git.openjdk.org/jfx/pull/2299#discussion_r4497032008
PR Review Comment: https://git.openjdk.org/jfx/pull/2299#discussion_r4497043216

Reply via email to