tornadofx2 icon indicating copy to clipboard operation
tornadofx2 copied to clipboard

TableColumn<T, S?>.converter function doesn't accept non-null-typed columns

Open aleksandar-stefanovic opened this issue 3 years ago • 0 comments

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.

aleksandar-stefanovic avatar Jan 29 '22 12:01 aleksandar-stefanovic