1 31 package org.objectweb.proactive.core.mop; 32 33 import java.lang.reflect.Method ; 34 import java.lang.reflect.Modifier ; 35 import java.util.Vector ; 36 37 import org.apache.bcel.Constants; 38 import org.apache.bcel.classfile.JavaClass; 39 import org.apache.bcel.generic.ArrayType; 40 import org.apache.bcel.generic.ClassGen; 41 import org.apache.bcel.generic.ConstantPoolGen; 42 import org.apache.bcel.generic.FieldGen; 43 import org.apache.bcel.generic.GOTO; 44 import org.apache.bcel.generic.ICONST; 45 import org.apache.bcel.generic.Instruction; 46 import org.apache.bcel.generic.InstructionConstants; 47 import org.apache.bcel.generic.InstructionFactory; 48 import org.apache.bcel.generic.InstructionHandle; 49 import org.apache.bcel.generic.InstructionList; 50 import org.apache.bcel.generic.LocalVariableInstruction; 51 import org.apache.bcel.generic.MethodGen; 52 import org.apache.bcel.generic.ObjectType; 53 import org.apache.bcel.generic.PUSH; 54 import org.apache.bcel.generic.ReferenceType; 55 import org.apache.bcel.generic.Type; 56 57 public class BytecodeStubBuilder { 58 protected Class cl; 61 protected String className; 62 protected String packageName; 63 protected Method [] methods; 64 65 protected String stubClassSimpleName; 68 protected String stubClassFullName; 69 protected ClassGen classGenerator; 70 71 protected InstructionList instructionList = new InstructionList(); 74 75 protected static final Type CLASS_TYPE = convertClassNameToType("java.lang.Class"); 77 protected static final Type CLASS_ARRAY_TYPE = new ArrayType(CLASS_TYPE, 1); 78 protected static final Type OBJECT_TYPE = convertClassNameToType("java.lang.Object"); 79 protected static final Type OBJECT_ARRAY_TYPE = new ArrayType(OBJECT_TYPE, 1); 80 protected static final Type METHOD_TYPE = convertClassNameToType("java.lang.reflect.Method"); 81 protected static final Type METHOD_ARRAY_TYPE = new ArrayType(METHOD_TYPE, 1); 82 protected static final Type PROXY_TYPE = convertClassNameToType("org.objectweb.proactive.core.mop.Proxy"); 83 protected static final Type METHODCALL_TYPE = convertClassNameToType("org.objectweb.proactive.core.mop.MethodCall"); 84 protected static final String STUB_INTERFACE_NAME = "org.objectweb.proactive.core.mop.StubObject"; 85 protected static final String PROXY_FIELD_NAME = "myProxy"; 86 87 public BytecodeStubBuilder(String classname) throws ClassNotFoundException { 88 this.cl = Class.forName(classname); 92 93 this.className = classname; 95 96 this.setInfos(); 98 } 99 100 protected ClassGen createClassGenerator() { 101 String superclassName; 102 String [] interfaces; 103 104 if (this.cl.isInterface()) { 108 superclassName = "java.lang.Object"; 109 interfaces = new String [3]; 110 interfaces[0] = "java.io.Serializable"; 111 interfaces[1] = STUB_INTERFACE_NAME; 112 interfaces[2] = this.cl.getName(); 113 } else { 114 superclassName = this.className; 115 interfaces = new String [2]; 116 interfaces[0] = "java.io.Serializable"; 117 interfaces[1] = STUB_INTERFACE_NAME; 118 } 119 120 return new ClassGen(this.stubClassFullName, superclassName, "<generated>", Constants.ACC_PUBLIC | Constants.ACC_SUPER, interfaces); } 125 126 public byte[] create() { 127 this.classGenerator = this.createClassGenerator(); 129 130 this.createConstructor(); 132 133 for (int i = 0; i < this.methods.length; i++) { 135 MethodGen mg = this.createMethod(i, this.methods[i]); 136 this.classGenerator.addMethod(mg.getMethod()); 137 instructionList.dispose(); 138 } 139 140 this.createGetAndSetProxyMethods(); 143 144 this.createFields(); 146 147 this.createStaticVariables(); 149 150 this.createStaticInitializer(); 152 153 JavaClass theClass = this.classGenerator.getJavaClass(); 155 156 163 return theClass.getBytes(); 164 } 165 166 protected MethodGen createMethodGenerator(Method m) { 167 int flags = convertJavaModifierToBCEL(m.getModifiers()); 169 170 flags = removeNativeAndAbstractModifiers(flags); 172 173 Type returnType = convertClassToType(m.getReturnType()); 175 Class [] methodParams = m.getParameterTypes(); 176 Type[] argumentTypes = new Type[methodParams.length]; 177 for (int i = 0; i < argumentTypes.length; i++) { 178 argumentTypes[i] = convertClassToType(methodParams[i]); 179 } 180 181 String [] argumentNames = new String [argumentTypes.length]; 183 for (int i = 0; i < argumentNames.length; i++) { 184 argumentNames[i] = new String ("arg" + i); 185 } 186 187 MethodGen mg = new MethodGen(flags, returnType, argumentTypes, argumentNames, m.getName(), this.stubClassFullName, instructionList, this.classGenerator.getConstantPool()); 195 return mg; 196 } 197 198 protected static int removeNativeAndAbstractModifiers(int modifiers) { 199 int result = modifiers & (~java.lang.reflect.Modifier.NATIVE); 203 result = result & (~java.lang.reflect.Modifier.ABSTRACT); 204 return result; 205 } 206 207 protected static int convertJavaModifierToBCEL(int javaModifier) { 208 int result = 0; 209 210 if (Modifier.isAbstract(javaModifier)) { 211 result = result | Constants.ACC_ABSTRACT; 212 } 213 if (Modifier.isFinal(javaModifier)) { 214 result = result | Constants.ACC_FINAL; 215 } 216 if (Modifier.isInterface(javaModifier)) { 217 result = result | Constants.ACC_INTERFACE; 218 } 219 if (Modifier.isNative(javaModifier)) { 220 result = result | Constants.ACC_NATIVE; 221 } 222 if (Modifier.isPrivate(javaModifier)) { 223 result = result | Constants.ACC_PRIVATE; 224 } 225 if (Modifier.isProtected(javaModifier)) { 226 result = result | Constants.ACC_PROTECTED; 227 } 228 if (Modifier.isPublic(javaModifier)) { 229 result = result | Constants.ACC_PUBLIC; 230 } 231 if (Modifier.isStatic(javaModifier)) { 232 result = result | Constants.ACC_STATIC; 233 } 234 if (Modifier.isStrict(javaModifier)) { 235 result = result | Constants.ACC_STRICT; 236 } 237 if (Modifier.isSynchronized(javaModifier)) { 238 result = result | Constants.ACC_SYNCHRONIZED; 239 } 240 if (Modifier.isTransient(javaModifier)) { 241 result = result | Constants.ACC_TRANSIENT; 242 } 243 if (Modifier.isVolatile(javaModifier)) { 244 result = result | Constants.ACC_VOLATILE; 245 } 246 247 return result; 248 } 249 250 protected MethodGen createMethod(int methodIndex, Method m) { 251 MethodGen mg = createMethodGenerator(m); 252 InstructionFactory factory = new InstructionFactory(classGenerator); 253 254 if (this.cl.isInterface() == false) { 255 instructionList.append(InstructionFactory.createThis()); 258 259 instructionList.append(factory.createGetField(this.stubClassFullName, "outsideConstructor", Type.BOOLEAN)); 261 } 262 263 266 InstructionHandle outsideConstructorHandle = instructionList.append(InstructionFactory.createThis()); 268 instructionList.append(factory.createGetField(this.stubClassFullName, PROXY_FIELD_NAME, PROXY_TYPE)); 269 270 instructionList.append(factory.createGetStatic(this.stubClassFullName, "methods", METHOD_ARRAY_TYPE)); 272 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), methodIndex)); 273 instructionList.append(InstructionFactory.createArrayLoad(METHOD_TYPE)); 274 275 Class [] paramTypes = m.getParameterTypes(); 276 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), paramTypes.length)); 279 instructionList.append((Instruction) factory.createNewArray(OBJECT_TYPE, (byte) 1)); 281 282 int indexInParameterArray = 1; for (int i = 0; i < paramTypes.length; i++) { 285 instructionList.append(InstructionFactory.createDup(1)); 288 289 PUSH push = new PUSH(this.classGenerator.getConstantPool(), i); 291 instructionList.append(push); 292 293 Type theType = convertClassToType(paramTypes[i]); 294 295 if (paramTypes[i].isPrimitive()) { 297 String nameOfWrapper = Utils.nameOfWrapper(paramTypes[i]); 299 instructionList.append(factory.createNew(nameOfWrapper)); 300 instructionList.append(InstructionFactory.createDup(1)); 301 instructionList.append(InstructionFactory.createLoad(theType, indexInParameterArray)); 303 indexInParameterArray = indexInParameterArray + lengthOfType(paramTypes[i]); 305 306 Type[] argtypes = new Type[] { convertClassToType(paramTypes[i])}; 308 instructionList.append(factory.createInvoke(nameOfWrapper, "<init>", Type.VOID, argtypes, Constants.INVOKESPECIAL)); 309 } else { 310 instructionList.append(InstructionFactory.createLoad(theType, indexInParameterArray)); 312 indexInParameterArray++; } 314 315 instructionList.append(InstructionFactory.createArrayStore(OBJECT_TYPE)); 317 } 318 319 instructionList.append( 322 factory.createInvoke( 323 "org.objectweb.proactive.core.mop.MethodCall", 324 "getMethodCall", 325 METHODCALL_TYPE, 326 new Type[] { METHOD_TYPE, OBJECT_ARRAY_TYPE }, 327 Constants.INVOKESTATIC)); 328 329 instructionList.append( 331 factory.createInvoke("org.objectweb.proactive.core.mop.Proxy", "reify", Type.OBJECT, new Type[] { METHODCALL_TYPE }, Constants.INVOKEINTERFACE)); 332 333 if (m.getReturnType().isPrimitive()) { 336 this.createUnwrappingCode(factory, m.getReturnType()); 337 } else { 338 instructionList.append(factory.createCheckCast((ReferenceType) convertClassToType(m.getReturnType()))); 341 } 342 343 if (this.cl.isInterface() == false) { 347 InstructionHandle inConstructorHandle = instructionList.append(InstructionFactory.createThis()); 350 351 instructionList.insert(outsideConstructorHandle, InstructionFactory.createBranchInstruction(Constants.IFEQ, inConstructorHandle)); 355 356 indexInParameterArray = 1; 359 for (int i = 0; i < paramTypes.length; i++) { 360 Type theType = convertClassToType(paramTypes[i]); 361 LocalVariableInstruction lvi = InstructionFactory.createLoad(theType, indexInParameterArray); 362 instructionList.append(lvi); 363 indexInParameterArray = indexInParameterArray + lengthOfType(paramTypes[i]); 364 } 365 366 String declaringClassName = this.methods[methodIndex].getDeclaringClass().getName(); 368 instructionList.append( 369 factory.createInvoke( 370 declaringClassName, 371 m.getName(), 372 convertClassToType(m.getReturnType()), 373 convertClassArrayToTypeArray(paramTypes), 374 Constants.INVOKESPECIAL)); 375 376 InstructionHandle returnHandle = instructionList.append(InstructionFactory.createReturn(convertClassToType(m.getReturnType()))); 378 379 instructionList.insert(inConstructorHandle, new GOTO(returnHandle)); 381 } else { 382 instructionList.append(InstructionFactory.createReturn(convertClassToType(m.getReturnType()))); 387 } 388 mg.removeLocalVariables(); 389 mg.setMaxStack(); mg.setMaxLocals(); 392 return mg; 393 } 394 395 protected void createUnwrappingCode(InstructionFactory factory, Class c) { 396 400 if (c.equals(Void.TYPE)) { 401 instructionList.append(InstructionFactory.createPop(1)); 403 } else { 404 String nameOfPrimitiveType = c.getName(); 405 String nameOfWrapperClass = Utils.nameOfWrapper(c); 406 instructionList.append(factory.createCheckCast((ReferenceType) convertClassNameToType(nameOfWrapperClass))); 409 instructionList.append( 411 factory.createInvoke(nameOfWrapperClass, nameOfPrimitiveType + "Value", convertClassToType(c), new Type[0], Constants.INVOKEVIRTUAL)); 412 } 413 414 return; 415 } 416 417 protected void createFields() { 418 ConstantPoolGen cp = this.classGenerator.getConstantPool(); 420 421 if (!this.cl.isInterface()) { 426 int flags1 = Constants.ACC_PROTECTED; 427 Type type1 = Type.BOOLEAN; 428 String name1 = "outsideConstructor"; 429 FieldGen f1 = new FieldGen(flags1, type1, name1, cp); 430 431 this.classGenerator.addField(f1.getField()); 432 } 433 int flags2 = Constants.ACC_PROTECTED; 435 Type type2 = PROXY_TYPE; 436 String name2 = PROXY_FIELD_NAME; 437 FieldGen f2 = new FieldGen(flags2, type2, name2, cp); 438 this.classGenerator.addField(f2.getField()); 439 } 440 441 protected void createConstructor() { 442 MethodGen mg = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, new Type[0], new String [0], "<init>", this.stubClassFullName, instructionList, this.classGenerator.getConstantPool()); 450 451 InstructionFactory factory = new InstructionFactory(this.classGenerator); 453 454 if (!this.cl.isInterface()) { 455 instructionList.append(InstructionFactory.createLoad(Type.OBJECT, 0)); 457 instructionList.append(factory.createInvoke(this.className, "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL)); 458 459 instructionList.append(InstructionFactory.createLoad(Type.OBJECT, 0)); 461 instructionList.append(new ICONST(1)); 462 instructionList.append(factory.createPutField(this.stubClassFullName, "outsideConstructor", Type.BOOLEAN)); 463 } else { 464 instructionList.append(InstructionFactory.createLoad(Type.OBJECT, 0)); 466 instructionList.append(factory.createInvoke("java.lang.Object", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL)); 467 } 468 469 instructionList.append(InstructionConstants.RETURN); 471 472 mg.setMaxStack(); mg.setMaxLocals(); 475 this.classGenerator.addMethod(mg.getMethod()); 477 478 this.instructionList.dispose(); 480 481 return; 482 } 483 484 protected void createStaticVariables() { 485 ConstantPoolGen cp = this.classGenerator.getConstantPool(); 487 488 int flags1 = Constants.ACC_PROTECTED | Constants.ACC_STATIC; 491 Type type1 = METHOD_ARRAY_TYPE; 492 String name1 = "methods"; 493 FieldGen f1 = new FieldGen(flags1, type1, name1, cp); 494 495 this.classGenerator.addField(f1.getField()); 496 497 return; 498 } 499 500 protected void createStaticInitializer() { 501 MethodGen mg = new MethodGen(Constants.ACC_STATIC, Type.VOID, new Type[0], new String [0], Constants.STATIC_INITIALIZER_NAME, this.stubClassFullName, instructionList, this.classGenerator.getConstantPool()); 506 507 InstructionFactory factory = new InstructionFactory(this.classGenerator); 509 510 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), this.methods.length)); 514 instructionList.append((Instruction) factory.createNewArray(METHOD_TYPE, (byte) 1)); 516 517 instructionList.append(factory.createPutStatic(this.stubClassFullName, "methods", METHOD_ARRAY_TYPE)); 519 520 Vector vectorOfSuperClasses = new Vector (); 523 Class currentClass = cl; 524 while (currentClass != null) { 525 vectorOfSuperClasses.addElement(currentClass); 526 currentClass = currentClass.getSuperclass(); 527 } 528 529 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), vectorOfSuperClasses.size())); 531 instructionList.append((Instruction) factory.createNewArray(CLASS_TYPE, (byte) 1)); 533 instructionList.append(InstructionFactory.createStore(Type.OBJECT, 1)); 535 536 for (int i = 0; i < vectorOfSuperClasses.size(); i++) { 538 instructionList.append(InstructionFactory.createLoad(Type.OBJECT, 1)); 540 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), i)); 542 String s = ((Class ) vectorOfSuperClasses.elementAt(i)).getName(); 544 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), s)); 545 Type[] argstypes = new Type[1]; 547 argstypes[0] = Type.STRING; 548 instructionList.append(factory.createInvoke("java.lang.Class", "forName", CLASS_TYPE, argstypes, Constants.INVOKESTATIC)); 549 550 instructionList.append(InstructionFactory.createArrayStore(Type.OBJECT)); 554 } 555 556 for (int i = 0; i < this.methods.length; i++) { 558 instructionList.append(factory.createGetStatic(this.stubClassFullName, "methods", METHOD_ARRAY_TYPE)); 560 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), i)); 561 562 int indexInClassArray = vectorOfSuperClasses.indexOf(this.methods[i].getDeclaringClass()); 564 if (indexInClassArray == -1) {} 565 instructionList.append(InstructionFactory.createLoad(Type.OBJECT, 1)); 567 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), indexInClassArray)); 569 instructionList.append(InstructionFactory.createArrayLoad(CLASS_TYPE)); 570 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), this.methods[i].getName())); 573 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), this.methods[i].getParameterTypes().length)); 578 instructionList.append((Instruction) factory.createNewArray(CLASS_TYPE, (byte) 1)); 580 instructionList.append(InstructionFactory.createStore(Type.OBJECT, 2)); 582 583 for (int j = 0; j < this.methods[i].getParameterTypes().length; j++) { 585 Class currentParameter = this.methods[i].getParameterTypes()[j]; 586 587 instructionList.append(InstructionFactory.createLoad(Type.OBJECT, 2)); 589 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), j)); 591 592 if (currentParameter.isPrimitive()) { 595 instructionList.append(factory.createGetStatic(Utils.getWrapperClass(currentParameter).getName(), "TYPE", CLASS_TYPE)); 597 } else { 598 instructionList.append(new PUSH(this.classGenerator.getConstantPool(), currentParameter.getName())); 600 Type[] argstypes = new Type[1]; 602 argstypes[0] = Type.STRING; 603 instructionList.append(factory.createInvoke("java.lang.Class", "forName", CLASS_TYPE, argstypes, Constants.INVOKESTATIC)); 604 } 605 606 instructionList.append(InstructionFactory.createArrayStore(Type.OBJECT)); 608 } 609 610 instructionList.append(InstructionFactory.createLoad(Type.OBJECT, 2)); 612 613 Type[] argstypes = new Type[2]; 615 argstypes[0] = Type.STRING; 616 argstypes[1] = CLASS_ARRAY_TYPE; 617 instructionList.append(factory.createInvoke("java.lang.Class", "getDeclaredMethod", METHOD_TYPE, argstypes, Constants.INVOKEVIRTUAL)); 618 instructionList.append(InstructionFactory.createArrayStore(Type.OBJECT)); 620 } 621 622 instructionList.append(InstructionConstants.RETURN); 624 625 mg.setMaxStack(); mg.setMaxLocals(); 628 this.classGenerator.addMethod(mg.getMethod()); 630 631 this.instructionList.dispose(); 633 634 return; 635 } 636 637 protected void createGetAndSetProxyMethods() { 638 MethodGen mg = new MethodGen(Constants.ACC_PUBLIC, PROXY_TYPE, new Type[0], new String [0], "getProxy", this.stubClassFullName, instructionList, this.classGenerator.getConstantPool()); 645 646 InstructionFactory factory = new InstructionFactory(this.classGenerator); 648 649 instructionList.append(InstructionFactory.createLoad(Type.OBJECT, 0)); 650 instructionList.append(factory.createGetField(this.stubClassFullName, PROXY_FIELD_NAME, PROXY_TYPE)); 651 instructionList.append(InstructionFactory.createReturn(Type.OBJECT)); 652 653 mg.setMaxStack(); mg.setMaxLocals(); 656 this.classGenerator.addMethod(mg.getMethod()); 657 658 this.instructionList.dispose(); 659 660 Type[] types = new Type[1]; 662 types[0] = PROXY_TYPE; 663 String [] argnames = new String [1]; 664 argnames[0] = "p"; 665 666 mg = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, types, argnames, "setProxy", this.stubClassFullName, instructionList, this.classGenerator.getConstantPool()); 671 672 factory = new InstructionFactory(this.classGenerator); 674 675 instructionList.append(InstructionFactory.createLoad(Type.OBJECT, 0)); 676 instructionList.append(InstructionFactory.createLoad(Type.OBJECT, 1)); 677 instructionList.append(factory.createPutField(this.stubClassFullName, PROXY_FIELD_NAME, PROXY_TYPE)); 678 instructionList.append(InstructionFactory.createReturn(Type.VOID)); 679 680 mg.setMaxStack(); mg.setMaxLocals(); 683 this.classGenerator.addMethod(mg.getMethod()); 684 685 this.instructionList.dispose(); 686 687 return; 688 } 689 690 protected static Type convertClassNameToType(String className) { 691 try { 692 return convertClassToType(Class.forName(className)); 693 } catch (ClassNotFoundException e) { 694 return null; 695 } 696 } 697 698 701 702 protected static Type convertClassToType(Class cl) { 703 if (cl.isPrimitive()) { 704 if (cl.equals(Void.TYPE)) { 705 return Type.VOID; 706 } else if (cl.equals(Boolean.TYPE)) { 707 return Type.BOOLEAN; 708 } else if (cl.equals(Byte.TYPE)) { 709 return Type.BYTE; 710 } else if (cl.equals(Short.TYPE)) { 711 return Type.SHORT; 712 } else if (cl.equals(Integer.TYPE)) { 713 return Type.INT; 714 } else if (cl.equals(Character.TYPE)) { 715 return Type.CHAR; 716 } else if (cl.equals(Long.TYPE)) { 717 return Type.LONG; 718 } else if (cl.equals(Float.TYPE)) { 719 return Type.FLOAT; 720 } else if (cl.equals(Double.TYPE)) { 721 return Type.DOUBLE; 722 } else { 723 return Type.UNKNOWN; 724 } 725 } else { 726 if (cl.isArray()) { 727 return new ArrayType(convertClassToType(cl.getComponentType()), 1); 728 } else { 729 return new ObjectType(cl.getName()); 730 } 731 } 732 } 733 734 protected static int lengthOfType(Class cl) { 735 int result; 736 if (cl.isPrimitive()) { 737 if ((cl.equals(Long.TYPE)) || (cl.equals(Double.TYPE))) { 738 result = 2; 739 } else { 740 result = 1; 741 } 742 } else { 743 result = 1; 744 } 745 return result; 746 } 747 748 protected static Type[] convertClassArrayToTypeArray(Class [] cl) { 749 Type[] result = new Type[cl.length]; 750 for (int i = 0; i < cl.length; i++) { 751 result[i] = convertClassToType(cl[i]); 752 } 753 return result; 754 } 755 756 759 760 protected void setInfos() { 761 java.util.Hashtable temp = new java.util.Hashtable (); 764 765 Class currentClass = this.cl; 769 770 java.util.Vector tempVector = new java.util.Vector (); 772 Class [] params; 773 Object exists; 774 775 if (this.cl.isInterface()) { 778 Method [] allPublicMethods = this.cl.getMethods(); 779 for (int i = 0; i < allPublicMethods.length; i++) { 780 tempVector.addElement(allPublicMethods[i]); 781 } 782 } else { 784 do { 786 Method [] declaredMethods = currentClass.getDeclaredMethods(); 788 789 for (int i = 0; i < declaredMethods.length; i++) { 791 Method currentMethod = declaredMethods[i]; 792 String key = ""; 795 key = key + currentMethod.getName(); 796 params = currentMethod.getParameterTypes(); 797 for (int k = 0; k < params.length; k++) { 798 key = key + params[k].getName(); 799 } 800 801 exists = temp.get(key); 803 if (exists == null) { 804 if ((key.equals("finalize")) && (params.length == 0)) { 808 } else { 810 tempVector.addElement(currentMethod); 813 temp.put(key, currentMethod); 814 } 815 } else { 816 } 819 } 820 currentClass = currentClass.getSuperclass(); 821 } while (currentClass != null); } 823 824 this.methods = new Method [tempVector.size()]; 826 tempVector.copyInto(this.methods); 827 828 832 java.util.Vector v = new java.util.Vector (); 833 int initialNumberOfMethods = this.methods.length; 834 835 for (int i = 0; i < initialNumberOfMethods; i++) { 836 if (Utils.checkMethod(this.methods[i])) { 837 v.addElement(this.methods[i]); 838 } 839 } 840 Method [] validMethods = new Method [v.size()]; 841 v.copyInto(validMethods); 842 843 this.methods = validMethods; 845 846 this.packageName = Utils.getPackageName(this.className); 847 this.stubClassFullName = Utils.convertClassNameToStubClassName(this.className); 848 this.stubClassSimpleName = Utils.getSimpleName(this.stubClassFullName); 849 850 return; 851 } 852 853 public String getStubClassFullName() { 854 return this.stubClassFullName; 855 } 856 } | Popular Tags |