<@U589QURRQ> Java does bad things with generics a ...
# getting-started
a
@diesieben07 Java does bad things with generics a lot, Kotlin is very strict. The code you "cannot change" is bad and sets up an un-winnable situation for Kotlin. It isn't a bug in Kotlin. You give it a type T basically of
*
which means nothing useful. There is a big lack of information. At any point do you know what type T is? and if not, how does the
parseProperty
expect to work on unknown types, does it check against a list of instance types then performs its action? If there is no way to know outside of this function what type type is, then you need to change
parseProperty
to accept
<*>
as the type as well because you cannot say "give me a type T" to someone who can never know what is the type of
T
👍 1
d
apatrida: Of course it means something useful. It is "something that satisfies `T : Comparable<T>`". Right now I have this code implemented in Java and it is perfectly reasonable (in my opinion) and it compiles. I am really not sure why the Java code from the library (
Property<T>
) is bad. I would write it the same in Kotlin.
a
You are redefining that the star projection should have meaning, in Kotlin it doesn't equate to the minimum type bounds. If you want it to mean that, add an issue to youtrack for Kotlin as a feature request.
d
Ok, thanks. That's what I was asking, basically. So there is no way to do what I want in Kotlin at the moment.