Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /* Soot - a J*va Optimization Framework
    * Copyright (C) 1997-1999 Raja Vallee-Rai
    * Copyright (C) 2004 Ondrej Lhotak
    *
    * This library is free software; you can redistribute it and/or
    * modify it under the terms of the GNU Lesser General Public
    * License as published by the Free Software Foundation; either
    * version 2.1 of the License, or (at your option) any later version.
    *
   * This library is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this library; if not, write to the
   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   * Boston, MA 02111-1307, USA.
   */
  
  /*
   * Modified by the Sable Research Group and others 1997-1999.  
   * See the 'credits' file distributed with Soot for the complete list of
   * contributors.  (Soot is distributed at http://www.sable.mcgill.ca/soot)
   */
  
  
  package soot;
  import java.io.File;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
  
  import soot.util.Chain;
Manages the SootClasses of the application being analyzed.
  
  public class Scene  //extends AbstractHost
  {
      public Scene ( Singletons.Global g )
      {
      	setReservedNames();
      	
          // load soot.class.path system property, if defined
          String scp = System.getProperty("soot.class.path");
  
          if (scp != null)
              setSootClassPath(scp);
  
          .add. );
          .add. );
          .add. );
          .add. );
          .add. );
          .add. );
          .add. );
          .add. );
          .add. );
          .add. );
          .add. );
  
          addSootBasicClasses();
          
          determineExcludedPackages();
      }
  	private void determineExcludedPackages() {
          if (Options.v().exclude() != null)
              .addAll(Options.v().exclude());
  
          if( !Options.v().include_all() ) {
              .add("java.");
              .add("sun.");
              .add("javax.");
              .add("com.sun.");
             .add("com.ibm.");
             .add("org.xml.");
             .add("org.w3c.");
             .add("apple.awt.");
             .add("com.apple.");
         }
 	}
     public static Scene  v() { return G.v().soot_Scene (); }
     
     Chain<SootClassclasses = new HashChain<SootClass>();
     
     private final Map<String,TypenameToClass = new HashMap<String,Type>();
 
     Numberer unitNumberer = new MapNumberer();
     Numberer contextNumberer = null;
 
     private Hierarchy activeHierarchy;
     private CallGraph activeCallGraph;
     private List<SootMethodentryPoints;
 
     boolean allowsPhantomRefs = false;
 
     String sootClassPath = null;
 
     // Two default values for constructing ExceptionalUnitGraphs:
     private ThrowAnalysis defaultThrowAnalysis = null;
     
     public void setMainClass(SootClass m)
     {
          = m;
         if(!m.declaresMethod(getSubSigNumberer().findOrAdd"void main(java.lang.String[])" ))) {
         	throw new RuntimeException("Main-class has no main method!");
         }
     }
     
     Set<StringreservedNames = new HashSet<String>();
    
    
Returns a set of tokens which are reserved. Any field, class, method, or local variable with such a name will be quoted.
 
      
     public Set<StringgetReservedNames()
     {
         return ;
     }
    
    
