View Javadoc
1   /*
2   LeftCurly
3   option = (default)eol
4   ignoreEnums = (default)true
5   tokens = (default)ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, \
6            ENUM_DEF, INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, \
7            LITERAL_DEFAULT, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, \
8            LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, \
9            METHOD_DEF, OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF
10  
11  
12  */
13  
14  package com.puppycrawl.tools.checkstyle.checks.blocks.leftcurly;
15  
16  class InputLeftCurlyMethod
17  { // violation ''{' at column 1 should be on the previous line'
18      InputLeftCurlyMethod() {}
19      InputLeftCurlyMethod(String aOne) {
20      }
21      InputLeftCurlyMethod(int aOne)
22      { // violation ''{' at column 5 should be on the previous line'
23      }
24  
25      void method1() {}
26      void method2() {
27      }
28      void method3()
29      { // violation ''{' at column 5 should be on the previous line'
30      }
31      void                                                               method4()
32      { // violation ''{' at column 5 should be on the previous line'
33      }
34      void method5(String aOne,
35                   String aTwo)
36      { // violation ''{' at column 5 should be on the previous line'
37      }
38      void method6(String aOne,
39                   String aTwo) {
40      }
41  }
42  
43  enum InputLeftCurlyMethodEnum
44  { // violation ''{' at column 1 should be on the previous line'
45      CONSTANT1("hello")
46      { // violation ''{' at column 5 should be on the previous line'
47          void method1() {}
48          void method2() {
49          }
50          void method3()
51          { // violation ''{' at column 9 should be on the previous line'
52          }
53          void                                                               method4()
54          { // violation ''{' at column 9 should be on the previous line'
55          }
56          void method5(String aOne,
57                       String aTwo)
58          { // violation ''{' at column 9 should be on the previous line'
59          }
60          void method6(String aOne,
61                       String aTwo) {
62          }
63      },
64  
65      CONSTANT2("hello") {
66  
67      },
68  
69      CONSTANT3("hellohellohellohellohellohellohellohellohellohellohellohellohellohello")
70      { // violation ''{' at column 5 should be on the previous line'
71      };
72  
73      private InputLeftCurlyMethodEnum(String value)
74      { // violation ''{' at column 5 should be on the previous line'
75  
76      }
77  
78      void method1() {}
79      void method2() {
80      }
81      void method3()
82      { // violation ''{' at column 5 should be on the previous line'
83      }
84      void                                                               method4()
85      { // violation ''{' at column 5 should be on the previous line'
86      }
87      void method5(String aOne,
88                   String aTwo)
89      { // violation ''{' at column 5 should be on the previous line'
90      }
91      void method6(String aOne,
92                   String aTwo) {
93      }
94  }
95