erased<MyClass<T>> does not generate star-projection for generic type
See original GitHub issueI’m trying to use erased
similar to what’s suggested in the docs:
erased<Set<String>> will yield a TypeToken representing Set<*>.
In my case, I’m trying to do like:
bind<MyClass<*>>() with multiton { p: Obj<T> -> MyClass<T>(p) }
and
kodein.with(p).Instance(erased<MyClass<T>>())
Basically, what I’m trying to do is to create a bind for MyClass regardless the generics T it must receive. So, I’m binding it with bind<MyClass<*>>
. However, it seems that erased<MyClass<T>>
generated MyClass
instead of the star-projection MyClass<*>
as mentioned on the docs in the case of Set
.
Is there anything I can do to make this right?
Doc reference: https://salomonbrys.github.io/Kodein/#erased-comp
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Kotlin star projection on contravariant types - Stack Overflow
When you use a star projection of some generic class, you are not interested in using the functions or properties that return T...
Read more >Best star projectors 2022: Holiday season deals and discounts
The best star projectors make excellent gifts for space lovers, explore the top models with the best discounts this holiday season.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Reopenning this as I may have found a way to fix this without a significant impact performance.
I think this is corrected in Kodein 5. Feel free to reopen this if it is not.