If this name is in the set of reserved names, then return a quoted version of it. Else pass it through.
 
     
     public String quotedNameOf(String s)
     {
         if(.contains(s))
             return "\'" + s + "\'";
         else
             return s;
     }
     
     public boolean hasMainClass() {
         if( == null) {
         	setMainClassFromOptions();
         }
         return !=null;
     }
     
     public SootClass getMainClass()
     {
         if(!hasMainClass())
             throw new RuntimeException("There is no main class set!");
             
         return ;
     }
     public SootMethod getMainMethod() {
         if(==null) {
             throw new RuntimeException("There is no main class set!");
         } 
         if (!.declaresMethod ("main"new SingletonList( ArrayType.v(RefType.v("java.lang.String"), 1) ), VoidType.v())) {
             throw new RuntimeException("Main class declares no main method!");
         }
         return .getMethod ("main"new SingletonList( ArrayType.v(RefType.v("java.lang.String"), 1) ), VoidType.v());   
     }
     
     
     public void setSootClassPath(String p)
     {
          = p;
         SourceLocator.v().invalidateClassPath();
     }
     
     public String getSootClassPath()
     {
         if == null ) {
             String optionscp = Options.v().soot_classpath();
             ifoptionscp.length() > 0 )
                  = optionscp;
 
             String defaultSootClassPath = defaultClassPath();
 	
 	        //if no classpath is given on the command line, take the default
 	        if == null ) {
 	        	 = defaultSootClassPath;
 	        } else {
 	        	//if one is given...
 	            if(Options.v().prepend_classpath()) {
 	            	//if the prepend flag is set, append the default classpath
 	            	 += . + defaultSootClassPath;
 	            } 
 	            //else, leave it as it is
 	        }        
         }
 
         return ;
     }
     
 	public String defaultClassPath() {
 		StringBuffer sb = new StringBuffer();
 		sb.append(System.getProperty("java.class.path")+.);
         if(System.getProperty("os.name").equals("Mac OS X")) {
 	        //in Mac OS X, rt.jar is split into classes.jar and ui.jar
 	        sb.append(.);
 	        sb.append(System.getProperty("java.home"));
 	        sb.append(.);
 	        sb.append("..");
 	        sb.append(.);
 	        sb.append("Classes");
 	        sb.append(.);
 	        sb.append("classes.jar");
 	
 	        sb.append(.);
 	        sb.append(System.getProperty("java.home"));
 	        sb.append(.);
 	        sb.append("..");
 	        sb.append(.);
 	        sb.append("Classes");
 	        sb.append(.);
 	        sb.append("ui.jar");
 
 
         } else {
             sb.append(.);
             sb.append(System.getProperty("java.home"));
             sb.append(.);
             sb.append("lib");
             sb.append(.);
             sb.append("rt.jar");
         }
         
 		if(Options.v().whole_program() || Options.v().output_format()==.) {
 			//add jce.jar, which is necessary for whole program mode
 			//(java.security.Signature from rt.jar import javax.crypto.Cipher from jce.jar            	
 				System.getProperty("java.home")+.+"lib"+.+"jce.jar");
 		}
 		
 		return sb.toString();
 	}
 
 
     private int stateCount;
     public int getState() { return this.; }
     private void modifyHierarchy() {
         ++;
          = null;
          = null;
          = null;
          = null;
     }
 
     public void addClass(SootClass c
     {
         if(c.isInScene())
             throw new RuntimeException("already managed: "+c.getName());
 
         if(containsClass(c.getName()))
             throw new RuntimeException("duplicate class: "+c.getName());
 
         .add(c);
         c.setLibraryClass();
 
         .put(c.getName(), c.getType());
         c.getType().setSootClass(c);
         c.setInScene(true);
         modifyHierarchy();
     }
 
     public void removeClass(SootClass c)
     {
         if(!c.isInScene())
             throw new RuntimeException();
 
         .remove(c);
         
         if(c.isLibraryClass()) {
             .remove(c);
         } else if(c.isPhantomClass()) {
             .remove(c);
         } else if(c.isApplicationClass()) {
             .remove(c);
         }
         
         c.getType().setSootClass(null);
         c.setInScene(false);
         modifyHierarchy();
     }
 
     public boolean containsClass(String className)
     {
         RefType type = (RefType.get(className);
         iftype == null ) return false;
         if( !type.hasSootClass() ) return false;
         SootClass c = type.getSootClass();
         return c.isInScene();
     }
     
     public boolean containsType(String className)
     {
         return .containsKey(className);
     }
 
     public String signatureToClass(String sig) {
         ifsig.charAt(0) != '<' ) throw new RuntimeException("oops "+sig);
         ifsig.charAt(sig.length()-1) != '>' ) throw new RuntimeException("oops "+sig);
         int index = sig.indexOf":" );
         ifindex < 0 ) throw new RuntimeException("oops "+sig);
         return sig.substring(1,index);
     }
 
     public String signatureToSubsignature(String sig) {
         ifsig.charAt(0) != '<' ) throw new RuntimeException("oops "+sig);
         ifsig.charAt(sig.length()-1) != '>' ) throw new RuntimeException("oops "+sig);
         int index = sig.indexOf":" );
         ifindex < 0 ) throw new RuntimeException("oops "+sig);
         return sig.substring(index+2,sig.length()-1);
     }
 
     private SootField grabField(String fieldSignature)
     {
         String cname = signatureToClassfieldSignature );
         String fname = signatureToSubsignaturefieldSignature );
         if( !containsClass(cname) ) return null;
         SootClass c = getSootClass(cname);
         if( !c.declaresFieldfname ) ) return null;
         return c.getFieldfname );
     }
 
     public boolean containsField(String fieldSignature)
     {
         return grabField(fieldSignature) != null;
     }
     
     private SootMethod grabMethod(String methodSignature)
     {
         String cname = signatureToClassmethodSignature );
         String mname = signatureToSubsignaturemethodSignature );
         if( !containsClass(cname) ) return null;
         SootClass c = getSootClass(cname);
         if( !c.declaresMethodmname ) ) return null;
         return c.getMethodmname );
     }
 
     public boolean containsMethod(String methodSignature)
     {
         return grabMethod(methodSignature) != null;
     }
 
     public SootField getField(String fieldSignature)
     {
         SootField f = grabFieldfieldSignature );
         if (f != null)
             return f;
 
         throw new RuntimeException("tried to get nonexistent field "+fieldSignature);
     }
 
     public SootMethod getMethod(String methodSignature)
     {
         SootMethod m = grabMethodmethodSignature );
         if (m != null)
             return m;
         throw new RuntimeException("tried to get nonexistent method "+methodSignature);
     }

    
