Kotlin Dagger modules have issues with internal + jvmstatic methods
Created by: NickFirmani
This was originally opened as https://github.com/uber/okbuck/issues/835 - cc @kageiit and @thalescm
When using the correct style for Kotlin Dagger modules, like the following
@Module
abstract class OtherModule {
@Module
companion object {
@Provides
@JvmStatic
@Singleton
internal fun provideSomeObject(): SomeClass {
// IRL you'd do some config here.
return SomeClass()
}
}
}
Buck ends up with an error
stderr: /com/nickfirmani/template/OtherModule_Companion_ProvideSomeObject$src_debugFactory.java:31: error: cannot find symbol
instance.provideSomeObject$src_debug(),
^
symbol: method provideSomeObject$src_debug()
location: variable instance of type com.nickfirmani.template.OtherModule.Companion
/com/nickfirmani/template/OtherModule_ProvideSomeObject$src_debugFactory.java:26: error: cannot find symbol
OtherModule.provideSomeObject$src_debug(),
^
symbol: method provideSomeObject$src_debug()
location: class com.nickfirmani.template.OtherModule
Errors: 2. Warnings: 0.
When running <javac>.
When building rule //app:src_debug.
I'm not quite sure how to proceed, so I've created a sample recreation project (using OkBuck to generate Buck files), NickFirmani/android-template@ddc4024
Removing the internal keyword allows compilation to succeed