Abstract 'class' may be 'interface'
Reports abstract
classes that can be converted to interfaces.
Using interfaces instead of classes is preferable as Java doesn't support multiple class inheritance, while a class can implement multiple interfaces.
A class may be converted to an interface if it has no superclasses (other than Object), has only public static final
fields, public abstract
methods, and public
inner classes.
Example:
After the quick-fix is applied:
Configure the inspection:
Use the Report classes containing non-abstract methods when using Java 8 option to report only the classes with static
methods and non-abstract methods that can be converted to default
methods (only applicable to language level of 8 or higher).
Inspection options
Option | Type | Default |
---|---|---|
Report classes containing non-abstract methods when using Java 8 | Checkbox | false |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |