1 19 20 23 24 29 package soot.dava; 30 31 import soot.SootField; 32 import soot.SootMethod; 33 import soot.Value; 34 import soot.dava.toolkits.base.AST.analysis.DepthFirstAdapter; 35 import soot.jimple.DefinitionStmt; 36 import soot.jimple.FieldRef; 37 38 public class StaticDefinitionFinder extends DepthFirstAdapter{ 39 40 SootMethod method; 41 boolean finalFieldDefined; 42 43 public StaticDefinitionFinder(SootMethod method){ 44 this.method = method; 45 finalFieldDefined=false; 46 } 47 48 public StaticDefinitionFinder(boolean verbose,SootMethod method){ 49 super(verbose); 50 this.method= method; 51 finalFieldDefined=false; 52 } 53 54 public void inDefinitionStmt(DefinitionStmt s){ 55 Value leftOp = s.getLeftOp(); 56 if(leftOp instanceof FieldRef){ 57 SootField field = ((FieldRef)leftOp).getField(); 59 if(field.isFinal()){ 61 finalFieldDefined=true; 63 } 64 } 65 66 } 67 68 public boolean anyFinalFieldDefined(){ 69 return finalFieldDefined; 70 } 71 72 } | Popular Tags |