1 package test.try_catch_clinit; 2 3 import java.lang.reflect.Modifier ; 4 5 import alt.jiapi.*; 6 import alt.jiapi.reflect.*; 7 import alt.jiapi.instrumentor.*; 8 9 import test.InstrumentorTest; 10 11 public class FieldAssignTest extends InstrumentorTest { 13 static { 14 System.setProperty("class", "test.try_catch_clinit.Main"); 15 System.setProperty("include", "test.try_catch_clinit.*"); 16 } 17 18 public static void main(String [] args) throws Exception { 19 FieldAssignTest ft = new FieldAssignTest(); 20 ft.run(args); 21 } 22 23 public FieldAssignTest() throws JiapiException { 24 InstrumentationDescriptor id = new InstrumentationDescriptor(); 25 26 InstrumentorChain chain1 = new InstrumentorChain(); 27 Instrumentor createField = 28 new CreateFieldInstrumentor(Modifier.PRIVATE, "java.lang.Object", 29 "jeejee"); 30 chain1.add(createField); 31 id.addChain(chain1); 32 33 InstrumentorChain chain2 = new InstrumentorChain(); 34 35 int index = Integer.parseInt(System.getProperty("n", "2")); 46 Instrumentor head = new HeadInstrumentor(index); 47 Instrumentor assign = new FieldAssignInstrumentor("jeejee", 48 new Object ()); 49 50 chain2.add(head); 51 chain2.add(assign); 52 53 id.addChain(chain2); 54 55 addInclusionRules(id, getInclusionRules()); 56 addExclusionRules(id, getExclusionRules()); 57 58 ctx.addInstrumentationDescriptor(id); 59 } 60 } 61 | Popular Tags |