Unfortunately, this doesn't work. The Java language doesn't allow a pattern to be the same type as the expression.
On Tue, Dec 5, 2023 at 1:27 PM John Hendrikx <john.hendr...@gmail.com> wrote: > > When this runs on the FX thread it has to be safe, but it's not very nice. > > These days you can do these kind of null chain checks like this: > > if (getScene() instanceof Scene s && s.getWindow() instanceof > Window w && w.isShowing()) { > > } > > --John