Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin object module provisions for primitive types are missing object INSTANCE in generated code #1648

Closed
ZacSweers opened this issue Oct 24, 2019 · 2 comments · Fixed by #1667
Assignees

Comments

@ZacSweers
Copy link

If I have a provision like below:

@Module
object MyModule {
  @Qualifier
  annotation class MyQualifier

  @MyQualifier
  @Provides
  fun provideMyBoolean(): Boolean {
    return false
  }
}

The resulting generated code should be accessing this provision via MyModule.INSTANCE.provideMyBoolean(), but .INSTANCE is missing and thus fails to compile.

Repro: ZacSweers/CatchUp#195. Run ./gradlew :app:compileDebugJavaWithJavac

@Chang-Eric
Copy link
Member

Thanks for the report. It looks like this is actually an issue with our handling of primitive types.

@Chang-Eric Chang-Eric changed the title Qualified Kotlin object provisions are missing object INSTANCE in generated code Kotlin object module provisions for primitive types are missing object INSTANCE in generated code Oct 24, 2019
@Chang-Eric
Copy link
Member

Btw, a workaround for this is to leave @JvmStatic on just the providers of primitive types. This will be fixed in the next release.

kluever pushed a commit that referenced this issue Nov 7, 2019
…methods were not being dispatching through the singleton INSTANCE.

Fixes #1648

RELNOTES=Fix #1648 where Kotlin object module providers of a primitive type would fail to compile

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=278454737
kluever pushed a commit that referenced this issue Nov 7, 2019
…methods were not being dispatching through the singleton INSTANCE.

Fixes #1648

RELNOTES=Fix #1648 where Kotlin object module providers of a primitive type would fail to compile

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=278454737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants