|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jcoverage.coverage.InstrumentMethodGen
Add bytecode instrumentation to the method.
Field Summary | |
(package private) ClassGenHelper |
classGenHelper
|
(package private) java.util.Set |
conditionals
The set of "conditionals" (@see Conditional). |
(package private) org.apache.oro.text.regex.Pattern |
ignoreRegex
|
(package private) static org.apache.log4j.Logger |
logger
|
(package private) MethodGenHelper |
methodGenHelper
|
(package private) org.apache.bcel.classfile.Method |
original
|
(package private) org.apache.oro.text.regex.Perl5Matcher |
pm
|
(package private) java.util.Set |
sourceLineNumbers
The set of "valid" source lines. |
Constructor Summary | |
(package private) |
InstrumentMethodGen(org.apache.bcel.classfile.Method original,
org.apache.bcel.generic.ClassGen cg,
java.lang.String ignoreRegex)
|
Method Summary | |
(package private) void |
addIfInstruction(org.apache.bcel.generic.LineNumberGen lng,
org.apache.bcel.generic.IfInstruction ifInstruction)
We've found a conditional branch instruction. |
void |
addInstrumentation()
The entry point for this class. |
(package private) void |
addInstrumentation(org.apache.bcel.generic.LineNumberGen lng)
Add coverage instrumentation to the instructions representing a line of Java source code. |
(package private) void |
addInstrumentation(org.apache.bcel.generic.LineNumberGen[] lineNumberTable)
|
(package private) void |
addSourceLine(org.apache.bcel.generic.LineNumberGen lng)
We only record the set of "valid" source lines. |
(package private) org.apache.bcel.generic.InstructionList |
emitGetInstrumentationAndTouchLine(org.apache.bcel.generic.LineNumberGen lng)
The core instrumentation. |
(package private) java.util.Set |
getConditionals()
This method is used internally to calculate the branch coverage rate for this method. |
(package private) java.util.Set |
getSourceLineNumbers()
|
(package private) void |
handleIfInstruction(org.apache.bcel.generic.LineNumberGen lng)
|
(package private) boolean |
hasIgnoreRegex()
|
(package private) boolean |
isIgnorable(ClassGenHelper helper,
org.apache.bcel.generic.InstructionHandle handle)
We currently only ignore those invoke instructions that are from a matching regular regular expression. |
(package private) boolean |
isIgnorable(ClassGenHelper helper,
org.apache.bcel.generic.LineNumberGen lng)
We can ignore (for the purposes of instrumentation) any set of instructions which are on our ignore list. |
(package private) void |
updateTargeters(org.apache.bcel.generic.InstructionHandle oldTarget,
org.apache.bcel.generic.InstructionHandle newTarget)
Inserting coverage instrumentation to a method, inserts additional code into the instrumented class. |
(package private) void |
updateTargeters(org.apache.bcel.generic.InstructionHandle oldTarget,
org.apache.bcel.generic.InstructionHandle newTarget,
org.apache.bcel.generic.InstructionTargeter targeter)
|
(package private) void |
updateTargeters(org.apache.bcel.generic.InstructionHandle oldTarget,
org.apache.bcel.generic.InstructionHandle newTarget,
org.apache.bcel.generic.InstructionTargeter[] targeters)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static final org.apache.log4j.Logger logger
final org.apache.bcel.classfile.Method original
final MethodGenHelper methodGenHelper
final ClassGenHelper classGenHelper
final java.util.Set conditionals
final java.util.Set sourceLineNumbers
final org.apache.oro.text.regex.Perl5Matcher pm
org.apache.oro.text.regex.Pattern ignoreRegex
Constructor Detail |
InstrumentMethodGen(org.apache.bcel.classfile.Method original, org.apache.bcel.generic.ClassGen cg, java.lang.String ignoreRegex)
Method Detail |
void updateTargeters(org.apache.bcel.generic.InstructionHandle oldTarget, org.apache.bcel.generic.InstructionHandle newTarget, org.apache.bcel.generic.InstructionTargeter targeter)
void updateTargeters(org.apache.bcel.generic.InstructionHandle oldTarget, org.apache.bcel.generic.InstructionHandle newTarget, org.apache.bcel.generic.InstructionTargeter[] targeters)
void updateTargeters(org.apache.bcel.generic.InstructionHandle oldTarget, org.apache.bcel.generic.InstructionHandle newTarget)
oldTarget
. Adjusting the targeters to
newTarget
(the start of where the instrumentation
has been added) ensures that the instrumentation is invoked as
the original code would have been.
boolean isIgnorable(ClassGenHelper helper, org.apache.bcel.generic.InstructionHandle handle)
boolean hasIgnoreRegex()
boolean isIgnorable(ClassGenHelper helper, org.apache.bcel.generic.LineNumberGen lng)
void addIfInstruction(org.apache.bcel.generic.LineNumberGen lng, org.apache.bcel.generic.IfInstruction ifInstruction)
lng
- the line number that we found the branch instructionifInstruction
- the actual if
instructionvoid handleIfInstruction(org.apache.bcel.generic.LineNumberGen lng)
void addInstrumentation(org.apache.bcel.generic.LineNumberGen lng)
org.apache.bcel.generic.InstructionList emitGetInstrumentationAndTouchLine(org.apache.bcel.generic.LineNumberGen lng)
void addSourceLine(org.apache.bcel.generic.LineNumberGen lng)
addSourceLine
is only
called if the source line represented by lng
is a
"real" line of code.
void addInstrumentation(org.apache.bcel.generic.LineNumberGen[] lineNumberTable)
public void addInstrumentation()
java.util.Set getSourceLineNumbers()
java.util.Set getConditionals()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |