Utility class is not 'final'
Reports utility classes that aren't final
or abstract
.
Utility classes have all fields and methods declared as static
. Making them final
prevents them from being accidentally subclassed.
Example:
public class UtilityClass {
public static void foo() {}
}
After the quick-fix is applied:
public final class UtilityClass {
public static void foo() {}
}
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023