https://kotlinlang.org logo
#kotlin-inject
Title
# kotlin-inject
p

Paul Woitaschek

08/03/2022, 3:09 PM
Second thing, slightly related. The typealias logic is also confusing everyone. Also it seems that it’s abusing language features: https://kotlinlang.org/docs/type-aliases.html
Type aliases do not introduce new types. They are equivalent to the corresponding underlying types.
I think a dedicated Qualifier annotation would make things simpler to everyone.
e

evant

08/04/2022, 6:28 PM
That hurts I was particularly proud of those features 😉. But on a more serious note can you comment on issues about this with a detailed description about what issues/confusion you are running into? I'd like to better understand where the roadblocks are and if it's more than just "It's different than how dagger does it". Making assisted explicit has an issue here https://github.com/evant/kotlin-inject/issues/164, you can open a new one for the typealias thing.
Also, if you really want qualifiers, it technically supports them if you use
me.tatarka.inject.enableJavaxAnnotations=true
and create a
javax.inject.Qualifier
annotation. Kinda a hack but just letting you know.
p

Paul Woitaschek

08/04/2022, 6:31 PM
Sorry for causing you pain 😉 Yes they are super smart and personally now that I have understood the concepts I can make use of them. I’ll add feedback to the ticket.
Kinda a hack but just letting you know.
You mean creating an expect annotation one in commonMain and actual typaliasing in the sourcesets? 🤯 😄
e

evant

08/04/2022, 6:34 PM
you could probably get away with just creating it in commonMain, unless you are pulling in something that depends on
javax.inject
then yeah expect/actual.
p

Paul Woitaschek

08/04/2022, 6:35 PM
On Android that’s on the classpath
e

evant

08/04/2022, 6:35 PM
yeah fair
p

Paul Woitaschek

08/04/2022, 6:35 PM
Btw I found a way to marry kotlin-inject with dagger 😁
e

evant

08/04/2022, 6:35 PM
interesting, maybe worth a blog post haha
p

Paul Woitaschek

08/04/2022, 6:36 PM
Yes absolutely ^^
It generates a 666 LOC dagger module ^^
7 Views