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