dagger-android-injection icon indicating copy to clipboard operation
dagger-android-injection copied to clipboard

Question about AppComponent.java

Open davida5 opened this issue 7 years ago • 1 comments

Hi, thanks for an amazing example, I have a question about two lines in the AppComponent.java, see below, what is the purpose of these lines? without these lines the app seems to work fine

    void inject(AndroidSampleApp app);

    @Override
    void inject(DaggerApplication instance);

davida5 avatar Dec 20 '17 09:12 davida5

The second one is useless because it's just a redeclaration of a method in the AndroidInjector interface. The first one is here useless because the injected fields are in the DaggerApplication, so the content of inject is generated by looking the DaggerApplication class, so upcasting the app at runtime by calling this one will work

badoualy avatar Feb 14 '18 20:02 badoualy