{"action":"created","issue":{"url":"https://api.github.com/repos/google/dagger/issues/220","labels_url":"https://api.github.com/repos/google/dagger/issues/220/labels{/name}","comments_url":"https://api.github.com/repos/google/dagger/issues/220/comments","events_url":"https://api.github.com/repos/google/dagger/issues/220/events","html_url":"https://github.com/google/dagger/issues/220","id":99705400,"number":220,"title":"Transitive Dependencies Not Resolved Optimally","user":{"login":"cperry-gpsw","id":12532722,"avatar_url":"https://avatars.githubusercontent.com/u/12532722?v=3","gravatar_id":"","url":"https://api.github.com/users/cperry-gpsw","html_url":"https://github.com/cperry-gpsw","followers_url":"https://api.github.com/users/cperry-gpsw/followers","following_url":"https://api.github.com/users/cperry-gpsw/following{/other_user}","gists_url":"https://api.github.com/users/cperry-gpsw/gists{/gist_id}","starred_url":"https://api.github.com/users/cperry-gpsw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cperry-gpsw/subscriptions","organizations_url":"https://api.github.com/users/cperry-gpsw/orgs","repos_url":"https://api.github.com/users/cperry-gpsw/repos","events_url":"https://api.github.com/users/cperry-gpsw/events{/privacy}","received_events_url":"https://api.github.com/users/cperry-gpsw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-07T18:42:02Z","updated_at":"2015-08-07T20:18:31Z","closed_at":null,"body":"Consider the following Android flavored example:\r\n\r\n```java\r\n@Module\r\npublic class AppModule {\r\n  @Provides Thing provideThing() {\r\n      return new Thing();\r\n  }\r\n}\r\n\r\n@Singleton\r\n@Component( modules = AppModule.class )\r\npublic interface AppComponent {\r\n    void inject(App app);\r\n}\r\n\r\n@PerActivity\r\n@Component( dependencies = AppComponent.class )\r\npublic interface ActivityComponent {\r\n    void inject(MyActivity activity);\r\n}\r\n\r\n@PerFragment\r\n@Component( dependencies = ActivityComponent.class )\r\npublic interface FragmentComponent {\r\n    void inject(MyFragment fragment);\r\n}\r\n\r\npublic class MyFragment extends Fragment {\r\n    @Inject Thing thing;\r\n\r\n    @Override\r\n    public void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate();\r\n        \r\n        // Let's pretend we got activityComponent from somewhere\r\n        DaggerFragmentComponent.builder()\r\n            .activityComponent(activityComponent)\r\n            .build()\r\n            .inject(this);\r\n    }\r\n}\r\n```\r\n\r\nIt makes sense to me that the FragmentComponent should be able to resolve (without any extra information) the `Thing` dependency being injected into the Fragment because of the dependency chain\r\n\r\n>  Thing -> AppModule -> AppComponent -> ActivityComponent -> FragmentComponent\r\n\r\nSince AppComponent knows about AppModule it's `inject()` method works without extra information. Since this component is part of the dependency chain we should be able to resolve the Thing being injected in the Fragment. Dagger fails to compile complaining that there is no `@Provides` specified for the Thing being injected in the Fragment, which is clearly not the case."},"comment":{"url":"https://api.github.com/repos/google/dagger/issues/comments/128824333","html_url":"https://github.com/google/dagger/issues/220#issuecomment-128824333","issue_url":"https://api.github.com/repos/google/dagger/issues/220","id":128824333,"user":{"login":"JakeWharton","id":66577,"avatar_url":"https://avatars.githubusercontent.com/u/66577?v=3","gravatar_id":"","url":"https://api.github.com/users/JakeWharton","html_url":"https://github.com/JakeWharton","followers_url":"https://api.github.com/users/JakeWharton/followers","following_url":"https://api.github.com/users/JakeWharton/following{/other_user}","gists_url":"https://api.github.com/users/JakeWharton/gists{/gist_id}","starred_url":"https://api.github.com/users/JakeWharton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JakeWharton/subscriptions","organizations_url":"https://api.github.com/users/JakeWharton/orgs","repos_url":"https://api.github.com/users/JakeWharton/repos","events_url":"https://api.github.com/users/JakeWharton/events{/privacy}","received_events_url":"https://api.github.com/users/JakeWharton/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T20:18:31Z","updated_at":"2015-08-07T20:18:31Z","body":"> So Dagger is exposing implementation details in the interface itself.\r\n\r\nExcept you just said that only DaggerAppComponent is able to do this, not the interface. The interface knows nothing about the injection requirements of the target type. Only that the generated class has to somehow figure them out and satisfy them."}}