Attempts to load the given class and all of the required support classes. Returns the original class if it was loaded, or null otherwise.
 
      
     public SootClass tryLoadClass(String classNameint desiredLevel
     {   
         /*
         if(Options.v().time())
             Main.v().resolveTimer.start();
         */
         
         setPhantomRefs(true);
         //SootResolver resolver = new SootResolver();
         if( !getPhantomRefs() 
         && SourceLocator.v().getClassSource(className) == null ) {
             setPhantomRefs(false);
             return null;
         }
         SootResolver resolver = SootResolver.v();
         SootClass toReturn = resolver.resolveClass(classNamedesiredLevel);
         setPhantomRefs(false);
 
         return toReturn;
         
         /*
         if(Options.v().time())
             Main.v().resolveTimer.end(); */
     }
    
    
Loads the given class and all of the required support classes. Returns the first class.
 
      
     public SootClass loadClassAndSupport(String className
     {
         SootClass ret = loadClass(className.);
         if( !ret.isPhantom() ) ret = loadClass(className.);
         return ret;
     }
 
     public SootClass loadClass(String classNameint desiredLevel
     {   
         /*
         if(Options.v().time())
             Main.v().resolveTimer.start();
         */
         
         setPhantomRefs(true);
         //SootResolver resolver = new SootResolver();
         SootResolver resolver = SootResolver.v();
         SootClass toReturn = resolver.resolveClass(classNamedesiredLevel);
         setPhantomRefs(false);
 
         return toReturn;
         
         /*
         if(Options.v().time())
             Main.v().resolveTimer.end(); */
     }
    
    
Returns the RefType with the given className.

Throws:
java.lang.IllegalStateException if the RefType for this class cannot be found. Use containsType(java.lang.String) to check if type is registered
 
     public RefType getRefType(String className
     {
         RefType refType = (RefType.get(className);
         if(refType==null) {
         	throw new IllegalStateException("RefType "+className+" not loaded. " +
         			"If you tried to get the RefType of a library class, did you call loadNecessaryClasses()? " +
         			"Otherwise please check Soot's classpath.");
         }
 		return refType;
     }
    
    
Returns the RefType for java.lang.Object.
 
     public RefType getObjectType() {
     	return getRefType("java.lang.Object");
     }

    
Returns the RefType with the given className.
 
     public void addRefType(RefType type
     {
         .put(type.getClassName(), type);
     }

    
Returns the SootClass with the given className.
 
 
 	public SootClass getSootClass(String className) {
 		RefType type = (RefType.get(className);
 		SootClass toReturn = null;
 		if (type != null)
 			toReturn = type.getSootClass();
 
 		if (toReturn != null) {
 			return toReturn;
 		} else if (allowsPhantomRefs() ||
 			SootClass c = new SootClass(className);
 			c.setPhantom(true);
 			return c;
 		} else {
 			throw new RuntimeException(System.getProperty("line.separator")
 					+ "Aborting: can't find classfile " + className);
 		}
 	}

    
Returns an backed chain of the classes in this manager.
 
      
     public Chain<SootClassgetClasses()
     {
         return ;
     }
 
     /* The four following chains are mutually disjoint. */

    
Returns a chain of the application classes in this scene. These classes are the ones which can be freely analysed & modified.
 
     {
         return ;
     }

    
Returns a chain of the library classes in this scene. These classes can be analysed but not modified.
 
     public Chain<SootClassgetLibraryClasses()
     {
         return ;
     }

    
Returns a chain of the phantom classes in this scene. These classes are referred to by other classes, but cannot be loaded.
 
     public Chain<SootClassgetPhantomClasses()
     {
         return ;
     }
 
     {
         if (c.isApplicationClass())
             return getApplicationClasses();
         else if (c.isLibraryClass())
             return getLibraryClasses();
         else if (c.isPhantomClass())
             return getPhantomClasses();
 
         return null;
     }

    
/
 
    
Retrieves the active side-effect analysis
 
 
     {
         if(!hasSideEffectAnalysis()) {
 			getCallGraph() ) );
 	}
             
         return ;
     }
    
    
Sets the active side-effect analysis
 
      
     public void setSideEffectAnalysis(SideEffectAnalysis sea)
     {
          = sea;
     }
 
     public boolean hasSideEffectAnalysis()
     {
         return  != null;
     }
     
     public void releaseSideEffectAnalysis()
     {
          = null;
     }

    
/
 
    
Retrieves the active pointer analysis
 
 
     {
         if(!hasPointsToAnalysis()) {
 	    return DumbPointerAnalysis.v();
 	}
             
         return ;
     }
    
    
Sets the active pointer analysis
 
      
     public void setPointsToAnalysis(PointsToAnalysis pa)
     {
          = pa;
     }
 
     public boolean hasPointsToAnalysis()
     {
         return  != null;
     }
     
     public void releasePointsToAnalysis()
     {
          = null;
     }

    
/
 
    
Makes a new fast hierarchy is none is active, and returns the active fast hierarchy.
 
 	if(!hasFastHierarchy() ) {
 	    setFastHierarchynew FastHierarchy() );
 	}
 	return getFastHierarchy();
     }
    
Retrieves the active fast hierarchy
 
 
     public FastHierarchy getFastHierarchy() 
     {
         if(!hasFastHierarchy())
             throw new RuntimeException("no active FastHierarchy present for scene");
             
         return ;
     }
    
    
Sets the active hierarchy
 
      
     public void setFastHierarchy(FastHierarchy hierarchy)
     {
          = hierarchy;
     }
 
     public boolean hasFastHierarchy()
     {
         return  != null;
     }
     
     public void releaseFastHierarchy()
     {
          = null;
     }

    
/
 
    
Retrieves the active hierarchy
 
 
     public Hierarchy getActiveHierarchy() 
     {
         if(!hasActiveHierarchy())
             //throw new RuntimeException("no active Hierarchy present for scene");
             setActiveHierarchynew Hierarchy() );
             
         return ;
     }
    
    
Sets the active hierarchy
 
      
     public void setActiveHierarchy(Hierarchy hierarchy)
     {
          = hierarchy;
     }
 
     public boolean hasActiveHierarchy()
     {
         return  != null;
     }
     
     public void releaseActiveHierarchy()
     {
          = null;
     }
 
     public boolean hasCustomEntryPoints() {
     	return !=null;
     }
    
    
Get the set of entry points that are used to build the call graph.
 
     public List<SootMethodgetEntryPoints() {
         if == null ) {
              = EntryPoints.v().all();
         }
         return ;
     }

    
Change the set of entry point methods used to build the call graph.
 
     public void setEntryPointsList<SootMethodentryPoints ) {
         this. = entryPoints;
     }
 
     private ContextSensitiveCallGraph cscg;
         if( == nullthrow new RuntimeException("No context-sensitive call graph present in Scene. You can bulid one with Paddle.");
         return ;
     }
 
         this. = cscg;
     }
 
     public CallGraph getCallGraph() 
     {
         if(!hasCallGraph()) {
             throw new RuntimeException"No call graph present in Scene. Maybe you want Whole Program mode (-w)." );
         }
             
         return ;
     }
     
     public void setCallGraph(CallGraph cg)
     {
          = null;
          = cg;
     }
 
     public boolean hasCallGraph()
     {
         return  != null;
     }
     
     public void releaseCallGraph()
     {
          = null;
          = null;
     }
         if == null ) {
              = new ReachableMethods(
                     getCallGraph(), new ArrayList<MethodOrMethodContext>(getEntryPoints()) );
         }
         .update();
         return ;
     }
     public void setReachableMethodsReachableMethods rm ) {
          = rm;
     }
     public boolean hasReachableMethods() {
         return  != null;
     }
     public void releaseReachableMethods() {
          = null;
     }
    
     public boolean getPhantomRefs()
     {
         //if( !Options.v().allow_phantom_refs() ) return false;
         //return allowsPhantomRefs;
     	return Options.v().allow_phantom_refs();
     }
 
     public void setPhantomRefs(boolean value)
     {
          = value;
     }
     
     public boolean allowsPhantomRefs()
     {
         return getPhantomRefs();
     }
     public Numberer kindNumberer() { return ; }
     public ArrayNumberer getTypeNumberer() { return ; }
     public ArrayNumberer getMethodNumberer() { return ; }
     public Numberer getContextNumberer() { return ; }
     public Numberer getUnitNumberer() { return ; }
     public ArrayNumberer getFieldNumberer() { return ; }
     public ArrayNumberer getClassNumberer() { return ; }
     public StringNumberer getSubSigNumberer() { return ; }
     public ArrayNumberer getLocalNumberer() { return ; }
 
     public void setContextNumbererNumberer n ) {
         if != null )
             throw new RuntimeException(
                     "Attempt to set context numberer when it is already set." );
          = n;
     }

    
