kosi-libs / Kaverit

A light multiplatform Kotlin reflection API
MIT License
17 stars 1 forks source link

TypeToken.isAssignableFrom() difference on JS and JVM platforms #7

Closed NorbertSandor closed 1 year ago

NorbertSandor commented 1 year ago

I'm experimenting with this library and the

generic<Collection<Int>>().isAssignableFrom(generic<List<Int>>())

expression gives different results on JS and JVM:

JS: false JVM: true

Is this expected behaviour?

(I tried with 2.1.0 because I'm stuck at Kotlin 1.7.10.)

romainbsl commented 1 year ago

Sorry for the late response. It is totally expected as for JS there is no class hierarchy, thus Collection is absolutely not a super class of List. This behaviour is also expected for Native targets as reflection is really limited outside of the JVM scope.