1 16 17 package org.cojen.classfile; 18 19 import java.lang.reflect.Constructor ; 20 import java.lang.reflect.Method ; 21 22 28 public class DelegatedCodeAssembler implements CodeAssembler { 29 protected final CodeAssembler mAssembler; 30 31 public DelegatedCodeAssembler(CodeAssembler assembler) { 32 if (assembler == null) { 33 throw new IllegalArgumentException (); 34 } 35 mAssembler = assembler; 36 } 37 38 public int getParameterCount() { 39 return mAssembler.getParameterCount(); 40 } 41 42 public LocalVariable getParameter(int index) { 43 return mAssembler.getParameter(index); 44 } 45 46 public LocalVariable createLocalVariable(String name, TypeDesc type) { 47 return mAssembler.createLocalVariable(name, type); 48 } 49 50 public Label createLabel() { 51 return mAssembler.createLabel(); 52 } 53 54 public void exceptionHandler(Location startLocation, 55 Location endLocation, 56 String catchClassName) { 57 mAssembler.exceptionHandler 58 (startLocation, endLocation, catchClassName); 59 } 60 61 public void mapLineNumber(int lineNumber) { 62 mAssembler.mapLineNumber(lineNumber); 63 } 64 65 public void inline(Object code) { 66 mAssembler.inline(code); 67 } 68 69 public void loadNull() { 70 mAssembler.loadNull(); 71 } 72 73 public void loadConstant(String value) { 74 mAssembler.loadConstant(value); 75 } 76 77 public void loadConstant(TypeDesc type) { 78 mAssembler.loadConstant(type); 79 } 80 81 public void loadConstant(boolean value) { 82 mAssembler.loadConstant(value); 83 } 84 85 public void loadConstant(int value) { 86 mAssembler.loadConstant(value); 87 } 88 89 public void loadConstant(long value) { 90 mAssembler.loadConstant(value); 91 } 92 93 public void loadConstant(float value) { 94 mAssembler.loadConstant(value); 95 } 96 97 public void loadConstant(double value) { 98 mAssembler.loadConstant(value); 99 } 100 101 public void loadLocal(LocalVariable local) { 102 mAssembler.loadLocal(local); 103 } 104 105 public void loadThis() { 106 mAssembler.loadThis(); 107 } 108 109 public void storeLocal(LocalVariable local) { 110 mAssembler.storeLocal(local); 111 } 112 113 public void loadFromArray(TypeDesc type) { 114 mAssembler.loadFromArray(type); 115 } 116 117 public void storeToArray(TypeDesc type) { 118 mAssembler.storeToArray(type); 119 } 120 121 public void loadField(String fieldName, 122 TypeDesc type) { 123 mAssembler.loadField(fieldName, type); 124 } 125 126 public void loadField(String className, 127 String fieldName, 128 TypeDesc type) { 129 mAssembler.loadField(className, fieldName, type); 130 } 131 132 public void loadField(TypeDesc classDesc, 133 String fieldName, 134 TypeDesc type) { 135 mAssembler.loadField(classDesc, fieldName, type); 136 } 137 138 public void loadStaticField(String fieldName, 139 TypeDesc type) { 140 mAssembler.loadStaticField(fieldName, type); 141 } 142 143 public void loadStaticField(String className, 144 String fieldName, 145 TypeDesc type) { 146 mAssembler.loadStaticField(className, fieldName, type); 147 } 148 149 public void loadStaticField(TypeDesc classDesc, 150 String fieldName, 151 TypeDesc type) { 152 mAssembler.loadStaticField(classDesc, fieldName, type); 153 } 154 155 public void storeField(String fieldName, 156 TypeDesc type) { 157 mAssembler.storeField(fieldName, type); 158 } 159 160 public void storeField(String className, 161 String fieldName, 162 TypeDesc type) { 163 mAssembler.storeField(className, fieldName, type); 164 } 165 166 public void storeField(TypeDesc classDesc, 167 String fieldName, 168 TypeDesc type) { 169 mAssembler.storeField(classDesc, fieldName, type); 170 } 171 172 public void storeStaticField(String fieldName, 173 TypeDesc type) { 174 mAssembler.storeStaticField(fieldName, type); 175 } 176 177 public void storeStaticField(String className, 178 String fieldName, 179 TypeDesc type) { 180 mAssembler.storeStaticField(className, fieldName, type); 181 } 182 183 public void storeStaticField(TypeDesc classDesc, 184 String fieldName, 185 TypeDesc type) { 186 mAssembler.storeStaticField(classDesc, fieldName, type); 187 } 188 189 public void returnVoid() { 190 mAssembler.returnVoid(); 191 } 192 193 public void returnValue(TypeDesc type) { 194 mAssembler.returnValue(type); 195 } 196 197 public void convert(TypeDesc fromType, TypeDesc toType) { 198 mAssembler.convert(fromType, toType); 199 } 200 201 public void convert(TypeDesc fromType, TypeDesc toType, int fpConvertMode) { 202 mAssembler.convert(fromType, toType, fpConvertMode); 203 } 204 205 public void invoke(Method method) { 206 mAssembler.invoke(method); 207 } 208 209 public void invokeVirtual(String methodName, 210 TypeDesc ret, 211 TypeDesc[] params) { 212 mAssembler.invokeVirtual(methodName, ret, params); 213 } 214 215 public void invokeVirtual(String className, 216 String methodName, 217 TypeDesc ret, 218 TypeDesc[] params) { 219 mAssembler.invokeVirtual(className, methodName, ret, params); 220 } 221 222 public void invokeVirtual(TypeDesc classDesc, 223 String methodName, 224 TypeDesc ret, 225 TypeDesc[] params) { 226 mAssembler.invokeVirtual(classDesc, methodName, ret, params); 227 } 228 229 public void invokeStatic(String methodName, 230 TypeDesc ret, 231 TypeDesc[] params) { 232 mAssembler.invokeStatic(methodName, ret, params); 233 } 234 235 public void invokeStatic(String className, 236 String methodName, 237 TypeDesc ret, 238 TypeDesc[] params) { 239 mAssembler.invokeStatic(className, methodName, ret, params); 240 } 241 242 public void invokeStatic(TypeDesc classDesc, 243 String methodName, 244 TypeDesc ret, 245 TypeDesc[] params) { 246 mAssembler.invokeStatic(classDesc, methodName, ret, params); 247 } 248 249 public void invokeInterface(String className, 250 String methodName, 251 TypeDesc ret, 252 TypeDesc[] params) { 253 mAssembler.invokeInterface(className, methodName, ret, params); 254 } 255 256 public void invokeInterface(TypeDesc classDesc, 257 String methodName, 258 TypeDesc ret, 259 TypeDesc[] params) { 260 mAssembler.invokeInterface(classDesc, methodName, ret, params); 261 } 262 263 public void invokePrivate(String methodName, 264 TypeDesc ret, 265 TypeDesc[] params) { 266 mAssembler.invokePrivate(methodName, ret, params); 267 } 268 269 public void invokeSuper(Method method) { 270 mAssembler.invokeSuper(method); 271 } 272 273 public void invokeSuper(String superClassName, 274 String methodName, 275 TypeDesc ret, 276 TypeDesc[] params) { 277 mAssembler.invokeSuper(superClassName, methodName, ret, params); 278 } 279 280 public void invokeSuper(TypeDesc superClassDesc, 281 String methodName, 282 TypeDesc ret, 283 TypeDesc[] params) { 284 mAssembler.invokeSuper(superClassDesc, methodName, ret, params); 285 } 286 287 public void invoke(Constructor constructor) { 288 mAssembler.invoke(constructor); 289 } 290 291 public void invokeConstructor(TypeDesc[] params) { 292 mAssembler.invokeConstructor(params); 293 } 294 295 public void invokeConstructor(String className, TypeDesc[] params) { 296 mAssembler.invokeConstructor(className, params); 297 } 298 299 public void invokeConstructor(TypeDesc classDesc, TypeDesc[] params) { 300 mAssembler.invokeConstructor(classDesc, params); 301 } 302 303 public void invokeSuperConstructor(TypeDesc[] params) { 304 mAssembler.invokeSuperConstructor(params); 305 } 306 307 public void newObject(TypeDesc type) { 308 mAssembler.newObject(type); 309 } 310 311 public void newObject(TypeDesc type, int dimensions) { 312 mAssembler.newObject(type, dimensions); 313 } 314 315 public void dup() { 316 mAssembler.dup(); 317 } 318 319 public void dupX1() { 320 mAssembler.dupX1(); 321 } 322 323 public void dupX2() { 324 mAssembler.dupX2(); 325 } 326 327 public void dup2() { 328 mAssembler.dup2(); 329 } 330 331 public void dup2X1() { 332 mAssembler.dup2X1(); 333 } 334 335 public void dup2X2() { 336 mAssembler.dup2X2(); 337 } 338 339 public void pop() { 340 mAssembler.pop(); 341 } 342 343 public void pop2() { 344 mAssembler.pop2(); 345 } 346 347 public void swap() { 348 mAssembler.swap(); 349 } 350 351 public void swap2() { 352 mAssembler.swap2(); 353 } 354 355 public void branch(Location location) { 356 mAssembler.branch(location); 357 } 358 359 public void ifNullBranch(Location location, boolean choice) { 360 mAssembler.ifNullBranch(location, choice); 361 } 362 363 public void ifEqualBranch(Location location, boolean choice) { 364 mAssembler.ifEqualBranch(location, choice); 365 } 366 367 public void ifZeroComparisonBranch(Location location, String choice) 368 throws IllegalArgumentException { 369 mAssembler.ifZeroComparisonBranch(location, choice); 370 } 371 372 public void ifComparisonBranch(Location location, String choice) 373 throws IllegalArgumentException { 374 mAssembler.ifComparisonBranch(location, choice); 375 } 376 377 public void ifComparisonBranch(Location location, String choice, TypeDesc type) 378 throws IllegalArgumentException { 379 mAssembler.ifComparisonBranch(location, choice, type); 380 } 381 382 public void switchBranch(int[] cases, 383 Location[] locations, Location defaultLocation) { 384 mAssembler.switchBranch(cases, locations, defaultLocation); 385 } 386 387 public void jsr(Location location) { 388 mAssembler.jsr(location); 389 } 390 391 public void ret(LocalVariable local) { 392 mAssembler.ret(local); 393 } 394 395 public void math(byte opcode) { 396 mAssembler.math(opcode); 397 } 398 399 public void arrayLength() { 400 mAssembler.arrayLength(); 401 } 402 403 public void throwObject() { 404 mAssembler.throwObject(); 405 } 406 407 public void checkCast(TypeDesc type) { 408 mAssembler.checkCast(type); 409 } 410 411 public void instanceOf(TypeDesc type) { 412 mAssembler.instanceOf(type); 413 } 414 415 public void integerIncrement(LocalVariable local, int amount) { 416 mAssembler.integerIncrement(local, amount); 417 } 418 419 public void monitorEnter() { 420 mAssembler.monitorEnter(); 421 } 422 423 public void monitorExit() { 424 mAssembler.monitorExit(); 425 } 426 427 public void nop() { 428 mAssembler.nop(); 429 } 430 431 public void breakpoint() { 432 mAssembler.breakpoint(); 433 } 434 } 435 | Popular Tags |