1 19 20 package soot.jimple.paddle; 21 import soot.*; 22 import java.util.*; 23 24 27 public class PaddleHook extends SceneTransformer 28 { 29 public PaddleHook( Singletons.Global g ) {} 30 public static PaddleHook v() { return G.v().soot_jimple_paddle_PaddleHook(); } 31 32 private IPaddleTransformer paddleTransformer; 33 public IPaddleTransformer paddleTransformer() { 34 if(paddleTransformer == null) { 35 paddleTransformer = (IPaddleTransformer) 36 instantiate("soot.jimple.paddle.PaddleTransformer"); 37 } 38 return paddleTransformer; 39 } 40 41 protected void internalTransform( String phaseName, Map options ) 42 { 43 paddleTransformer().transform(phaseName, options); 44 } 45 public Object instantiate(String className) { 46 Object ret; 47 try { 48 ret = Class.forName( 49 className ).newInstance(); 50 } catch( ClassNotFoundException e ) { 51 throw new RuntimeException ("Could not find "+className+". Did you include Paddle on your Java classpath?"); 52 } catch( InstantiationException e ) { 53 throw new RuntimeException ( "Could not instantiate "+className+": "+e ); 54 } catch( IllegalAccessException e ) { 55 throw new RuntimeException ( "Could not instantiate "+className+": "+e ); 56 } 57 return ret; 58 } 59 60 private Object paddleG; 61 public Object paddleG() { 62 if(paddleG == null) { 63 paddleG = instantiate("soot.PaddleG"); 64 } 65 return paddleG; 66 } 67 69 public void finishPhases() 70 { 71 if(paddleTransformer != null) { 72 paddleTransformer().finishPhases(); 73 } 74 } 75 } 76 77 78 | Popular Tags |