Warn when injecting more than one of the exact same binding
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
We had this code:
```java
@Inject public ItsAThing(@App Context context, //
Thing thing, //
@Named(SOMETHING) Foo foo, //
@Named(OTHER_THING) Bar bar,
Hello hello,
Blah blah,
Fizz fizz,
Buzz buzz,
@Aaaaa Aaaaaaa aaaaa,
@App Context app) {
```
which has a hard to spot bug. We're injecting `@App Context` twice as the first and last parameters. This happened organically over years.
Since these could potentially be unscoped bindings, having two isn't 100% of the time incorrect. That case is so infrequent that I would like it to be a build error. I'd be happy if it was merely a warning that I could then promote to error in error-prone.
Contributor guide
Assessment
This issue has not been assessed yet.