groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From C├ędric Champeau <cedric.champ...@gmail.com>
Subject Re: Type checker error with a custom javafx TreeCell
Date Wed, 04 Jan 2017 17:50:45 GMT
This looks like a bug :)

2017-01-02 19:23 GMT+01:00 Mirco <mirchord@gmail.com>:

> 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
>
>

Mime
View raw message