Skip to content

Files

Latest commit

 

History

History
26 lines (16 loc) · 647 Bytes

PublicMethodsBeforeNonPublicMethods.md

File metadata and controls

26 lines (16 loc) · 647 Bytes

Pattern: Use of non-public method before public method

Issue: -

Description

Enforces that all public methods are above protected and private methods.

Example of violations:

class MyClass {
    public static int staticMethod1() { }

    protected String method1() { }

    static final String staticMethod2() { }     // violation
    public String method2() { }                 // violation

    private int method3(int id) { }
}

Further Reading