RFR: 8373885: Compilation failure due to a warning when compiling with Java 25

Kevin Rushforth kcr at openjdk.org
Wed Dec 17 15:07:00 UTC 2025


On Wed, 17 Dec 2025 13:43:35 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

> When compiling JavaFX with Java 25, a new warning appears. This warning will result in a compilation failure because warnings are treated as error (`-Werror`).
> 
> The following warning appears:
> 
> 
>> Task :controls:compileJava
> C:..\jfx\modules\javafx.controls\src\main\java\javafx\scene\control\SplitPane.java:320: warning: [identity] use of a value-based class with an operation that expects reliable identity
>     private final WeakHashMap<Integer, Double> dividerCache = new WeakHashMap<>();
>                                                                              ^
> C:..\jfx\modules\javafx.controls\src\main\java\javafx\scene\control\SplitPane.java:320: warning: [identity] use of a value-based class with an operation that expects reliable identity
>     private final WeakHashMap<Integer, Double> dividerCache = new WeakHashMap<>();
>                              ^
> error: warnings found and -Werror specified
> 1 error
> 2 warnings
> 
>> Task :controls:compileJava FAILED
> 
> 
> The warning makes sense: We use a `WeakHashMap` with the `Integer` class. So the `Integer` values are saved as `WeakRef` inside the `Map`. This makes no sense and is rightfully a warning.

Changes requested by kcr (Lead).

We don't see this warning in GHA builds nor our production builds, both of which use JDK 25 (25.0.1 to be precise) to build. I'd like to understand why before we proceed.

modules/javafx.controls/src/main/java/javafx/scene/control/SplitPane.java line 316:

> 314: 
> 315:     // Cache the divider positions if the items have not been created.
> 316:     private final Map<Integer, Double> dividerCache = new HashMap<>();

I don't understand why this would have anything to do with a compiler warning. Further, this will likely lead to a leak, so I doubt this is what we want.

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

PR Review: https://git.openjdk.org/jfx/pull/2010#pullrequestreview-3588181048
PR Comment: https://git.openjdk.org/jfx/pull/2010#issuecomment-3665758215
PR Review Comment: https://git.openjdk.org/jfx/pull/2010#discussion_r2627427013


More information about the openjfx-dev mailing list