1 package com . puppycrawl 6 .tools. 7 checkstyle; 8 9 13 class InputWhitespace 14 { 15 16 private int mVar1=1; 17 18 private int mVar2 =1; 19 20 private int mVar3 = 1; 21 22 23 void method1() 24 { 25 final int a = 1; 26 int b= 1; b=1; b+=1; b -=- 1 + (+ b); b = b ++ + b --; b = ++ b - -- b; } 33 34 35 void method2() 36 { 37 synchronized(this) { 38 } 39 try{ 40 } 41 catch(RuntimeException e){ 42 } 43 } 44 45 49 50 51 private int mVar4 = 1; 52 53 54 55 private void fastExit() 56 { 57 boolean complicatedStuffNeeded = true; 58 if( !complicatedStuffNeeded ) 59 { 60 return; } 62 else 63 { 64 } 66 } 67 68 69 72 private int nonVoid() 73 { 74 if ( true ) 75 { 76 return(2); } 78 else 79 { 80 return 2; } 82 } 83 84 85 private void testCasts() 86 { 87 Object o = (Object ) new Object (); o = (Object )o; o = ( Object ) o; o = (Object ) 91 o; } 93 94 95 private void testQuestions() 96 { 97 boolean b = (1 == 2)?true:false; 98 b = (1==2) ? false : true; 99 } 100 101 102 private void starTest() 103 { 104 int x = 2 *3* 4; 105 } 106 107 108 private void boolTest() 109 { 110 boolean a = true; 111 boolean x = ! a; 112 int z = ~1 + ~ 2; 113 } 114 115 116 private void divTest() 117 { 118 int a = 4 % 2; 119 int b = 4% 2; 120 int c = 4 %2; 121 int d = 4%2; 122 int e = 4 / 2; 123 int f = 4/ 2; 124 int g = 4 /2; 125 int h = 4/2; 126 } 127 128 129 private java .lang. String dotTest() 130 { 131 Object o = new java.lang.Object (); 132 o. 133 toString(); 134 o 135 .toString(); 136 o . toString(); 137 return o.toString(); 138 } 139 140 141 public void assertTest() 142 { 143 assert true; 145 146 assert true : "Whups"; 148 149 assert "OK".equals(null) ? false : true : "Whups"; 151 152 assert(true); 154 155 assert true:"Whups"; 157 } 158 159 160 void donBradman(Runnable aRun) 161 { 162 donBradman(new Runnable () { 163 public void run() { 164 } 165 }); 166 167 final Runnable r = new Runnable () { 168 public void run() { 169 } 170 }; 171 } 172 173 174 void rfe521323() 175 { 176 doStuff() ; 177 for (int i = 0 ; i < 5; i++) { 179 } 181 } 182 183 184 185 private int i ; 186 private int i1, i2, i3 ; 188 private int i4, i5, i6; 190 191 192 void bug806243() 193 { 194 Object o = new InputWhitespace() { 195 private int j ; 196 }; 198 } 199 200 void doStuff() { 201 } 202 } 203 204 209 interface IFoo 210 { 211 void foo() ; 212 } 214 215 220 class SpecialCasesInForLoop 221 { 222 void forIterator() 223 { 224 for (int i = 0; i++ < 5;) { 226 } 228 229 int i = 0; 232 for ( ; i < 5; i++ ) { 233 } 235 for (int anInt : getSomeInts()) { 236 } 238 } 239 240 int[] getSomeInts() { 241 int i = (int) ( 2 / 3 ); 242 return null; 243 } 244 } 245 | Popular Tags |