sofya.apps.dejavu
Class BytecodeNodeComparer
java.lang.Object
sofya.apps.dejavu.NodeComparer
sofya.apps.dejavu.BytecodeNodeComparer
public class BytecodeNodeComparer
- extends NodeComparer
Implementation of NodeComparer
which uses the bytecode
instruction lists of two nodes to compare them for equivalence.
- Version:
- 10/13/2005
- Author:
- Sharat Narayan, Sriraam Natarajan, Alex Kinneer
Method Summary |
boolean |
compareNodes(java.lang.String methodName,
Node oldNode,
Node newNode)
Compares two blocks from the same method in different versions
of the program. |
java.lang.String |
getCallMethodName(java.lang.String methodName,
Node oldCallNode,
Node newCallNode)
Retrieves the name of the method called by a call node. |
void |
setComparisonClass(ClassPair clazz)
Sets the class from which node instruction lists are read
for comparison. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BytecodeNodeComparer
public BytecodeNodeComparer()
setComparisonClass
public void setComparisonClass(ClassPair clazz)
throws java.io.IOException
- Sets the class from which node instruction lists are read
for comparison.
- Overrides:
setComparisonClass
in class NodeComparer
- Parameters:
clazz
- Structure containing the name of the class and
the locations from which the class can be loaded in the respective
versions of the program.
- Throws:
java.io.IOException
- If both versions of the specified class cannot
be read. Either the name of the class is invalid or a path to one
or both of the versions of the class is invalid.
getCallMethodName
public java.lang.String getCallMethodName(java.lang.String methodName,
Node oldCallNode,
Node newCallNode)
throws MethodNotFoundException,
java.lang.IllegalArgumentException,
java.lang.NullPointerException
- Retrieves the name of the method called by a call node.
- Specified by:
getCallMethodName
in class NodeComparer
- Parameters:
methodName
- Name of the method containing the call node.oldCallNode
- Call node in the original graph from which the name
of the called method should be retrieved. May be null
if
newCallNode
is non-null
.newCallNode
- Call node in the modified graph from which the name
of the called method should be retrieved. May be null
if
oldCallNode
is non-null
.
- Returns:
- The name of the method which is called by the invoke instruction
contained in one of the given call nodes.
- Throws:
MethodNotFoundException
- If methodName
does not
refer to a method that can be found in either the original or modified
versions of the class.
java.lang.IllegalArgumentException
- If a node is not a call node.
java.lang.NullPointerException
- If both oldCallNode
and
newCallNode
are null
.
compareNodes
public boolean compareNodes(java.lang.String methodName,
Node oldNode,
Node newNode)
throws MethodNotFoundException,
java.lang.NullPointerException
- Compares two blocks from the same method in different versions
of the program.
- Specified by:
compareNodes
in class NodeComparer
- Parameters:
methodName
- Name of the method containing the blocks
to be compared.oldNode
- Block in the old version of the program to
be compared to newNode
.newNode
- Block in the new version of the program to
be compared to oldNode
.
- Returns:
true
if the two blocks are identical,
false
otherwise.
- Throws:
MethodNotFoundException
- If methodName
does not
refer to a valid method in the class.
java.lang.NullPointerException
- If either oldNode
or
newNode
is null
.