View Javadoc
1   /*
2   NeedBraces
3   allowSingleLineStatement = true
4   allowEmptyLoopBody = (default)false
5   tokens = LITERAL_ELSE, LITERAL_CASE, LITERAL_DEFAULT
6   
7   
8   */
9   
10  package com.puppycrawl.tools.checkstyle.checks.blocks.needbraces;
11  
12  public class InputNeedBracesTestConditions
13  {
14      public void method() {
15          if (false)
16              while(true)
17              {
18  
19              }
20  
21          if (true)
22              do {
23                  int a = 1;
24              }
25              while(true);
26  
27          if (true)
28              for(;;){
29               assert true;}
30  
31          if (true){
32  
33          }else {
34  
35          }
36  
37          switch(1) {
38              case 1: {
39                  break;
40              }
41          }
42  
43          switch(1) {
44          case 1:  System.lineSeparator();
45          case 2: { break;}
46  
47          case 3: {
48              break;}
49  
50          case 4: // violation
51              break;
52  
53          case 5:  System.lineSeparator(); // violation
54              break;
55          }
56  
57          switch(1) {
58              default:
59              {
60  
61              }
62          }
63  
64          switch(1) {
65          default: // violation
66           break;
67      }
68  
69      }
70  }