Binding.scala icon indicating copy to clipboard operation
Binding.scala copied to clipboard

Generic javafx controls don't work

Open nafg opened this issue 8 years ago • 3 comments

E.g. @fxml <ComboBox/>

nafg avatar May 26 '17 06:05 nafg

Error message:

[error] /home/naftoli/dev/timer/javafx/src/main/scala/com/dev1on1/timer/Fxml.scala:28: class ComboBox takes type parameters
[error]       <ComboBox><items>{SavedSearch("", "")}</items></ComboBox>

Atry avatar May 26 '17 06:05 Atry

A workaround is

type MyComboBox = ComboBox[SavedSearch];
<MyComboBox>...</MyComboBox>

Atry avatar May 26 '17 06:05 Atry

I probably will not "fix" this issue. There is no way to keep FXMLLoader's usage without breaking type-safety.

Our strict type checking can be considered as a feature instead a bug. Our type alias approach for generic controls is recommended as it is more type-safe than FXMLLoader's raw type.

Atry avatar Jul 28 '17 02:07 Atry