View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.blocks.needbraces;
2   
3   public class InputNeedBracesNoBodyLoops {
4   
5       private int value;
6       private InputNeedBracesNoBodyLoops fco = new InputNeedBracesNoBodyLoops();
7   
8       {
9           value = 0;
10          while(incrementValue() < 5);;
11      }
12  
13      public void foo() {
14          while(incrementValue() < 5);
15      }
16  
17      public void foo2() {
18          for(int i = 0; i < 10; incrementValue());
19          for(int i = 0; incrementValue() < 8; i++);
20      }
21  
22      public void foo3() {
23          while(incrementValue()
24              < 5);
25      }
26  
27      public void foo4() {
28          while(incrementValue() < 5)
29              ;
30      }
31  
32      public void foo5() {
33          while(incrementValue()
34              < 5)
35              ;
36      }
37  
38      public void foo6() {
39          while(
40              incrementValue() < 5
41              );
42      }
43  
44      public void foo7() {
45          while(
46              incrementValue() < 5);
47      }
48  
49      public void foo8() {
50          for(int i = 0; incrementValue() < 8; i++);
51      }
52  
53      public void foo9() {
54          for(int i = 0;
55              incrementValue() < 8;
56              i++);
57      }
58  
59      public void foo10() {
60          for(
61              int i = 0;
62              incrementValue() < 8;
63              i++);
64      }
65  
66      public void foo11() {
67          for
68              (
69              int i = 0;
70              incrementValue() < 8;
71              i++
72              )
73              ;
74      }
75  
76      public void foo12() {
77          for (int i = 0; incrementValue() < 8; i++) {
78              int a = 5;
79          }
80      }
81  
82      public void foo14() {
83          while (incrementValue() < 5) {
84              return;
85          }
86      }
87  
88      public void foo15() {
89          while (true);
90      }
91  
92      public void foo16() {
93          for (;;);
94      }
95  
96      public void foo17() {
97          if(true);
98      }
99  
100     public void foo18() {
101         if(true) {
102             int a;
103         }
104     }
105 
106     @Override
107     public String toString(){
108         while(fco.removeAssignedRole(this));
109         return "";
110     }
111 
112     private boolean removeAssignedRole(InputNeedBracesNoBodyLoops inputNeedBracesNoBodyLoops) {
113         return true;
114     }
115 
116     private int incrementValue() {
117         return value++;
118     }
119 
120     private void decrementValue() {
121         value--;
122     }
123 }