1 19 20 25 26 28 29 package ashes.examples.addattributes; 30 31 import soot.*; 32 import soot.tagkit.*; 33 import java.util.*; 34 35 36 39 40 public class Main 41 { 42 public static void main(String [] args) 43 { 44 45 PackManager.v().getPack("jtp").add(new 46 Transform("annotexample", 47 AnnExampleWrapper.v())); 48 49 50 soot.Main.main(args); 51 } 52 } 53 54 55 class AnnExampleWrapper extends BodyTransformer 56 { 57 private static AnnExampleWrapper instance = 58 new AnnExampleWrapper(); 59 60 private AnnExampleWrapper() {}; 61 62 public static AnnExampleWrapper v() 63 { 64 return instance; 65 } 66 67 public void internalTransform(Body body, String phaseName, Map options) 68 { 69 SootMethod method = body.getMethod(); 70 String attr = new String ("Hello world!"); 71 72 Tag example = new GenericAttribute("Example", attr.getBytes()); 73 method.addTag(example); 74 } 75 } 76 | Popular Tags |