Java

Java

Made by DeepSource

Inject annotations on abstract class constructors have no effect JAVA-W1084

Anti-pattern
Major
Autofix

The constructor of an abstract class can never be called directly by the dependency injection framework, meaning any injection annotations applied to it will not be considered. Remove the annotation.

Bad Practice

Here, the @Inject annotation has no use, as the constructor will be ignored by DI.

abstract class SomeAbstractClass {

    @Inject
    public SomeAbstractClass(SomeDependency val1) {
        // ...
    }

    // ...
}

Recommended

Remove the annotation.