An abstract class declares no abstract method, or nothing but abstract methods, so it is a plain class or an interface in disguise

tx0/java:abstract-class-shapestrictwarningmaintainability/designdepth fastmaintainability

What it finds

An abstract class mixes what subclasses must provide with what it provides itself. Without abstract methods it forces nothing, and abstract only prevents instances; with only abstract methods and no state, an interface says the same and allows implementing several.

Reported is an abstract class without supertypes that declares no abstract method but some other member, or that declares only abstract methods, no fields and no constructors.

From the rule's source, abstract_class_shape.rs.

Example from the rule's tests
abstract class Helper {tx0 reports: no abstract method  int twice(int x) { return x * 2; }}abstract class Shape {tx0 reports: only abstract methods  abstract double area();}abstract class Mixed {  abstract double area();  double half() { return area() / 2; }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/java:abstract-class-shape" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/java:abstract-class-shape] reason="..."

tx0 explain tx0/java:abstract-class-shape shows the same in the terminal. Found a false positive? Report it.