Issues with java.lang.Comparable-interface


#1

In JFreeChart exists a class DefaultPieDataset which has methods:

``

public void setValue(java.lang.Comparable key, java.lang.Number value)
public void setValue(java.lang.Comparable key, double value)

Why does the following cases happen?

``

data.setValue(“Title”, 10.toDouble) // Does not compile
data.setValue(“Title” as java.lang.Comparable<String>, 10.toDouble) // OK

Also in the latter case, in the the cast, IDE gives a warning “This cast can never succeed” but code compiles and works correctly.


#2

Hi, I cannot reproduce this on the latest build. Looks like it was fixed in this commit: https://github.com/JetBrains/kotlin/commit/2ec54436c5e7dcc44f0a082c9f05935952c9dbe7