1
2
3
4
5
6
7
8
9 package com.puppycrawl.tools.checkstyle.checks.whitespace.parenpad;
10
11 import java.io.IOException;
12 import java.io.StringWriter;
13 import java.io.Writer;
14
15 public class InputParenPadLeftRightAndNoSpace2
16 {
17 class ParenPadNoSpace {
18 ParenPadNoSpace() {
19 this(0);
20 }
21
22 ParenPadNoSpace(int i) {
23 super();
24 }
25
26 @SuppressWarnings("")
27 void method(boolean status) {
28 try (Writer writer = new StringWriter()) {
29 do {
30 writer.append("a");
31 } while (status);
32 } catch (IOException e) {
33 while (status) {
34 for (int i = 0; i < (long) (2 * (4 / 2)); i++) {
35 if (i > 2) {
36 synchronized (this) {
37 switch (i) {
38 case 3:
39 case (4):
40 case 5:
41 break;
42 }
43 }
44 }
45 }
46 }
47 }
48 }
49 }
50
51 class ParenPadSpaceLeft {
52 ParenPadSpaceLeft( ) {
53 this( 0);
54 }
55
56 ParenPadSpaceLeft( int i) {
57 super( );
58 }
59
60 @SuppressWarnings( "")
61 void method( boolean status) {
62 try ( Writer writer = new StringWriter( )) {
63 do {
64 writer.append("a");
65 } while ( status);
66 } catch ( IOException e) {
67 while ( status) {
68 for ( int i = 0; i < ( long) ( 2 * ( 4 / 2)); i++) {
69 if ( i > 2) {
70 synchronized ( this) {
71 switch ( i) {
72 case 3:
73 case ( 4):
74 case 5:
75 break;
76 }
77 }
78 }
79 }
80 }
81 }
82 }
83 }
84
85 class ParenPadSpaceRight {
86 ParenPadSpaceRight( ) {
87 this(0 );
88 }
89
90 ParenPadSpaceRight(int i ) {
91 super( );
92 }
93
94 @SuppressWarnings("" )
95 void method(boolean status ) {
96 try (Writer writer = new StringWriter( ) ) {
97 do {
98 writer.append("a" );
99 } while (status );
100 } catch (IOException e ) {
101 while (status ) {
102 for (int i = 0; i < (long ) (2 * (4 / 2 ) ); i++ ) {
103 if (i > 2 ) {
104 synchronized (this ) {
105 switch (i ) {
106 case 3:
107 case (4 ):
108 case 5:
109 break;
110 }
111 }
112 }
113 }
114 }
115 }
116 }
117 }
118
119 String foo() {
120 return ( (Object
121 ) bar( ( 1 > 2 ) ?
122 ( ( 3 < 4 )? false : true ) :
123 ( ( 1 == 1 ) ? false : true) ) ).toString();
124 }
125 @MyAnnotation2
126 public boolean bar(boolean a) {
127 assert ( true );
128 return true;
129 }
130
131 boolean fooo = this.bar(( true && false ) && true);
132 }
133 @interface MyAnnotation2 {
134 String someField( ) default "Hello world";
135 }
136
137 enum MyEnum12 {
138 SOME_CONSTANT( ) {
139 int i = (int) (2 * (4 / 2)
140 );
141 };
142
143 public void myMethod() {
144 String s = "test";
145 Object o = s;
146 ((String)o).length();
147 ( (String)o ).length();
148 }
149
150 public void crisRon() {
151 Object leo = "messi";
152 Object ibra = leo;
153 ((String)leo).compareTo( (String)ibra );
154 Math.random();
155 }
156
157 public void intStringConv() {
158 Object a = 5;
159 Object b = "string";
160 int w = Integer.parseInt((String)a);
161 int x = Integer.parseInt( (String)a);
162 double y = Double.parseDouble((String)a );
163 float z = Float.parseFloat( (String)a );
164 String d = ((String)b);
165 }
166
167 public int something( Object o ) {
168 if ( o == null || !( o instanceof Float ) ) {
169 return -1;
170 }
171 return Integer.valueOf( 22 ).compareTo( (Integer) o );
172 }
173
174 private void launch(Integer number ) {
175 String myInt = ( number.toString() + '\0' );
176 boolean result = false;
177 if (number == 123)
178 result = true;
179 }
180
181 private static String getterName( Exception t) {
182 if (t instanceof ClassNotFoundException ) {
183 return ( (ClassNotFoundException) t ).getMessage();
184 }
185 else {
186 return "?";
187 }
188 }
189
190 private Object exam;
191
192 public String testing() {
193 return ( this.exam != null )
194 ? ( ( Enum )this.exam ).name()
195 : null;
196 }
197
198 Object stringReturnValue( Object result ) {
199 if ( result instanceof String ) {
200 result = ( (String) result ).length();
201 }
202 return result;
203 }
204
205
206
207 private void except() {
208 java.util.ArrayList<Integer> arrlist = new java.util.ArrayList<Integer>( 5 );
209 arrlist.add( 20);
210 arrlist.add(15 );
211 arrlist.add( 30 );
212 arrlist.add(45);
213 try {
214 ( arrlist ).remove( 2);
215 } catch ( IndexOutOfBoundsException x ) {
216 x.getMessage();
217 }
218 org.junit.Assert.assertThat( "123", org.hamcrest.CoreMatchers.is( "123" ) );
219 org.junit.Assert.assertThat( "Help! Integers don't work",
220 0, org.hamcrest.CoreMatchers.is( 1 ) );
221 }
222 }
223 enum MyEnum22 {
224 SOME_CONSTANT( ) {
225 int i = (int) (2 * (4 / 2
226 ) );
227 };
228 }