InnerTypeLast

Since Checkstyle 5.2

Description

Checks nested (internal) classes/interfaces are declared at the bottom of the primary (top-level) class after all init and static init blocks, method, constructor and field declarations.

Examples

To configure the check:

<module name="Checker">
  <module name="TreeWalker">
    <module name="InnerTypeLast"/>
  </module>
</module>
        

Example:

class Test1 {
  private String s;
  class InnerTest1 {}
  public void test() {} // violation
}

class Test2 {
  static {};
  class InnerTest1 {}
  public Test2() {} // violation
}

class Example1 {
  private String s;
  public void test() {}
  class InnerTest1 {}
}
        

Example of Usage

Violation Messages

All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.

Package

com.puppycrawl.tools.checkstyle.checks.design

Parent Module

TreeWalker