When classes declare that they have an
dependency injection tools must call those methods after first calling any
@javax.inject.Inject constructor, and performing any field injection. These
methods are part of the initialization contract for the object.
When subclasses override methods annotated with
don’t also annotate themselves with
@javax.inject.Inject, the injector will
not call those methods as part of the subclass’s initialization. This may
unexpectedly cause assumptions taken in the superclass (e.g.: this
post-initialization routine is finished, meaning that I can safely use this
field) to no longer hold.
This compile error is intended to prevent this unintentional breaking of assumptions. Possible resolutions to this error include:
@Injectthe overridden method, calling the
supermethod to maintain the initialization contract.
finalto avoid subclasses unintentionally masking the injected method.
protectedmethod for this subclass to use.
Suppress false positives by adding the suppression annotation
@SuppressWarnings("OverridesJavaxInjectableMethod") to the enclosing element.