View Javadoc
1   /*
2   ConstructorsDeclarationGrouping
3   
4   
5   */
6   
7   package com.puppycrawl.tools.checkstyle.checks.coding.constructorsdeclarationgrouping;
8   
9   public class InputConstructorsDeclarationGrouping {
10  
11      int a;
12  
13      int b;
14  
15      void foo() {}
16  
17      InputConstructorsDeclarationGrouping() {}
18  
19      InputConstructorsDeclarationGrouping(String a) {}
20  
21      void foo2() {}
22  
23      InputConstructorsDeclarationGrouping(int a) {}
24      // violation above 'Constructors should be grouped together.*'
25  
26      int abc;
27  
28      InputConstructorsDeclarationGrouping(double x) {}
29      // violation above 'Constructors should be grouped together.*'
30  
31      private enum InnerEnum1 {
32  
33          one;
34  
35          int x;
36  
37          InnerEnum1() {}
38  
39          InnerEnum1(String f) {}
40  
41          String str;
42  
43          String str2;
44  
45          InnerEnum1(int x) {}
46          // violation above 'Constructors should be grouped together.*'
47  
48          private abstract class Inner {
49              Inner() {}
50  
51              int x;
52  
53              String neko;
54  
55              Inner(String g) {}
56              // violation above 'Constructors should be grouped together.*'
57          }
58  
59          InnerEnum1(double d) {}
60          // violation above 'Constructors should be grouped together.*'
61      }
62  
63      InputConstructorsDeclarationGrouping(float x) {}
64      // violation above 'Constructors should be grouped together.*'
65  
66      InputConstructorsDeclarationGrouping(long l) {}
67      // violation above 'Constructors should be grouped together.*'
68  
69      private class Inner {
70          Inner() {}
71  
72          Inner(String str) {}
73  
74          // Comments are allowed between constructors.
75          Inner(int x) {}
76      }
77  
78      private class Inner2 {
79        Inner2() {}
80  
81        Inner2(String str) {}
82  
83        int x;
84  
85        Inner2(int x) {}
86        // violation above 'Constructors should be grouped together.*'
87  
88        String xx;
89  
90        Inner2(double d) {}
91        // violation above 'Constructors should be grouped together.*'
92  
93        Inner2(float f) {}
94        // violation above 'Constructors should be grouped together.*'
95      }
96  
97      InputConstructorsDeclarationGrouping(long l, double d) {}
98      // violation above 'Constructors should be grouped together.*'
99  
100     InputConstructorsDeclarationGrouping annoynmous = new InputConstructorsDeclarationGrouping() {
101         int x;
102         void test() {}
103         void test2() {}
104     };
105 
106     private enum InnerEnum2 {
107         ONE,TWO,THREE;
108         void test() {}
109         void test2() {}
110         void test3() {}
111     }
112 
113     private enum InnerEnum3 {
114         InnerEnum3() {}
115     }
116 
117     private enum InnerEnum4 {}
118 
119     private class Inner3 {
120         void test() {}
121         void test2() {}
122         void test3() {}
123     }
124 
125     private class Inner4 {
126         Inner4() {}
127     }
128 
129     private class Inner5 {}
130 }