The Inject
annotation cannot be applied to abstract methods, per the JSR-330
spec, since injectors will only inject those methods if the concrete implementer
of the abstract method has the Inject
annotation as well. See
OverridesJavaxInjectableMethod for more examples of this interaction.
Currently, default methods in interfaces are not injected if they have
Inject
for similar reasons, although future updates to dependency injection
frameworks may allow this, since the default methods are not abstract.
See the Guice wiki page on JSR-330 for more.
Suppress false positives by adding the suppression annotation @SuppressWarnings("JavaxInjectOnAbstractMethod")
to the enclosing element.