View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.coding.defaultcomeslast;
2   
3   
4   public class InputDefaultComesLastSkipIfLastAndSharedWithCase
5   {
6       void method(int i) {
7           switch (i) {
8               case 1:
9               default: // No violation with the new option is expected
10                  break;
11              case 2:
12                  break;
13          }
14  
15          switch (i) {
16              case 1:
17              default: // violation Default should be last label in the case group.
18              case 2:
19                  break;
20              case 3:
21                  break;
22          }
23  
24          switch (i) {
25              default: // violation Default should be last label in the case group.
26              case 1:
27                  break;
28              case 2:
29                  break;
30          }
31  
32          switch (i) {
33              case 0: default: case 1: break; case 2: break;  // violation Default should be last label in the case group.
34          }
35  
36          switch (i) {
37              default: case 1: break; case 2: break;  // violation Default should be last label in the case group.
38          }
39  
40          switch (i) {
41              case 1: default: break; case 2: break;  // No violation with the new option is expected
42          }
43  
44          switch (i) {
45              case 1:
46              default: // No violation with the new option is expected
47                  break;
48              case 2:
49                  break;
50              case 3:
51                  break;
52          }
53  
54          switch (i) {
55              case 1:
56                  break;
57              default:  // violation Default should be last label in the case group.
58              case 2:
59                  break;
60              case 3:
61                  break;
62          }
63  
64          switch (i) {
65              case 1:
66                  break;
67              case 2:
68              default: // No violation with the new option is expected
69                  break;
70              case 3:
71                  break;
72          }
73  
74          switch (i) {
75              case 1:
76                  break;
77              default: // violation Default should be last label in the case group.
78              case 3:
79                  break;
80              case 4:
81                  break;
82          }
83  
84          switch (i) {
85              case 1:
86                  break;
87              case 2:
88                  break;
89              default: // violation Default should be last label in the group.
90              case 5:
91              case 6:
92                  break;
93          }
94  
95          switch (i) {
96              case 1:
97                  break;
98              default: // violation Default should be last label in the case group.
99                  break;
100             case 2:
101                 break;
102         }
103 
104         switch (i) {
105             case 1:
106                 break;
107             case 2:
108                 break;
109             default: // No violation.
110                 break;
111         }
112 
113     }
114 }
115 
116 @interface InputSkipIfLastAndSharedWithCaseAnnotation
117 {
118     int blag() default 1;
119 }