KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > InputModifiedControl


1 ////////////////////////////////////////////////////////////////////////////////
2
// Test case file for FOR_ITERATION and whitespace.
3
// Created: 2003
4
////////////////////////////////////////////////////////////////////////////////
5
package com.puppycrawl.tools.checkstyle;
6 import java.io.Serializable JavaDoc;
7 class InputModifiedControl
8 {
9     int k;
10     void method1()
11     {
12         //Violations:
13
for (int i = 0; i < 1; i++) {
14             i++;
15         }
16         for (int i = 0; i < 1; i++) {
17             i = i + 1;
18         }
19         for (int i = 0; i < 1; i++) {
20             for (int j = 0; j < 1; i++) {
21                 --i;
22             }
23         }
24         for (int i = 0, j = 0; i < 1; i++) {
25             j++;
26         }
27
28         // Ok:
29
for (int i = 0; i < 1; i++) {
30         }
31         for (int i = 0; i < 1; i++) {
32             int x = i;
33         }
34         for (int i = 0; i < 1; i++) {
35             Serializable JavaDoc s = new Serializable JavaDoc() {
36                 int i = 3;
37                 void a() {
38                     System.out.println(i++);
39                 }
40             };
41         }
42         for (int k = 0; k < 1; k++) {
43             this.k++;
44         }
45
46         String JavaDoc[] sa = {"a", "b"};
47         for(String JavaDoc s:sa) {}
48         for(String JavaDoc s:sa) {
49             s = "new string";
50         }
51     }
52 }
53
Popular Tags