question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:57
  • Comments:47

github_iconTop GitHub Comments

24reactions
ronshapirocommented, Jan 30, 2018

We fully understand the issue you’re seeing, that’s not the problem.

I think the best recommendation I have now is not to use implementation with dagger components in your component dependencies chain.

16reactions
vRallevcommented, Feb 7, 2019

I’d like to bring this issue up again. I understand why it happens and why it isn’t purely Dagger’s fault. But the build tools (Gradle in this case) and Dagger don’t work well together. There are only two solutions at the moment for Gradle: Add the dependencies with api to the library module and fully expose them (not great for modularization) or add missing dependencies as compileOnly (or maybe even annotationProcessor / kapt) to the modules that need them, what isn’t good for modularization and isolation either.

I don’t have any hands-on experience with Blaze or Bazel, but I heard it can solve this issue with its finer granularity. But for many people those tools aren’t feasible.

How could Dagger avoid this issue? By turning off the cyclic dependency check?

Read more comments on GitHub >

github_iconTop Results From Across the Web

IDEA 10.5.2 Aspectj compiler - can't determine superclass of ...
The error message was almost same, but was about my own classes. So I think the answer from Simone Gianni should be correct,...
Read more >
To Resolve a Missing Component Problem - PTC Support
To Set Up a Traverse Plane ... Post-Processor Error Messages · Error File Utility ... Specifying the measurement limits and so forth ·...
Read more >
Dependency Scanning - GitLab Docs
The Dependency Scanning feature can automatically find security vulnerabilities in your software dependencies while you're developing and testing your ...
Read more >
Changelog — Python 3.11.1 documentation
Paths are no longer encoded to UTF-8/strict to avoid encoding errors if it contains surrogate characters (bytes paths are decoded with the surrogateescape...
Read more >
GNU make
It is much better to write explicit include directives in the makefiles. ... a dependency graph of all the targets and their prerequisites....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found