KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > indentation > InputInvalidSwitchIndent


1 /*
2  * InputValidSwitchIndent.java
3  *
4  * Created on November 27, 2002, 11:40 PM
5  */

6
7 package com.puppycrawl.tools.checkstyle.indentation;
8
9 /**
10  *
11  * @author jrichard
12  */

13 public class InputInvalidSwitchIndent {
14     
15     private static final int CONST = 5;
16     private static final int CONST2 = 2;
17     private static final int CONST3 = 3;
18     
19     /** Creates a new instance of InputInvalidSwitchIndent */
20     public InputInvalidSwitchIndent() {
21     }
22     
23     private void method1() {
24         int s = 3;
25         
26       switch (s) {
27             
28           case 4:
29               System.out.println("");
30                 break;
31
32             case CONST:
33               break;
34
35               case CONST2:
36           case CONST3:
37                 break;
38
39           default:
40               System.out.println("");
41               break;
42         }
43         
44
45         // some people like to add curlys to their cases:
46
switch (s) {
47             
48             case 4: {
49               System.out.println("");
50                   break;
51           }
52
53             case CONST2:
54             case CONST3:
55           {
56                 System.out.println("");
57                 break;
58               }
59
60             
61             case 22:
62               {
63                 System.out.println("");
64                 break;
65           }
66         }
67          
68         // check broken 'case' lines
69
switch (s) {
70             
71             case
72               CONST:
73                 break;
74
75             case CONST2:
76             case
77               CONST3:
78             {
79                 System.out.println("");
80                 break;
81             }
82         }
83
84         switch (s) {
85       }
86
87         switch (s)
88       {
89           }
90         switch (s)
91           {
92       }
93         
94     }
95     
96 }
97
Popular Tags