KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * InputValidBlockIndent.java
3  *
4  * Created on December 8, 2002, 12:06 PM
5  */

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

13 public class InputValidBlockIndent {
14     
15     /** Creates a new instance of InputValidBlockIndent */
16     public InputValidBlockIndent() {
17     }
18     
19     public void method1() {
20         
21         { }
22         {
23         }
24         {
25             int var = 3;
26             
27             var += 3;
28         }
29
30         
31         { int var = 5; }
32     
33         {
34             int var = 3;
35             
36             var += 3;
37             
38             {
39                 int innerVar = 4;
40                 
41                 innerVar += var;
42             }
43         }
44     
45     }
46     
47     static { int var = 4; }
48
49     
50     static {
51         int var = 4;
52     }
53     
54     static
55     {
56         int var = 4;
57     }
58
59     { int var = 4; }
60
61     
62     {
63         int var = 4;
64     }
65     
66     {
67         int var = 4;
68     }
69     
70     
71 }
72
73 enum EquivalenceTester {
74     /**
75      * An equivalence tester that decides based on {@link Object#equals(Object) equals}.
76      */

77     OBJECT_ATTRIBUTES {
78         /**
79          * {@inheritDoc}
80          */

81         public boolean areEqual( final Object JavaDoc first, final Object JavaDoc second ) {
82             return true;
83         }
84
85         /**
86          * {@inheritDoc}
87          */

88         public int hashCode( final Object JavaDoc target ) {
89             return 1;
90         }
91     },
92
93     /**
94      * An equivalence tester that decides based on {@code ==}.
95      */

96     OBJECT_IDENTITIES
97     {
98         /**
99          * {@inheritDoc}
100          */

101         public boolean areEqual( final Object JavaDoc first, final Object JavaDoc second ) {
102             return first == second;
103         }
104
105         /**
106          * {@inheritDoc}
107          */

108         public int hashCode( final Object JavaDoc target ) {
109             return System.identityHashCode( target );
110         }
111     };
112
113     /**
114      * Tells whether the two given objects are considered equivalent.
115      *
116      * @param first first comparand
117      * @param second second comparand
118      * @return whether {@code first} and {@code second} are considered equivalent
119      */

120     public abstract boolean areEqual( Object JavaDoc first, Object JavaDoc second );
121
122     /**
123      * Computes a hash code for the given object.
124      *
125      * @param target object to compute a hash for
126      * @return the computed hash
127      */

128     public abstract int hashCode( Object JavaDoc target );
129 }
130
131 class bug1251988
132 {
133     private int a;
134
135     // non static initializer
136
{
137         if (a == 1)
138         {
139         }
140     }
141 }
142
143 class bug1260079
144 {
145     public bug1260079()
146     {
147         new Thread JavaDoc()
148         {
149             public void run()
150             {
151                 System.out.println("ran");
152             }
153         }.start();
154     }
155 }
156
157 class bug1336737 {
158     private static enum Command {
159         IMPORT("import"),
160         LIST("list");
161         private final String JavaDoc c;
162         Command(String JavaDoc c) { this.c = c; }
163         public String JavaDoc toString() { return c; }
164     }
165 }
166
Popular Tags