Re: RFR: 8281953: NullPointer in InputMethod components in JFXPanel
On Mon, 21 Feb 2022 07:27:46 GMT, eduardsdv wrote: >> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TextInputControlSkin.java >> line 340: >> >>> 338: if (window == null) { >>> 339: return new Point2D(0, 0); >>> 340: } >> >> As long as each scene needs to be located in a window, the following will >> simplify the code: >> Suggestion: >> >> if (scene == null) { >> return new Point2D(0, 0); >> } >> Window window = scene.getWindow(); >> >> Is it possible to have a scene without an assigned window? > > Since the NullPointer occurs here because the synchronization between JavaFx > and AWT threads is not really possible in this case, we cannot ensure that > this method is only called when the scene is assigned to a window. > I would check here for null both the scene and the window. What a pity. Then ignore this comment. - PR: https://git.openjdk.java.net/jfx/pull/735
Re: RFR: 8281953: NullPointer in InputMethod components in JFXPanel
On Thu, 17 Feb 2022 12:57:27 GMT, eduardsdv wrote: > If the InputMethod's node is not in the scene, the default text location > point is returned. modules/javafx.controls/src/main/java/javafx/scene/control/skin/TextInputControlSkin.java line 340: > 338: if (window == null) { > 339: return new Point2D(0, 0); > 340: } As long as each scene needs to be located in a window, the following will simplify the code: Suggestion: if (scene == null) { return new Point2D(0, 0); } Window window = scene.getWindow(); Is it possible to have a scene without an assigned window? - PR: https://git.openjdk.java.net/jfx/pull/735
Re: RFR: 8272808: Update constant collections to use the new immutable collections - leftovers
On Thu, 23 Sep 2021 12:43:20 GMT, Kevin Rushforth wrote: >> 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. That is indeed a valid argument as to why this isn't a record. Obviously, I did not think about that while reviewing. - PR: https://git.openjdk.java.net/jfx/pull/627
Re: RFR: 8272808: Update constant collections to use the new immutable collections - leftovers
On Tue, 21 Sep 2021 11:13:06 GMT, Nir Lisker 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. - PR: https://git.openjdk.java.net/jfx/pull/627