I’m trying to use `erased` similar to what’s sugge...
# kodein
j
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:
Copy code
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
MyClass<*>
as mentioned on the docs for the case with
Set
. Is there anything I can do to make this right?
I think I found a way… if I bind with uppercase
Bind
I can do:
Bind(erased<MyClass<*>>())
which will generate the bind like:
bind<MyClass>
instead of
bind<MyClass<*>>
. Yet, I’m not sure whether it’s a bug or not.
@salomonbrys let me know if I should create a task for this case.
s
@jdorleans Open a ticket, I'll give it a look. I'll close the ticket if there's nothing I can do 😉
👍 1
j
thx, here’s the link