com.ibm.wala.classLoader
Class SyntheticMethod

java.lang.Object
  extended by com.ibm.wala.classLoader.SyntheticMethod
All Implemented Interfaces:
IMember, IMethod, ContextItem, IClassHierarchyDweller
Direct Known Subclasses:
AbstractReflectionInterpreter.SpecializedMethod, AbstractRootMethod, CommandInterpreter.SpecializedExecuteMethod, SummarizedMethod

public class SyntheticMethod
extends java.lang.Object
implements IMethod

An implementation of IMethod, usually for a synthesized method that is not read directly from any source Module.


Field Summary
protected  IClass declaringClass
           
static SSAInstruction[] NO_STATEMENTS
           
protected  IMethod resolvedMethod
           
 
Constructor Summary
SyntheticMethod(IMethod method, IClass declaringClass, boolean isStatic, boolean isFactory)
           
SyntheticMethod(MethodReference method, IClass declaringClass, boolean isStatic, boolean isFactory)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 BytecodeStream getBytecodeStream()
           
 IClassHierarchy getClassHierarchy()
           
 TypeReference[] getDeclaredExceptions()
           
 IClass getDeclaringClass()
          Return the object that represents the declaring class for this member.
 Descriptor getDescriptor()
          something like: (IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;
 int getLineNumber(int bcIndex)
           
 java.lang.String getLocalVariableName(int bcIndex, int localNumber)
           
 int getMaxLocals()
           
 int getMaxStackHeight()
           
 Atom getName()
           
 int getNumberOfParameters()
          Method getNumberOfParameters.
 TypeReference getParameterType(int i)
          By convention, for a non-static method, getParameterType(0) is the this pointer
 java.lang.String getPoison()
           
 byte getPoisonLevel()
           
 MethodReference getReference()
           
 TypeReference getReturnType()
           
 Selector getSelector()
          something like: foo(Ljava/langString;)Ljava/lang/Class;
 java.lang.String getSignature()
          something like: com.foo.bar.createLargeOrder(IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;
 SSAInstruction[] getStatements()
           
 SSAInstruction[] getStatements(SSAOptions options)
          Deprecated. 
 boolean hasExceptionHandler()
           
 int hashCode()
           
 boolean hasLocalVariableTable()
           
 boolean hasPoison()
           
 boolean isAbstract()
          Is this method abstract?
 boolean isBridge()
          Is this method a bridge method? See JLS 3rd Edition 15.12.4.5
 boolean isClinit()
          Is this method a class initializer?
 boolean isFactoryMethod()
           
 boolean isFinal()
          Is this method final?
 boolean isInit()
          Is this method an object initializer?
 boolean isNative()
          Is this method native?
 boolean isPrivate()
          Is this method private?
 boolean isProtected()
          Is this method protected?
 boolean isPublic()
          Is this method public?
 boolean isStatic()
          Is this member static?
 boolean isSynchronized()
          Is this method synchronized?
 boolean isSynthetic()
          Did someone synthesize this method? (As opposed to reading it from a class file)
 InducedCFG makeControlFlowGraph(SSAInstruction[] instructions)
          Create an InducedCFG from an instruction array.
 IR makeIR(Context context, SSAOptions options)
          Most subclasses should override this.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_STATEMENTS

public static final SSAInstruction[] NO_STATEMENTS

resolvedMethod

protected final IMethod resolvedMethod

declaringClass

protected final IClass declaringClass
Constructor Detail

SyntheticMethod

public SyntheticMethod(MethodReference method,
                       IClass declaringClass,
                       boolean isStatic,
                       boolean isFactory)

SyntheticMethod

public SyntheticMethod(IMethod method,
                       IClass declaringClass,
                       boolean isStatic,
                       boolean isFactory)
Method Detail

isClinit

public boolean isClinit()
Description copied from interface: IMethod
Is this method a class initializer?

Specified by:
isClinit in interface IMethod
See Also:
IMethod.isClinit()

isInit

public boolean isInit()
Description copied from interface: IMethod
Is this method an object initializer?

Specified by:
isInit in interface IMethod
See Also:
IMethod.isInit()

isStatic

public boolean isStatic()
Description copied from interface: IMember
Is this member static?

Specified by:
isStatic in interface IMember
See Also:
IMember.isStatic()

isNative

public boolean isNative()
Description copied from interface: IMethod
Is this method native?

Specified by:
isNative in interface IMethod
See Also:
IMethod.isNative()

isAbstract

public boolean isAbstract()
Description copied from interface: IMethod
Is this method abstract?

Specified by:
isAbstract in interface IMethod
See Also:
IMethod.isAbstract()

isPrivate

public boolean isPrivate()
Description copied from interface: IMethod
Is this method private?

Specified by:
isPrivate in interface IMethod
See Also:
IMethod.isPrivate()

isProtected

public boolean isProtected()
Description copied from interface: IMethod
Is this method protected?

Specified by:
isProtected in interface IMethod

isPublic

public boolean isPublic()
Description copied from interface: IMethod
Is this method public?

Specified by:
isPublic in interface IMethod

isFinal

public boolean isFinal()
Description copied from interface: IMethod
Is this method final?

Specified by:
isFinal in interface IMethod
See Also:
IMethod.isFinal()

isBridge

public boolean isBridge()
Description copied from interface: IMethod
Is this method a bridge method? See JLS 3rd Edition 15.12.4.5

Specified by:
isBridge in interface IMethod
See Also:
IMethod.isBridge()

isSynchronized

public boolean isSynchronized()
Description copied from interface: IMethod
Is this method synchronized?

Specified by:
isSynchronized in interface IMethod
See Also:
IMethod.isAbstract()

isSynthetic

public boolean isSynthetic()
Description copied from interface: IMethod
Did someone synthesize this method? (As opposed to reading it from a class file)

Specified by:
isSynthetic in interface IMethod
See Also:
IMethod.isSynthetic()

getReference

public MethodReference getReference()
Specified by:
getReference in interface IMethod
Returns:
canonical MethodReference corresponding to this method
See Also:
IMethod.getReference()

makeControlFlowGraph

public InducedCFG makeControlFlowGraph(SSAInstruction[] instructions)
Create an InducedCFG from an instruction array. NOTE: SIDE EFFECT!!! ... nulls out phi instructions in the instruction array!


getBytecodeStream

public BytecodeStream getBytecodeStream()
                                 throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

getMaxLocals

public int getMaxLocals()
                 throws java.lang.UnsupportedOperationException
Specified by:
getMaxLocals in interface IMethod
Returns:
maximum number of JVM locals used by this method
Throws:
java.lang.UnsupportedOperationException

getMaxStackHeight

public int getMaxStackHeight()
                      throws java.lang.UnsupportedOperationException
Specified by:
getMaxStackHeight in interface IMethod
Returns:
maximum height of JVM stack used by this method
Throws:
java.lang.UnsupportedOperationException

getDeclaringClass

public IClass getDeclaringClass()
Description copied from interface: IMember
Return the object that represents the declaring class for this member.

Specified by:
getDeclaringClass in interface IMember
Returns:
the object that represents the declaring class for this member.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hasExceptionHandler

public boolean hasExceptionHandler()
Specified by:
hasExceptionHandler in interface IMethod
Returns:
true iff this method has at least one exception handler

hasPoison

public boolean hasPoison()

getPoison

public java.lang.String getPoison()

getPoisonLevel

public byte getPoisonLevel()

getStatements

@Deprecated
public SSAInstruction[] getStatements(SSAOptions options)
Deprecated. 


makeIR

public IR makeIR(Context context,
                 SSAOptions options)
          throws UnimplementedError
Most subclasses should override this.

Parameters:
context - TODO
options - options governing IR conversion
Throws:
UnimplementedError

getParameterType

public TypeReference getParameterType(int i)
Description copied from interface: IMethod
By convention, for a non-static method, getParameterType(0) is the this pointer

Specified by:
getParameterType in interface IMethod

getNumberOfParameters

public int getNumberOfParameters()
Description copied from interface: IMethod
Method getNumberOfParameters. This result includes the "this" pointer if applicable

Specified by:
getNumberOfParameters in interface IMethod
See Also:
IMethod.getNumberOfParameters()

getDeclaredExceptions

public TypeReference[] getDeclaredExceptions()
                                      throws InvalidClassFileException
Specified by:
getDeclaredExceptions in interface IMethod
Returns:
an array of the exception types declared by the throws clause for this method, or null if there are none
Throws:
InvalidClassFileException

getName

public Atom getName()
Specified by:
getName in interface IMember
Returns:
the name of this member

getDescriptor

public Descriptor getDescriptor()
Description copied from interface: IMethod
something like: (IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;

Specified by:
getDescriptor in interface IMethod

getLineNumber

public int getLineNumber(int bcIndex)
Specified by:
getLineNumber in interface IMethod
Returns:
the source line number corresponding to a particular bytecode index, or -1 if the information is not available.

isFactoryMethod

public boolean isFactoryMethod()

getSignature

public java.lang.String getSignature()
Description copied from interface: IMethod
something like: com.foo.bar.createLargeOrder(IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;

Specified by:
getSignature in interface IMethod

getSelector

public Selector getSelector()
Description copied from interface: IMethod
something like: foo(Ljava/langString;)Ljava/lang/Class;

Specified by:
getSelector in interface IMethod

getLocalVariableName

public java.lang.String getLocalVariableName(int bcIndex,
                                             int localNumber)
Specified by:
getLocalVariableName in interface IMethod
Returns:
the (source code) name of the local variable of a given number at the specified program counter, or null if the information is not available.

hasLocalVariableTable

public boolean hasLocalVariableTable()
Specified by:
hasLocalVariableTable in interface IMethod
Returns:
true iff the local variable table information for this method is available

getStatements

public SSAInstruction[] getStatements()

getReturnType

public TypeReference getReturnType()
Specified by:
getReturnType in interface IMethod
Returns:
the name of the return type for this method

getClassHierarchy

public IClassHierarchy getClassHierarchy()
Specified by:
getClassHierarchy in interface IClassHierarchyDweller