title: Dagger 2 Null field injection
body: <p>Hi I've read through other posts but I am not being able to fix it. Basically my issue is that I call .inject and when I want to use the field it's still null.</p>
  
  <p>I have this class:</p>
  
  <pre><code>public class Application extends Game implements IApplication {
  
      @Inject IApplication app;
      @Inject IRouter router;
  
      public Application(IPlatformCode platformCode) {
  
      }
  
      @Override
      public void create() {
          initDagger();
          System.out.println(app); //NULL
          System.out.println(router); //NULL
          router.showPage(Page.MenuPage); //NULL EXCEPTION
      }
  
      @Override
      public void render() {
          Gdx.gl.glClearColor(1, 0.5f, 1, 1);
          Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
          super.render();
      }
  
      @Override
      public void setPage(IPage page) {
          setScreen(page);
      }
  
      protected void initDagger() {
          ApplicationComponent.Initializer.init(this).inject(this);
          RouterComponent.Initializer.init().inject(this);
      }
  }
  </code></pre>
  
  <p>I won't show the router because I'm doing the same in app.</p>
  
  <p>My Application component looks like this:</p>
  
  <pre><code>@Singleton
  @Component ( modules = {ApplicationModule.class })
  public interface ApplicationComponent {
      void inject(IApplication application);
      IApplication getApplication();
      static final class Initializer {
          private Initializer(){}
          public static ApplicationComponent init(IApplication app) {
              return DaggerApplicationComponent
                      .builder()
                      .applicationModule(new ApplicationModule(app))
                      .build();
          }
      }
  }
  </code></pre>
  
  <p>And this is the module:</p>
  
  <pre><code>@Module
  public class ApplicationModule {
      private IApplication app;
  
      public ApplicationModule(IApplication app) {
          this.app = app;
      }
  
      @Provides
      @Singleton
      public IApplication providesApplication(){
          return app;
      }
  }
  </code></pre>
  
  <p>As far as I read after calling inject(IApplication) the @Inject IApplication should be injected and have a value but right now it's null.</p>
  
  <p>The generated code looks like this:</p>
  
  <pre><code>public final class DaggerApplicationComponent implements ApplicationComponent {
      private Provider&lt;IApplication&gt; providesApplicationProvider;
  
      private DaggerApplicationComponent(DaggerApplicationComponent.Builder builder) {
          assert builder != null;
  
          this.initialize(builder);
      }
  
      public static DaggerApplicationComponent.Builder builder() {
          return new DaggerApplicationComponent.Builder();
      }
  
      private void initialize(DaggerApplicationComponent.Builder builder) {
          this.providesApplicationProvider = DoubleCheck.provider(ApplicationModule_ProvidesApplicationFactory.create(builder.applicationModule));
      }
  
      public void inject(IApplication application) {
          MembersInjectors.noOp().injectMembers(application);
      }
  
      public IApplication getApplication() {
          return (IApplication)this.providesApplicationProvider.get();
      }
  
      public static final class Builder {
          private ApplicationModule applicationModule;
  
          private Builder() {
          }
  
          public ApplicationComponent build() {
              if(this.applicationModule == null) {
                  throw new IllegalStateException(ApplicationModule.class.getCanonicalName() + " must be set");
              } else {
                  return new DaggerApplicationComponent(this);
              }
          }
  
          public DaggerApplicationComponent.Builder applicationModule(ApplicationModule applicationModule) {
              this.applicationModule = (ApplicationModule)Preconditions.checkNotNull(applicationModule);
              return this;
          }
      }
  }
  </code></pre>
  
  <p>Thanks in advance.</p>