On Mon, 11 May 2026 22:43:12 GMT, Andy Goryachev <[email protected]> wrote:

> Somewhat related, I tried to set a null converter, and that broke the monkey 
> tester. There is nothing in the API spec that talks about nullability of this 
> property, but I would expect that setting it to `null` should be equivalent 
> to choosing the default converter ( `ComboBox.<T>defaultStringConverter()` , 
> ComboBox:332 )

This is an interesting usecase. From a quick look, other Controls will also not 
handle this. Example: `CheckBoxTreeTableCell`.
`TextFieldListCell` will throw an `IllegalStateException` - can be seen in 
`CellUtils#createTextField`.

`ChoiceBox` handles this case and just use `toString()`. `Spinner` as well with 
a factory without a converter.

I would als recommend that we do the same. Just call `toString()` as it is 
already done pretty much everywhere (including cells, when you don't set a 
`setCellValueFactory`.

So something like in `ChoiceBoxSkin`:


    private String getDisplayText(T value) {
        if (getSkinnable().getConverter() != null) {
            return getSkinnable().getConverter().toString(value);
        }
        return value == null ? "" : value.toString();
    }

-------------

PR Comment: https://git.openjdk.org/jfx/pull/2165#issuecomment-4429154334

Reply via email to