So… I’m not sure what the current status is - are ...
# announcements
b
So… I’m not sure what the current status is - are we currently supposed to use
apply plugin: 'kotlin-kapt'
or is it an experimental thing? I mean you can use
kapt
dependencies even if you don’t do it, but it works differently it seems - which is a bit confusing. Any clarification on this would be much appreciated 🙂
i
@bod kapt is the "apt" or "annotationProcessor" for kotlin, it is used to generate code at compile time based on annotations, for things like dagger and butterknife
b
Yes I understand that, but it seems that you can use
kapt
dependencies in gradle project even if you don’t use the
kotlin-kapt
plugin. And if you do use this plugin, you get a different version of
kapt
. Is this correct?
l
yes,
kotlin-kapt
is kapt3. Works well for us
b
@lovis Ok so if you don't apply the plugin, you get an older
kapt
? Like, v2? Whereas if you use it, you get
kapt3
?
l
yeah
b
ok thanks. And do you use
generateStubs
? This seems to be optional, or not, depending on which version 😉
l
no you are not allowed to use that with kapt3
i think its supposed automatically fall back to an older kapt version if you use that, but for me it simply didn’t compile
b
hmm interesting
do you use Dagger by any chance? The reason I'm asking is that I think the generated stubs are incorrect (public fields end up private)
l
yes I’m using dagger. I don’t have issues like that. Maybe clean build helps? 🙂
Copy code
compile "com.google.dagger:dagger:$dagger_version"
    kapt "com.google.dagger:dagger-compiler:$dagger_version"
b
I suppose you use
lateinit
for your injected fields? In this case they are correctly public.
l
yes that’s right.
so what are you doing?
@Inject var myField: Thing? = null
or are you using
notNull
delegate
b
that's right,
@Inject var myField: Thing? = null
- of course it makes more sense with
lateinit
🙂 But this should work anyway so I think it's a bug
l
I think so too. https://kotlinlang.slack.com/archives/C0B8MA7FA/p1495442168869554 ⬅️ this guy seems to have a similar issue. maybe file a bug (or ask whether it’s known first in #general)
b
ok, will do 🙂 Thanks