I have just installed PMD to analyze my Java project. Really nice tool, highly recommended. Anyways, I got a few errors saying:
"An empty method in an abstract class should be abstract instead"
I checked out PMD documentation and the explanation says:
as developer may rely on this empty implementation rather than code the appropriate one
So I think I understand the reason behind this code style error, but consider the following scenario: I have an abstract class called Entity. This class has a boolean method with default implementation. (controls whether to delete its related entities upon deletion). Only a few of the derived classes override this default behavior to true.
Should I remove the default implementation and force all deriving classes to declare their behavior? Do you really think this pattern is such a bad practice?
Clarification: PMD treats a method with single return statement as empty.