I am having Overload Resolution Ambiguity error in this line:
departureHourChoice!!.selectionModel.select(currentHourIndex)
For Reference:
departureHourChoice is a ChoiceBox<Int>, which is from java.scene.control
currentHourIndex is an Int
The Overload Resolution Ambiguity happens in the .select() method; It is overloaded and can accept two kinds of parameters: (T obj) or (int index).
The .select() method allows for an item in a ChoiceBox to be selected, and you can determine which one can be selected by referencing to that item or to it's index. In this case, I want it to be selected by Index (int).
Here is a photo of the error
How would one resolve the Overload Resolution Ambiguity?
It seems that you are hit by this bug as a workaround you can :
box the currentHourIndex:
lateinit var departureHourChoice: ChoiceBox<Int>
...
val currentHourIndex = 1
departureHourChoice.selectionModel.select(currentHourIndex as Int?)
or change declaration of ChoiceBox to use java.lang.Integer instead of Kotlin's Int:
lateinit var departureHourChoice: ChoiceBox<java.lang.Integer>
...
val currentHourIndex = 1
departureHourChoice.selectionModel.select(currentHourIndex)
Further reading:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With