question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

erased<MyClass<T>> does not generate star-projection for generic type

See original GitHub issue

I’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 MyClassinstead 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SalomonBryscommented, Sep 26, 2017

Reopenning this as I may have found a way to fix this without a significant impact performance.

0reactions
SalomonBryscommented, May 6, 2018

I think this is corrected in Kodein 5. Feel free to reopen this if it is not.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found