Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8264852

ComboBox.getValue returns an "impossible" value.

XMLWordPrintable

      When using an editable ComboBox<T> when T is not Object or String, client code will crash if a StringConverter is not provided. While the return type of ComboBox.getValue is T, the actual returned value is String, leading to an immediate ClassCastException in client code.

      Given that because of erasure and lack of any type token, ComboBox cannot know the value of T, maybe it would help to better emphasise the need for the converter, or at least document the results if one is not provided. Right now, it's just mentioned in a small paragraph before the heading "A warring about inserting Nodes ..."

            Unassigned Unassigned
            jjg Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: