RFR: 8272808: Update constant collections to use the new immutable collections - leftovers

Kevin Rushforth kcr at openjdk.java.net
Thu Sep 23 12:45:56 UTC 2021


On Wed, 22 Sep 2021 21:36:26 GMT, delvh <github.com+51889757+delvh at openjdk.org> wrote:

>> Replacements of more immutable collections.
>> 
>> One thing I found was that the field `idMap` in `com.sun.java.scene.web.WebViewHelper.WebView` seems unused. I can remove it if that's indeed the case.
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/font/WindowsFontMap.java line 32:
> 
>> 30: class WindowsFontMap {
>> 31: 
>> 32:     private static class FamilyDescription {
> 
> Isn't that basically a `record`  in disguise?
> Letting this class be a record would remove a lot of lines, especially down below.
> Also, it would come with the benefit of not having to worry about whether these values have been changed or not as they would then always be final.
> To me at least it does not look as if variables of this class should be mutable after having been created.

We still build JavaFX with `--release 11` so applications using JavaFX can run on JDK 11 or later. At some point we will bump the minimum version of Java that is required, but until then we cannot use records or any other feature that isn't in Java 11.

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

PR: https://git.openjdk.java.net/jfx/pull/627


More information about the openjfx-dev mailing list