1 18 19 package alt.jiapi.instrumentor; 20 21 import java.lang.reflect.Method ; 22 import java.lang.reflect.Modifier ; 23 24 import org.apache.log4j.Category; 25 26 import alt.jiapi.Runtime; 27 28 import alt.jiapi.reflect.InstructionFactory; 29 import alt.jiapi.reflect.InstructionList; 30 import alt.jiapi.reflect.Loader; 31 import alt.jiapi.reflect.JiapiClass; 32 import alt.jiapi.reflect.JiapiField; 33 import alt.jiapi.reflect.JiapiMethod; 34 35 43 public class CopyInstrumentor extends AbstractInstrumentor { 44 private InstructionList source; 45 46 61 public CopyInstrumentor(Method sourceMethod, Loader loader) 62 throws ClassNotFoundException , NoSuchMethodException { 63 64 JiapiClass clazz = null; 67 try { 68 clazz=loader.loadClass(sourceMethod.getDeclaringClass().getName()); 69 } 70 catch(java.io.IOException ioe) { 71 ioe.printStackTrace(); 72 throw new ClassNotFoundException (sourceMethod.getDeclaringClass().getName()); 73 } 74 75 Class [] parameterTypes = sourceMethod.getParameterTypes(); 76 String [] parameterTypeNames = new String [parameterTypes.length]; 77 for (int i = 0; i < parameterTypes.length; i++) { 78 parameterTypeNames[i] = parameterTypes[i].getName(); 79 } 80 81 JiapiMethod method = clazz.getMethod(sourceMethod.getName(), 82 parameterTypeNames); 83 source = method.getInstructionList(); 84 } 85 86 92 public CopyInstrumentor(InstructionList source) { 93 this.source = source; 94 } 95 96 public void instrument(InstructionList il) { 97 InstructionFactory factory = 98 il.getDeclaringMethod().getInstructionFactory(); 99 100 if (true) 101 throw new RuntimeException ("NOT IMPLEMENTED"); 102 forward(il); 104 } 105 } 106 | Popular Tags |