ericssmith / scalafx

Automatically exported from code.google.com/p/scalafx
Other
0 stars 0 forks source link

Compilation error when creating TableView cellFactory #109

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Following code, that should be legal:

new TableColumn[Person, Circle] {
            text = "Color"
            cellFactory = {
              e => new TableCell[Person, Circle] {
                graphic = new Circle {fill = Color.GREEN; radius = 8}
              }
            }

produces compilation error:

polymorphic expression cannot be instantiated to expected type;
 found   : [S, T]javafx.scene.control.TableCell[Nothing,Nothing]
 required: javafx.scene.control.TableCell[scalafx.controls.tableview.Person,scalafx.scene.shape.Circle]
Note: Nothing <: scalafx.controls.tableview.Person (and [S, 
T]javafx.scene.control.TableCell[Nothing,Nothing] <: 
javafx.scene.control.TableCell[Nothing,Nothing]), but Java-defined class 
TableCell is invariant in type S.
You may wish to investigate a wildcard type such as `_ <: 
scalafx.controls.tableview.Person`. (SLS 3.2.10)
Note: Nothing <: scalafx.scene.shape.Circle (and [S, 
T]javafx.scene.control.TableCell[Nothing,Nothing] <: 
javafx.scene.control.TableCell[Nothing,Nothing]), but Java-defined class 
TableCell is invariant in type T.
You may wish to investigate a wildcard type such as `_ <: 
scalafx.scene.shape.Circle`. (SLS 3.2.10)
            cellFactory = { e => new TableCell[Person, Circle] {
                                     ^

Original issue reported on code.google.com by jpsacha on 8 Nov 2013 at 2:54

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 66ab15f87091.

Original comment by jpsacha on 8 Nov 2013 at 3:10