groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mirco <>
Subject Type checker error with a custom javafx TreeCell
Date Mon, 02 Jan 2017 18:23:27 GMT
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
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
public class MyTreeCell extends TreeCell<String> {
    public MyTreeCell() {
        MenuItem myMenu = new MenuItem("Menu...");
        myMenu.setOnAction(new EventHandler<ActionEvent>() {
            public void handle(ActionEvent t) {
    public void startEdit() {
        // custom code
println "pippo"

Any ideas?

Thank you


View raw message