Skip to content

Files

Latest commit

 

History

History
23 lines (16 loc) · 585 Bytes

EmptyMethodInAbstractClass.md

File metadata and controls

23 lines (16 loc) · 585 Bytes

Pattern: Empty method in abstract class

Issue: -

Description

An empty method in an abstract class should be abstract instead, as developer may rely on this empty implementation rather than code the appropriate one.

abstract class SomeClass {
    def couldBeAbstract_1() {
        return null  // Should be abstract method
    }

    void couldBeAbstract_2() {
        // Should be abstract method
    }
}

Further Reading