tornadofx2
tornadofx2 copied to clipboard
TableColumn<T, S?>.converter function doesn't accept non-null-typed columns
The code at question is at TableView.kt
, around line ~148:
fun <T, S> TableColumn<T, S?>.converter(converter: StringConverter<in S>): TableColumn<T, S?> = apply {
cellFormat(FX.defaultScope) { text = converter.toString(it) }
}
It requires that the S
type parameter is null, so the following code doesn't work:
column("Column name", MyObject::myNonNullProperty).converter(MyCustomTypeConverter)
The fix would be to remove question marks from the S
type parameter, so that it can resolve to both null and non-null types, i.e. it doesn't break the API, just makes it available, in addition, to non-null types.