View Javadoc
1   package com.google.checkstyle.test.chapter2filebasic.rule21filename;
2   
3   // violation below 'The name of the outer type and the file do not match.'
4   @interface MyAnnotation2 {
5     String name();
6   
7     int version();
8   }
9   
10  // violation below 'Top-level class InputFileName3 has to reside in its own source file.'
11  @MyAnnotation2(name = "ABC", version = 1)
12  class InputFileName3 {} // ok
13  
14  // violation below 'Top-level class Enum2 has to reside in its own source file.'
15  enum Enum2 { // ok
16    A,
17    B,
18    C;
19  
20    Enum2() {}
21  
22    public String toString() {
23      return ""; // some custom implementation
24    }
25  }
26  
27  // violation below 'Top-level class TestRequireThisEnum2 has to reside in its own source file.'
28  interface TestRequireThisEnum2 { // ok
29    enum DayOfWeek {
30      SUNDAY,
31      MONDAY,
32      TUESDAY,
33      WEDNESDAY,
34      THURSDAY,
35      FRIDAY,
36      SATURDAY
37    }
38  }