If you try to instantiate a TableColumn using a default constructor, for
instance:
new TableColumn[Person, String]()
or
new TableColumn[Person, String] {
text = "First Name"
}
you get an exception:
error: polymorphic expression cannot be instantiated to expected type;
found : [S, T]javafx.scene.control.TableColumn[Nothing,Nothing]
required: javafx.scene.control.TableColumn[proscalafx.ch05.model.Person,String]
Note: Nothing <: proscalafx.ch05.model.Person (and [S, T]javafx.scene.control.TableColumn[Nothing,Nothing] <: javafx.scene.control.TableColumn[Nothing,Nothing]), but Java-defined class TableColumn is invariant in type S.
You may wish to investigate a wildcard type such as `_ <: proscalafx.ch05.model.Person`. (SLS 3.2.10)
Note: Nothing <: String (and [S, T]javafx.scene.control.TableColumn[Nothing,Nothing] <: javafx.scene.control.TableColumn[Nothing,Nothing]), but Java-defined class TableColumn is invariant in type T.
You may wish to investigate a wildcard type such as `_ <: String`. (SLS 3.2.10)
to avoid exception you have to use non-default constructor, for instance:
new TableColumn[Person, String]("First Name")
Original issue reported on code.google.com by jpsacha on 26 Feb 2013 at 12:58
Original issue reported on code.google.com by
jpsacha
on 26 Feb 2013 at 12:58