lsp4jakarta
lsp4jakarta copied to clipboard
Depedency Injection: Diagnostic for Circular `@Inject` Dependencies
Detecting and resolving circular dependencies is left as an exercise for the injector implementation. Circular dependencies between two constructors is an obvious problem, but you can also have a circular dependency between injectable fields or methods:
class A {
@Inject B b;
}
class B {
@Inject A a;
}
Diagnostics
- Identify
@Injectfield/method/constructor - If dependency class contains
@Injectfield/method/constructor, navigate through the recursive dependency class - If a circular dependency is detected, deliver diagnostic errors at each dependency class that a circular dependency is detected
Note 1: The injected dependencies must be matching Note 2: The diagnostics and error identification depends on #159 for reading class information across files.
Related to #153
See #159, will we encounter the same problem here where we may not have knowledge of both Class A and Class B?
Will now depend on #159