lsp4jakarta
lsp4jakarta copied to clipboard
Dependency Injection: Diagnostic for `@Inject` constructors with non-injectable parameters
A bean constructor may have any number of parameters. All parameters of a bean constructor are injection points.
Diagnostics
- Identify constructors annotated with
@Inject - Check if each parameter of the constructor is a valid managed bean
- If not, deliver an error diagnostics at the parameter
Quick Fix
- Suggest removing
@Inject
Example
public class Greeting {
// Error here as String is not injectable
@Inject
public Greeting (String name) {}
}
Note: Will have to make changes to the quick fix implemented in #108 as it does not check if the constructor takes in parameters that are injectable
- Check if each parameter of the constructor is a valid managed bean
Can you please clarify what conditions to check for to verify a valid managed bean