rspec/rules/S3058/java/rule.adoc
2021-04-28 18:08:03 +02:00

22 lines
577 B
Plaintext

Overriding a parent class' method implementation with an ``++abstract++`` method is a terrible practice for a number of reasons:
* it blocks invocation of the original class' method by children of the ``++abstract++`` class.
* it requires the ``++abstract++`` class' children to re-implement (copy/paste?) the original class' logic.
* it violates the inherited contract.
== Noncompliant Code Example
----
public class Parent {
public int getNumber() {
return 1;
}
}
public abstract class AbstractChild {
abstract public int getNumber(); // Noncompliant
}
----