Processor error on missing type while traversing too far up component dependency chain.
See original GitHub issueModule ‘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:
- Created 6 years ago
- Reactions:57
- Comments:47
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.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 ascompileOnly
(or maybe evenannotationProcessor / 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?