Skip to content

Processor error on missing type while traversing too far up component dependency chain. #970

@JakeWharton

Description

@JakeWharton

Module 'test-a':

public final class A {
  @Inject A() {}
}

@Component
public interface ComponentA {
  A a();
}

Module 'test-b' which has implementation project(':test-a'):

public final class B {
  @Inject B(A a) {}
}

@Component(dependencies = ComponentA.class)
public interface ComponentB {
  B b();
}

Module 'test-c' which has implementation project(':test-b'):

public final class C {
  @Inject C(B b) {}
}

@Component(dependencies = ComponentB.class)
public interface ComponentC {
  C c();
}

fails with:

> Task :test-c:compileDebugJavaWithJavac FAILED
error: cannot access ComponentA
  class file for test.a.ComponentA not found
  Consult the following stack trace for details.
  com.sun.tools.javac.code.Symbol$CompletionFailure: class file for test.a.ComponentA not found
1 error

which makes sense, because 'test-c' isn't meant to see 'test-a' as it's an implementation detail of 'test-b', but why is Dagger in 'test-c' trying to do anything with ComponentA? Once it reaches ComponentB and sees the required B type exposed shouldn't it stop?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions