Micro,
Please create a new bug report at issues.apache.org and I will have a look at 
what changed.
________________________________
From: Mirco Colletta <mirch...@gmail.com>
Sent: Saturday, November 30, 2024 12:20 PM
To: dev@groovy.apache.org <dev@groovy.apache.org>
Subject: [EXT] Static type checking error from groovy version 4.0.22

External Email: Use caution with links and attachments.

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)<https://urldefense.com/v3/__https://openjfx.io/javadoc/21/javafx.controls/javafx/scene/control/TreeView.html*setCellFactory(javafx.util.Callback)__;Iw!!GFN0sa3rsbfR8OLyAw!bhkxAtKCcCoBP6_yq_UXSTJtpdyaaP3fx207yBuyP6IrCOCFSCZBuachWG4pzvoKw3JK31poWMrMii3T5yhIza0$>
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