Returns the soot.toolkits.exceptions.ThrowAnalysis to be used by default when constructing CFGs which include exceptional control flow.

 
     {
 	if == null ) {
 	    int optionsThrowAnalysis = Options.v().throw_analysis();
 	    switch (optionsThrowAnalysis) {
 		 = PedanticThrowAnalysis.v();
 		break;
 		 = UnitThrowAnalysis.v();
 		break;
 	    default:
 		throw new IllegalStateException("Options.v().throw_analysi() == " +
 						Options.v().throw_analysis());
 	    }
 	}
     }

    
Sets the soot.toolkits.exceptions.ThrowAnalysis to be used by default when constructing CFGs which include exceptional control flow.

 
     public void setDefaultThrowAnalysis(ThrowAnalysis ta
     {
     }
 
     private void setReservedNames()
     {
         Set<Stringrn = getReservedNames();        
         rn.add("newarray");
         rn.add("newmultiarray");
         rn.add("nop");
         rn.add("ret");
         rn.add("specialinvoke");
         rn.add("staticinvoke");
         rn.add("tableswitch");
         rn.add("virtualinvoke");
         rn.add("null_type");
         rn.add("unknown");
         rn.add("cmp");
         rn.add("cmpg");
         rn.add("cmpl");
         rn.add("entermonitor");
         rn.add("exitmonitor");
         rn.add("interfaceinvoke");
         rn.add("lengthof");
         rn.add("lookupswitch");
         rn.add("neg");
         rn.add("if");
         rn.add("abstract");
         rn.add("annotation");
         rn.add("boolean");
         rn.add("break");
         rn.add("byte");
         rn.add("case");
         rn.add("catch");
         rn.add("char");
         rn.add("class");
         rn.add("final");
         rn.add("native");
         rn.add("public");
         rn.add("protected");
         rn.add("private");
         rn.add("static");
         rn.add("synchronized");
         rn.add("transient");
         rn.add("volatile");
         rn.add("interface");
         rn.add("void");
         rn.add("short");
         rn.add("int");
         rn.add("long");
         rn.add("float");
         rn.add("double");
         rn.add("extends");
         rn.add("implements");
         rn.add("breakpoint");
         rn.add("default");
         rn.add("goto");
         rn.add("instanceof");
         rn.add("new");
         rn.add("return");
         rn.add("throw");
         rn.add("throws");
         rn.add("null");
         rn.add("from");
         rn.add("to");
     }
 
     private final Set<String>[] basicclasses=new Set[4];
 
     private void addSootBasicClasses() {
         [.] = new HashSet<String>();
         [.] = new HashSet<String>();
         [.] = new HashSet<String>();
 
 	addBasicClass("java.lang.Object");
 	addBasicClass("java.lang.Class".);
 
 	addBasicClass("java.lang.Void".);
 	addBasicClass("java.lang.Boolean".);
 	addBasicClass("java.lang.Byte".);
 	addBasicClass("java.lang.Character".);
 	addBasicClass("java.lang.Short".);
 	addBasicClass("java.lang.Integer".);
 	addBasicClass("java.lang.Long".);
 	addBasicClass("java.lang.Float".);
 	addBasicClass("java.lang.Double".);
 
 	addBasicClass("java.lang.String");
 	addBasicClass("java.lang.StringBuffer".);
 
 	addBasicClass("java.lang.Error");
 	addBasicClass("java.lang.AssertionError".);
 	addBasicClass("java.lang.Throwable".);
 	addBasicClass("java.lang.NoClassDefFoundError".);
 	addBasicClass("java.lang.ExceptionInInitializerError");
 	addBasicClass("java.lang.RuntimeException");
 	addBasicClass("java.lang.ClassNotFoundException");
 	addBasicClass("java.lang.ArithmeticException");
 	addBasicClass("java.lang.ArrayStoreException");
 	addBasicClass("java.lang.ClassCastException");
 	addBasicClass("java.lang.IllegalMonitorStateException");
 	addBasicClass("java.lang.IndexOutOfBoundsException");
 	addBasicClass("java.lang.ArrayIndexOutOfBoundsException");
 	addBasicClass("java.lang.NegativeArraySizeException");
 	addBasicClass("java.lang.NullPointerException");
 	addBasicClass("java.lang.InstantiationError");
 	addBasicClass("java.lang.InternalError");
 	addBasicClass("java.lang.OutOfMemoryError");
 	addBasicClass("java.lang.StackOverflowError");
 	addBasicClass("java.lang.UnknownError");
 	addBasicClass("java.lang.ThreadDeath");
 	addBasicClass("java.lang.ClassCircularityError");
 	addBasicClass("java.lang.ClassFormatError");
 	addBasicClass("java.lang.IllegalAccessError");
 	addBasicClass("java.lang.IncompatibleClassChangeError");
 	addBasicClass("java.lang.LinkageError");
 	addBasicClass("java.lang.VerifyError");
 	addBasicClass("java.lang.NoSuchFieldError");
 	addBasicClass("java.lang.AbstractMethodError");
 	addBasicClass("java.lang.NoSuchMethodError");
 	addBasicClass("java.lang.UnsatisfiedLinkError");
 
 	addBasicClass("java.lang.Thread");
 	addBasicClass("java.lang.Runnable");
 	addBasicClass("java.lang.Cloneable");
 
 	addBasicClass("java.io.Serializable");	
 
 	// RoboVM note: Not available in RoboVM
 //	addBasicClass("java.lang.ref.Finalizer");
 //	
 //	addBasicClass("java.dyn.InvokeDynamic");
 
     }
 
     public void addBasicClass(String name) {
     }
     
     public void addBasicClass(String name,int level) {
 	[level].add(name);
     }

    
Load just the set of basic classes soot needs, ignoring those specified on the command-line. You don't need to use both this and loadNecessaryClasses, though it will only waste time.
 
     public void loadBasicClasses() {
     	
 		for(int i=.;i>=.;i--) {
 		    for(String name[i]) {
 		    	tryLoadClass(name,i);
 		    }
 		}
     }
     
     public Set<StringgetBasicClasses() {
     	Set<Stringall = new HashSet<String>();
     	for(int i=0;i<.;i++) {
     		Set<Stringclasses = [i];
     		if(classes!=null)
    			all.addAll(classes);
    	}
		return all
    public Collection<SootClassdynamicClasses() {
    	if(==null) {
    		throw new IllegalStateException("Have to call loadDynamicClasses() first!");
    	}
        return ;
    }
    private void loadNecessaryClass(String name) {
        SootClass c;
        c = loadClassAndSupport(name);
        c.setApplicationClass();
    }
    
Load the set of classes that soot needs, including those specified on the command-line. This is the standard way of initialising the list of classes soot should use.
    public void loadNecessaryClasses() {
        Iterator<Stringit = Options.v().classes().iterator();
        while (it.hasNext()) {
            String name = (Stringit.next();
            loadNecessaryClass(name);
        }
        loadDynamicClasses();
        forIterator<StringpathIt = Options.v().process_dir().iterator(); pathIt.hasNext(); ) {
            final String path = (StringpathIt.next();
            for (String cl : SourceLocator.v().getClassesUnder(path)) {
                loadClassAndSupport(cl).setApplicationClass();
            }
        }
        prepareClasses();
        // RoboVM note: In RoboVM we're never done resolving
        //setDoneResolving();
    }
    public void loadDynamicClasses() {
         = new ArrayList<SootClass>();
        HashSet<StringdynClasses = new HashSet<String>();
        dynClasses.addAll(Options.v().dynamic_class());
        forIterator<StringpathIt = Options.v().dynamic_dir().iterator(); pathIt.hasNext(); ) {
            final String path = (StringpathIt.next();
            dynClasses.addAll(SourceLocator.v().getClassesUnder(path));
        }
        forIterator<StringpkgIt = Options.v().dynamic_package().iterator(); pkgIt.hasNext(); ) {
            final String pkg = (StringpkgIt.next();
            dynClasses.addAll(SourceLocator.v().classesInDynamicPackage(pkg));
        }
        for (String className : dynClasses) {
            .addloadClassAndSupport(className) );
        }
        
        //remove non-concrete classes that may accidentally have been loaded
        for (Iterator<SootClassiterator = .iterator(); iterator.hasNext();) {
			SootClass c = iterator.next();
			if(!c.isConcrete()) {
				if(Options.v().verbose()) {
					G.v()..println("Warning: dynamic class "+c.getName()+" is abstract or an interface, and it will not be considered.");
				iterator.remove();
    }
    /* Generate classes to process, adding or removing package marked by
     * command line options. 
     */
    private void prepareClasses() {
        // Remove/add all classes from packageInclusionMask as per -i option
        Chain<SootClassprocessedClasses = new HashChain<SootClass>();
        while(true) {
            Chain<SootClassunprocessedClasses = new HashChain<SootClass>(getClasses());
            unprocessedClasses.removeAll(processedClasses);
            ifunprocessedClasses.isEmpty() ) break;
            processedClasses.addAll(unprocessedClasses);
            for (SootClass s : unprocessedClasses) {
                ifs.isPhantom() ) continue;
                if(Options.v().app()) {
                    s.setApplicationClass();
                }
                if (Options.v().classes().contains(s.getName())) {
                    s.setApplicationClass();
                    continue;
                }
                forIterator<StringpkgIt = .iterator(); pkgIt.hasNext(); ) {
                    final String pkg = (StringpkgIt.next();
                    if (s.isApplicationClass()
                    && (s.getPackageName()+".").startsWith(pkg)) {
                            s.setLibraryClass();
                    }
                }
                forIterator<StringpkgIt = Options.v().include().iterator(); pkgIt.hasNext(); ) {
                    final String pkg = (StringpkgIt.next();
                    if ((s.getPackageName()+".").startsWith(pkg))
                        s.setApplicationClass();
                }
                if(s.isApplicationClass()) {
                    // make sure we have the support
                    loadClassAndSupport(s.getName());
                }
            }
        }
    }
    public boolean isExcluded(SootClass sc) {
    	String name = sc.getName();
    	for(String pkg){
			if(name.startsWith(pkg)) {
    			return true;
    		}
    	}
		return false;
    public void setPkgList(ArrayList<Stringlist){
         = list;
    }
    public ArrayList<StringgetPkgList(){
        return ;
    }


    
Create an unresolved reference to a method.
    public SootMethodRef makeMethodRef
            SootClass declaringClass,
            String name,
            List<TypeparameterTypes,
            Type returnType,
            boolean isStatic ) {
        return new SootMethodRefImpl(declaringClassnameparameterTypes,
                returnTypeisStatic);
    }

    
Create an unresolved reference to a constructor.
            SootClass declaringClass,
            List<TypeparameterTypes) {
        return makeMethodRef(declaringClass.
                                         parameterTypes, VoidType.v(), false );
    }


    
Create an unresolved reference to a field.
    public SootFieldRef makeFieldRef
            SootClass declaringClass,
            String name,
            Type type,
            boolean isStatic) {
        return new AbstractSootFieldRef(declaringClassnametypeisStatic);
    }
    
Returns the list of SootClasses that have been resolved at least to the level specified.
    public List/*SootClass*/<SootClassgetClasses(int desiredLevel) {
        List<SootClassret = new ArrayList<SootClass>();
        forIterator<SootClassclIt = getClasses().iterator(); clIt.hasNext(); ) {
            final SootClass cl = (SootClassclIt.next();
            ifcl.resolvingLevel() >=