Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depedency Injection: Diagnostic for Circular @Inject Dependencies #162

Open
Tracked by #16
KidoVin01 opened this issue Sep 28, 2021 · 2 comments
Open
Tracked by #16

Depedency Injection: Diagnostic for Circular @Inject Dependencies #162

KidoVin01 opened this issue Sep 28, 2021 · 2 comments
Labels
diagnostic Diagnostic item project-info-needed Cannot be implemented until there is logic to get more information from the Java project

Comments

@KidoVin01
Copy link
Contributor

KidoVin01 commented Sep 28, 2021

Circular 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 @Inject field/method/constructor
  • If dependency class contains @Inject field/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

@kathrynkodama
Copy link
Contributor

See #159, will we encounter the same problem here where we may not have knowledge of both Class A and Class B?

@kathrynkodama kathrynkodama added the diagnostic Diagnostic item label Sep 29, 2021
@KidoVin01 KidoVin01 changed the title Add support for Circular Dependencies Depedency Injection: Diagnostic for Circular Dependencies Oct 1, 2021
@KidoVin01 KidoVin01 changed the title Depedency Injection: Diagnostic for Circular Dependencies Depedency Injection: Diagnostic for Circular @Inject Dependencies Oct 1, 2021
@KidoVin01 KidoVin01 changed the title Depedency Injection: Diagnostic for Circular @Inject Dependencies Depedency Injection: Diagnostic for Circular @Inject Dependencies Oct 1, 2021
@kathrynkodama kathrynkodama added the project-info-needed Cannot be implemented until there is logic to get more information from the Java project label Oct 15, 2021
@KidoVin01
Copy link
Contributor Author

KidoVin01 commented Oct 21, 2021

Will now depend on #159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic Diagnostic item project-info-needed Cannot be implemented until there is logic to get more information from the Java project
Projects
None yet
Development

No branches or pull requests

2 participants