File: OverridesGuiceInjectableMethod.md

package info (click to toggle)
error-prone-java 2.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 23,204 kB
  • sloc: java: 222,992; xml: 1,319; sh: 25; makefile: 7
file content (7 lines) | stat: -rw-r--r-- 517 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
Unlike with `@javax.inject.Inject`, if a method overrides a method annotated
with `@com.google.inject.Inject`, Guice will inject it even if it itself is not
annotated. This differs from the behavior of methods that override
`@javax.inject.Inject` methods since according to the JSR-330 spec, a method
that overrides a method annotated with `@javax.inject.Inject` will not be
injected unless it iself is annotated with `@Inject`. Because of this
difference, it is recommended that you annotate this method explicitly.