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

Cannot access 'Builder': it is private in 'DaggerApplicationComponent' #192

Open
ber4444 opened this issue Jun 10, 2020 · 0 comments
Open

Comments

@ber4444
Copy link

ber4444 commented Jun 10, 2020

Getting the above error with the "Full Reflection" approach.

val applicationComponent = Dagger.builder(DaggerApplicationComponent.Builder::class.java)
            .application(this)
            .build()
@ApplicationScope
@Component(modules = [ApplicationModule::class, ActivityLifecycleModule::class])
interface ApplicationComponent {

    val application: Application

    val myApplication: MyApplication

    @ApplicationScope
    val deviceInfo: DeviceInfo

    fun callbacks(): Set<Application.ActivityLifecycleCallbacks>

    @Component.Builder
    interface Builder {
        fun build(): ApplicationComponent

        @BindsInstance
        fun application(application: MyApplication): Builder
    }
}

because the generated class is indeed private:

  private static final class Builder implements ApplicationComponent.Builder {
    private AmexApplication application;

    @Override
    public Builder application(AmexApplication application) {
      this.application = Preconditions.checkNotNull(application);
      return this;
    }

    @Override
    public ApplicationComponent build() {
      Preconditions.checkBuilderRequirement(application, AmexApplication.class);
      return new DaggerApplicationComponent(new ApplicationModule(), new CoroutineCallbacksModule(), new LoggingCallbacksModule(), application);
    }
  }
@ber4444 ber4444 changed the title Cannot access 'Builder': it is private in 'DaggerBaseComponent' Cannot access 'Builder': it is private in 'DaggerApplicationComponent' Jun 10, 2020
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

1 participant