Hi Groovy Community,
I got this error after applying the @CompileStatic annotation to a custom
(javafx) TreeCell:
[Static type checking] - Reference to method is ambiguous. Cannot choose
between [void javafx.scene.control.Cell <T extends
java.lang.Object>#startEdit(), void javafx.scene.control.TreeCell <T
extends java.lang.Object>#startEdit(), void MyTreeCell#startEdit()]
without the annotation the code works fine.
It seems related to the startEdit() call inside the EventHandler anonymous
class.
The issue is very easy to reproduce in the GroovyConsole:
import javafx.scene.control.TreeCell
import javafx.scene.control.MenuItem
import javafx.event.EventHandler
import javafx.event.ActionEvent
import groovy.transform.CompileStatic
@CompileStatic
public class MyTreeCell extends TreeCell<String> {
public MyTreeCell() {
MenuItem myMenu = new MenuItem("Menu...");
myMenu.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
startEdit()
}
})
}
@Override
public void startEdit() {
super.startEdit()
// custom code
}
}
println "pippo"
Any ideas?
Thank you
Mirco