Java

Java

Made by DeepSource

Unused private field detected JAVA-W1025

Anti-pattern
Major
Autofix

A private field which is not referenced anywhere in this file was detected.

Such a field is useless and can be safely removed.

Bad Practice

class SomeClass {
    private int unused; // Not used anywhere within `SomeClass`.

    // ...
}

Recommended

Remove the field if is is not used anywhere. If the field was meant to be inherited, mark it as protected instead.

class SomeClass {
    protected int usedInSubclass;

    // ...
}