com.ibm.wala.classLoader
Class CodeScanner

java.lang.Object
  extended by com.ibm.wala.classLoader.CodeScanner

public class CodeScanner
extends java.lang.Object

Simple utilities to scan IMethods to gather information without building an IR.


Constructor Summary
CodeScanner()
           
 
Method Summary
static java.util.Collection<TypeReference> getArraysWritten(IMethod m)
          get the element types of the arrays that m may update
static java.util.List<TypeReference> getArraysWritten(SSAInstruction[] statements)
           
static java.util.Collection<CallSiteReference> getCallSites(IMethod m)
           
static java.util.Set getCaughtExceptions(IMethod m)
           
static java.util.Set<TypeReference> getCaughtExceptions(Language l, SSAInstruction[] statements)
           
static java.util.Collection<FieldReference> getFieldsRead(IMethod m)
           
static java.util.List<FieldReference> getFieldsRead(SSAInstruction[] statements)
           
static java.util.Collection<FieldReference> getFieldsWritten(IMethod m)
           
static java.util.List<FieldReference> getFieldsWritten(SSAInstruction[] statements)
           
static java.util.Collection<NewSiteReference> getNewSites(IMethod m)
           
static boolean hasObjectArrayLoad(IMethod m)
           
static boolean hasObjectArrayLoad(SSAInstruction[] statements)
           
static boolean hasObjectArrayStore(IMethod m)
           
static boolean hasObjectArrayStore(SSAInstruction[] statements)
           
static java.util.Iterator iterateCastTypes(IMethod m)
          Return the types this method may cast to
static java.util.Iterator<TypeReference> iterateCastTypes(SSAInstruction[] statements)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeScanner

public CodeScanner()
Method Detail

getCallSites

public static java.util.Collection<CallSiteReference> getCallSites(IMethod m)
                                                            throws InvalidClassFileException
Throws:
InvalidClassFileException
java.lang.IllegalArgumentException - if m is null

getFieldsRead

public static java.util.Collection<FieldReference> getFieldsRead(IMethod m)
                                                          throws InvalidClassFileException
Throws:
InvalidClassFileException
java.lang.IllegalArgumentException - if m is null

getFieldsWritten

public static java.util.Collection<FieldReference> getFieldsWritten(IMethod m)
                                                             throws InvalidClassFileException
Throws:
InvalidClassFileException
java.lang.IllegalArgumentException - if m is null

getArraysWritten

public static java.util.Collection<TypeReference> getArraysWritten(IMethod m)
                                                            throws InvalidClassFileException
get the element types of the arrays that m may update

Throws:
InvalidClassFileException

getNewSites

public static java.util.Collection<NewSiteReference> getNewSites(IMethod m)
                                                          throws InvalidClassFileException
Throws:
InvalidClassFileException
java.lang.IllegalArgumentException - if m is null

hasObjectArrayLoad

public static boolean hasObjectArrayLoad(IMethod m)
                                  throws InvalidClassFileException
Throws:
InvalidClassFileException

hasObjectArrayStore

public static boolean hasObjectArrayStore(IMethod m)
                                   throws InvalidClassFileException
Throws:
InvalidClassFileException

getCaughtExceptions

public static java.util.Set getCaughtExceptions(IMethod m)
                                         throws InvalidClassFileException
Throws:
InvalidClassFileException

iterateCastTypes

public static java.util.Iterator iterateCastTypes(IMethod m)
                                           throws InvalidClassFileException
Return the types this method may cast to

Returns:
iterator of TypeReference
Throws:
InvalidClassFileException
java.lang.IllegalArgumentException - if m is null

getCaughtExceptions

public static java.util.Set<TypeReference> getCaughtExceptions(Language l,
                                                               SSAInstruction[] statements)
                                                        throws java.lang.IllegalArgumentException
Returns:
Set
Throws:
java.lang.IllegalArgumentException - if statements == null

iterateCastTypes

public static java.util.Iterator<TypeReference> iterateCastTypes(SSAInstruction[] statements)
                                                          throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException - if statements == null

getFieldsRead

public static java.util.List<FieldReference> getFieldsRead(SSAInstruction[] statements)
                                                    throws java.lang.IllegalArgumentException
Parameters:
statements - list of ssa statements
Returns:
List of FieldReference
Throws:
java.lang.IllegalArgumentException - if statements == null

getFieldsWritten

public static java.util.List<FieldReference> getFieldsWritten(SSAInstruction[] statements)
                                                       throws java.lang.IllegalArgumentException
Parameters:
statements - list of ssa statements
Returns:
List of FieldReference
Throws:
java.lang.IllegalArgumentException - if statements == null

getArraysWritten

public static java.util.List<TypeReference> getArraysWritten(SSAInstruction[] statements)
                                                      throws java.lang.IllegalArgumentException
Parameters:
statements - list of ssa statements
Returns:
List of TypeReference
Throws:
java.lang.IllegalArgumentException - if statements == null

hasObjectArrayLoad

public static boolean hasObjectArrayLoad(SSAInstruction[] statements)
                                  throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

hasObjectArrayStore

public static boolean hasObjectArrayStore(SSAInstruction[] statements)
                                   throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException