the problem is that if you try to check from java: `(1L as Any)::class.java.isAssignableFrom(Long::c...
a
the problem is that if you try to check from java:
(1L as Any)::class.java.isAssignableFrom(Long::class.java)
returns false
i
If you want to use just java reflection, you have to consider corner cases like that.
With kotlin reflection (requires
kotlin-reflect
dependnecy) you can check
someLong::class.isSubclassOf(Long::class)
or vice versa.
a
Hmm well with Java reflection I could understand that a java Long/long won't work in that case with a Kotlin Long
but this case seems like an optimization done by the compiler that is far from explicit
because this works
(1L)::class.java.isAssignableFrom(Long::class.java)
so I don't think is just a corner case