Hello,
recently I've updated the groovy version of my project (STC with
compiler-configuration) from 4.0.21 to 4.0.24 and in the process I've
encountered the following unexpected error:
*[Static type checking] - Cannot return value of type ...PathTreeCell for
closure expecting javafx.scene.control.TreeCell<java.lang.Object>*
(after further investigation it seems introduced from v4.0.22)

The error came up calling this method of the JavaFx *TreeView *(with a
closure)
https://openjfx.io/javadoc/21/javafx.controls/javafx/scene/control/TreeView.html#setCellFactory(javafx.util.Callback)
public final void setCellFactory(Callback<TreeView<T>,TreeCell<T>> value)

My code:
public class PathTreeCell extends TreeCell<Path> { … }
...
treeView.setCellFactory({ p ->
                var treeCell = new PathTreeCell(this)
                makeDraggable(treeCell)

*// This doesn't work anymore                //  return treeCell*
                *return (TreeCell<Path>)treeCell // OK*
            })

This portion of code has always worked for every version of groovy STC I've
used up until now.
As above, the workaround is effortless, just an explicit cast to
*TreeCell<Path>*
Nevertheless I'm worried that it could be some sort of side effect of a
regression.

Is this an intentional change of behaviour or a bug?

Cheers,
Mirco

Reply via email to