On Wed, 26 Oct 2022 06:52:17 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/Node.java line 1426: >> >>> 1424: if (s == null) return false; >>> 1425: Window w = s.getWindow(); >>> 1426: return w != null && w.isShowing(); >> >> Are you avoiding calling `get` on the property to avoid its initialization? > > Yeah, I actually copied this pattern from an older method that has since been > removed (`isWindowShowing`) in an effort to avoid initializing the property > if all you're doing is calling its getter. I personally don't mind either > way, but as it seems `Node` goes through every effort to delay > initialization, I followed that pattern. It does duplicate the logic of the > property which uses `flatMap`s to achieve the same. I would suggest adding a comment saying that this is done to avoid initialization. I'm not sure that it's that critical for performance, to be honest. ------------- PR: https://git.openjdk.org/jfx/pull/830