Open Jolanrensen opened 3 months ago
Thank you for reaching out.
We have started considering your request. However, this may be challenging due to the non-JVM platform, which has limited APIs compared to JVM.
Currently, this library fulfills its original purpose as it is the core of our dependency injection library, Kodein.
We need to evaluate how the typeOf
function has evolved to determine if new capabilities have been added. Unfortunately, we don't have the bandwidth at the moment. Feel free to investigate if you have the time.
First of all, great job :) A multiplatform reflection library is a great addition to the ecosystem :)
We're looking at migrating a library to multiplatform in the future, but we rely heavily on reflection and type logic, so I'm curious to see how far Kaverit can help us.
I do have a couple suggestions and concerns.
Variance and
*
notations:I noticed
TypeToken.getGenericParameters()
fills in*
parameters of generics withAny
no matter the variance or supertype:is given as
kotlin.Any
. In this case,*
meansAny?
, but I see you don't support nullability on purpose, so that's fine.However, for
it returns
kotlin.Any
too. I'd expect there to be a way to know that*
meansNumber
here.Finally,
also gives
kotlin.Any
, which, according to the docs should bekotlin.Nothing
. This is because the variance of typeT
isin
inComparable<in T>
.Combining types
Aside from that, I'd also be interested in a way to "add" multiple types together and do some logic, finding the lowest common parent between two types. Something like:
but a bit more efficient maybe, and it should be able to calculate
lowestCommonType(generic<List<Int>>(), generic<List<Double>>())
correctly. This might also require some variance/bound checks on generics. Specifically, I'd be interested in calculating the combinations of types such as the highlighting of the IDE can do like this: