View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   class InputMethodParamPad
7   {
8       void test()
9       {
10          int x = 1 + 
11                   2 - 
12              3
13              -
14              4;
15          x = x + 2;
16          boolean y = true
17              &&
18              false;
19           y = true && 
20              false;
21          y = false
22              && true;
23      }
24      
25      void testAssignment()
26      {
27          int x
28              = 0;
29          int y =
30              0;
31      }
32  
33      <
34       T extends Comparable & 
35          java.io.Serializable
36      >
37      void testGenerics1()
38      {
39          Comparable
40              <
41              String
42              >
43              c = new String();
44          Map<String, String> map = new HashMap<String, String>();
45  
46          boolean flag = false;
47          
48          int init = 9;
49          
50          /*ok*/ for (Map.Entry<String, String> entry :
51              map.entrySet())
52          {
53              int i = flag == true ?
54                      1 : 2;
55          }
56          
57           if (init !=
58                  9)
59          {
60              
61          }
62          
63           while (init ==
64                  10)
65          {
66              
67          }
68          
69           if (init >
70                  10)
71          {
72              
73          } else {}
74          
75           while (init < 10 ||
76                  !flag) {
77              
78          }
79      }
80      
81      class Inner {
82          void testGenerics1
83          () //warn
84          {
85              Comparable
86                  <
87                  String
88                  >
89                  c = new String();
90              Map<String, String> map = new HashMap<String, String>();
91              boolean flag = false;
92              
93              int init = 9;
94              
95              /*ok*/ for (Map.Entry<String, String> entry :
96                  map.entrySet())
97              {
98                  int i = flag == true ?
99                          1 : 2;
100             }
101             
102              if (init !=
103                     9)
104             {
105                 
106             }
107             
108              while (init ==
109                     10)
110             {
111                 
112             }
113             
114              if (init >
115                     10)
116             {
117                 
118             } else {}
119             
120              while (init < 10 ||
121                     !flag) {
122                 
123             }
124         }
125     }
126     
127     Inner anon = new Inner
128             (){  //warn
129         void testGenerics1
130         () //warn
131         {
132             Comparable
133                 <
134                 String
135                 >
136                 c = new String();
137             Map<String, String> map = new HashMap<String, String>();
138             boolean flag = false;
139             int init = 9;
140             
141             /*ok*/ for (Map.Entry<String, String> entry :
142                 map.entrySet())
143             {
144                 int i = flag == true ?
145                         1 : 2;
146             }
147             
148              if (init !=
149                     9)
150             {
151                 
152             }
153             
154              while (init ==
155                     10)
156             {
157                 
158             }
159             
160              if (init >
161                     10)
162             {
163                 
164             } else {}
165             
166              while (init < 10 ||
167                     !flag) {
168                 
169             }
170         }
171     };
172 }
173 
174 class AsInput1 {
175     int abc = 0;
176     String string
177         = "string";
178     double PI = // ok
179             3.1415;
180 }
181 
182 class Ternary2 {
183     void foo() {
184         boolean flag = true;
185         int i = flag == true ?
186                 1 : 
187                 2;
188         int i2 = flag == true 
189                 ?
190                 1 
191                 : 
192                 2;
193         int i3 = flag == true 
194                 ? 1
195                 : 2;
196         
197     }
198 }
199 
200 class AssignClass3 {
201     void foo() {
202         int i = 0;
203         int j = 0;
204         i +=
205                 1;
206         j
207              += 2;
208         i -=
209                 1;
210         j
211              -= 2;
212         i /=
213                 1;
214         j
215              /= 2;
216         i *=
217                 1;
218         j
219              *= 2;
220         i %=
221                 1;
222         j
223              %= 2;
224         i ^=
225                 1;
226         j
227              ^= 2;
228         i |=
229                 1;
230         j
231              |= 2;
232         i &=
233                 1;
234         j
235              &= 2;
236         i >>=
237                 1;
238         j
239             >>= 2;
240         i >>>=
241                 1;
242         j
243             >>>= 2;
244         i <<=
245                 1;
246         j
247             <<= 2;
248     }
249     
250     class InnerClass {
251         void foo() {
252             int i = 0;
253             int j = 0;
254             i +=
255                     1;
256             j
257                  += 2;
258             i -=
259                     1;
260             j
261                  -= 2;
262             i /=
263                     1;
264             j
265                  /= 2;
266             i *=
267                     1;
268             j
269                  *= 2;
270             i %=
271                     1;
272             j
273                  %= 2;
274             i ^=
275                     1;
276             j
277                  ^= 2;
278             i |=
279                     1;
280             j
281                  |= 2;
282             i &=
283                     1;
284             j
285                  &= 2;
286             i >>=
287                     1;
288             j
289                 >>= 2;
290             i >>>=
291                     1;
292             j
293                 >>>= 2;
294             i <<=
295                     1;
296             j
297                 <<= 2;
298         }
299     }
300     
301     InnerClass anon = new InnerClass() {
302         void foo() {
303             int i = 0;
304             int j = 0;
305             i +=
306                     1;
307             j
308                  += 2;
309             i -=
310                     1;
311             j
312                  -= 2;
313             i /=
314                     1;
315             j
316                  /= 2;
317             i *=
318                     1;
319             j
320                  *= 2;
321             i %=
322                     1;
323             j
324                  %= 2;
325             i ^=
326                     1;
327             j
328                  ^= 2;
329             i |=
330                     1;
331             j
332                  |= 2;
333             i &=
334                     1;
335             j
336                  &= 2;
337             i >>=
338                     1;
339             j
340                 >>= 2;
341             i >>>=
342                     1;
343             j
344                 >>>= 2;
345             i <<=
346                     1;
347             j
348                 <<= 2;
349         }
350     };
351 
352     enum TestEnum {
353         FIRST () // warn
354             {
355             },
356 
357         SECOND
358             () // warn
359             {
360             }
361     }
362 }