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

XxxModule_ProvideXxxFactory classes are not generated in Kotlin #297

Closed
kubode opened this issue Jan 29, 2016 · 4 comments
Closed

XxxModule_ProvideXxxFactory classes are not generated in Kotlin #297

kubode opened this issue Jan 29, 2016 · 4 comments

Comments

@kubode
Copy link

kubode commented Jan 29, 2016

Demonstration codes: https://github.com/kubode/KotlinDaggerIssue

Kotlin does not generate XxxModule_ProvideXxxFactory classes when using same type of @Provides annotated functions.

Modules:

@Module class ApplicationModule {
    @Provides @ApplicationScope fun provideString() = "Application"
}

@Module class ActivityModule {
    @Provides @ActivityScope fun provideString() = "Activity"
}

ActivityModule_ProvideStringFactory and ApplicationModule_ProvideStringFactory are created in java.
(:java:build task is succeeded.)

But, ActivityModule_ProvideStringFactory and ApplicationModule_ProvideStringFactory are not created in Kotlin.
(Code generating task is succeeded.)

$ ./gradlew clean :kotlin:build
...
:kotlin:generateDebugSources
:kotlin:compileDebugKotlin
:kotlin:compileDebugJavaWithJavac
Note: Generating a MembersInjector or Factory for com.teamlab.kotlin.dagger.issue.MainFragment. Prefer to run the dagger processor over that class instead.
Note: Generating a MembersInjector or Factory for com.teamlab.kotlin.dagger.issue.MainApplication. Prefer to run the dagger processor over that class instead.
warning: The following options were not recognized by any processor: '[kapt.kotlin.generated]'
./kotlin/build/generated/source/kapt/debug/com/teamlab/kotlin/dagger/issue/di/DaggerApplicationComponent.java:39: error: cannot find symbol
            ApplicationModule_ProvideStringFactory.create(builder.applicationModule));
            ^
  symbol:   variable ApplicationModule_ProvideStringFactory
  location: class DaggerApplicationComponent
1 error
:kotlin:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.
...

Using versions:

    ext.kotlin_version = '1.0.0-beta-4589'
    ext.dagger_version = '2.1-SNAPSHOT'
@JakeWharton
Copy link

Seems like a kapt bug, not a Dagger bug.

On Fri, Jan 29, 2016 at 12:49 AM Masatoshi Kubode notifications@github.com
wrote:

Demonstration codes: https://github.com/kubode/KotlinDaggerIssue

Kotlin does not generate XxxModule_ProvideXxxFactory classes when using
same type of @provides annotated functions.

Modules:

@module class ApplicationModule {
@provides @ApplicationScope fun provideString() = "Application"
}

@module class ActivityModule {
@provides @ActivityScope fun provideString() = "Activity"
}

ActivityModule_ProvideStringFactory and
ApplicationModule_ProvideStringFactory are created in java.
(:java:build task is succeeded.)

But, ActivityModule_ProvideStringFactory and
ApplicationModule_ProvideStringFactory are not created in Kotlin.
(Code generating task is succeeded.)

$ ./gradlew clean :kotlin:build
...
:kotlin:generateDebugSources
:kotlin:compileDebugKotlin
:kotlin:compileDebugJavaWithJavac
Note: Generating a MembersInjector or Factory for com.teamlab.kotlin.dagger.issue.MainFragment. Prefer to run the dagger processor over that class instead.
Note: Generating a MembersInjector or Factory for com.teamlab.kotlin.dagger.issue.MainApplication. Prefer to run the dagger processor over that class instead.
warning: The following options were not recognized by any processor: '[kapt.kotlin.generated]'
./kotlin/build/generated/source/kapt/debug/com/teamlab/kotlin/dagger/issue/di/DaggerApplicationComponent.java:39: error: cannot find symbol
ApplicationModule_ProvideStringFactory.create(builder.applicationModule));
^
symbol: variable ApplicationModule_ProvideStringFactory
location: class DaggerApplicationComponent
1 error
:kotlin:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.
...

Using versions:

ext.kotlin_version = '1.0.0-beta-4589'
ext.dagger_version = '2.1-SNAPSHOT'


Reply to this email directly or view it on GitHub
#297.

@kubode
Copy link
Author

kubode commented Jan 29, 2016

Ok, I'll post to kotlin issue tracker.
Thanks.

@kubode kubode closed this as completed Jan 29, 2016
@pardom-zz
Copy link

@kubode can you link to the kapt issue you created?

@pardom-zz
Copy link

@kubode Never mind. I found a workaround here: https://youtrack.jetbrains.com/issue/KT-11201

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

No branches or pull requests

3 participants