On Mon, 13 Apr 2026 21:21:48 GMT, Marius Hanl <[email protected]> wrote:

>> This PR removes all `StubToolkit` checks from JavaFX production code.
>> There are only a few.
>> 
>> Two notes:
>> 
>> Note 1: `TableRowSkinBase`s `DO_ANIMATIONS` is now `true` for tests. It was 
>> not before due to a leak (as far as I could find when digging 
>> [JDK-8120657](https://bugs.openjdk.org/browse/JDK-8120657)). But I could not 
>> find any problem, even running all tests with `-Xmx512m`
>> Checking tests that trigger the affected code path and creating a heapdump 
>> after, I could not see anything weird:
>>> Heapdump after `TreeTableViewResizeTest`:
>> <img width="859" height="542" alt="image" 
>> src="https://github.com/user-attachments/assets/744d27f2-73e7-4213-ae6f-63b0c2b10f7a";
>>  />
>> <img width="858" height="347" alt="image" 
>> src="https://github.com/user-attachments/assets/0a873611-ae76-4ea9-82b6-bad4cba84fd3";
>>  />
>> 
>> Note 2: Now when the tests run in CI, `JavaFX: using 
>> test.com.sun.javafx.pgstub.StubToolkit` is now printed 12 times (probably 
>> the amount of Unit Test Threads):
>> <img width="1451" height="514" alt="image" 
>> src="https://github.com/user-attachments/assets/c0a9f49d-5d37-4df6-a15a-4aa4cb1b4b83";
>>  />
>> If this is a problem, we can decide if we want to change the print code in 
>> `Toolkit` (in a follow-up). 
>> -> Changed to `System.out` in this PR.
>> 
>> ---------
>> - [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 incrementally with one additional 
> commit since the last revision:
> 
>   Use System.out, remove = null assignment which is thankfully not needed in 
> Java (looking at you, C++)

modules/javafx.base/src/main/java/com/sun/javafx/PlatformUtil.java line 298:

> 296:      * @implNote To save CPU cycles, animations are not done for embedded
> 297:      */
> 298:     public static boolean isDoAnimations() {

I think we shouldn't hard-code behavior for different platforms, especially 
since the assumption that **all** embedded platforms are totally unable to show 
animations is flawed at best. There are powerful embedded systems.

We've had `Scene.Preferences.reducedMotion` for quite some time now, so we 
should make animations depend on that preference instead. For backwards 
compatibility, we could make `Platform.Preferences.reducedMotion` default to 
`true` on embedded platforms.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2146#discussion_r3279653840

Reply via email to