Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B buck
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • buck
  • Issues
  • #2240
Closed
Open
Issue created Apr 16, 2019 by Administrator@rootContributor

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

Assignee
Assign to
Time tracking