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