|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.brics.string.intermediate.Method
public class Method
A Java method.
A method has a body consisting of a list of statements, the first of which is called the entry statement. The statements are connected by control flow edges, forming a directed graph. The method's parameters are each represented by two variables: One referred to as the parameter, and one referred to as the parameter alias. When the body of a method assigns a new value to a parameter, it is the alias whose value is changed, such that the parameter variables always remember the original arguments to the method. The idea behind this is best illustrated with an example. Consider this small program:void foo(StringBuffer a) { a = new StringBuffer; corrupt a; return; } .. StringBuffer b = new StringBuffer; foo(b); // is b now corrupt??As the comment at the end suggests, we want to know which arguments might be corrupted by a method call. Therefore, at the pseudo-statement "corrupt a", we want to know whether or not "a" refers to one of the original arguments. In this case, the parameter alias "a" was reassigned and is no longer an alias for the parameter, so "b" was not corrupted.
Constructor Summary | |
---|---|
Method(Application application,
String name,
Variable[] params)
Creates a new method with the given name and parameters. |
Method Summary | |
---|---|
void |
addStatement(Statement s)
Adds the given statement to the list of statements for this method. |
Application |
getApplication()
Returns the application containing this method. |
List<Call> |
getCallSites()
Returns an (unmodifiable) list of all call sites calling this method. |
MethodHead |
getEntry()
Returns the entry point of this method. |
ExceptionalReturn |
getExceptionalReturn()
Gets the exceptional exit from this method. |
int |
getKey()
|
String |
getName()
Returns the name of this method. |
Variable[] |
getParamAlias()
Returns the list of alias variables for the method parameters, with non-null entries for mutables. |
List<Return> |
getReturns()
Returns the (unmodifiable) list of return points for this method. |
List<Statement> |
getStatements()
Returns the (unmodifiable) list of statements for this method. |
void |
removeNop(Nop s)
Removes the given Nop
statement from the body of this method. |
String |
toString()
Returns identifier of this method object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Method(Application application, String name, Variable[] params)
MethodHead
object is created
as the entry point for the method, inheriting the parameters.
Method Detail |
---|
public void addStatement(Statement s)
IllegalStateException
- if the statement is already added to a methodpublic Application getApplication()
public List<Call> getCallSites()
public MethodHead getEntry()
public ExceptionalReturn getExceptionalReturn()
public int getKey()
public String getName()
public Variable[] getParamAlias()
public List<Return> getReturns()
public List<Statement> getStatements()
public void removeNop(Nop s)
Nop
statement from the body of this method. All control flow
edges are updated accordingly.
public String toString()
toString
in class Object
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |