public class ClassMap extends java.lang.Object
This class is a container for informations gathered during class analyzing done by BuildClassMapClassVisitor
.
Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.lang.Integer> |
alreadyRegisteredEvents
Set of eventIds that has bean already registered.
|
private java.util.Set<java.lang.Integer> |
blockedLines
List of line numbers (not lineIds) of lines that are not allowed to contain touch-point.
|
private java.lang.String |
className |
private java.util.Map<java.lang.Integer,org.objectweb.asm.Label> |
eventId2label
Maps eventId to code label from BuildClassMapClassInstrumenter pass
|
private java.util.Map<java.lang.Integer,TouchPointDescriptor> |
eventId2touchPointDescriptor
We map every eventId that is connected to instruction that created touch-point to the touch-point
|
private java.util.Map<org.objectweb.asm.Label,java.util.Set<TouchPointDescriptor>> |
label2sourcePoints
Contains map of label into set of
JumpTouchPointDescriptor or SwitchTouchPointDescriptor that the label could be destination of
The labels used here are Label created during BuildClassMapClassVisitor pass. |
private java.util.Map<org.objectweb.asm.Label,java.util.Set<org.objectweb.asm.Label>> |
labelDuplicates2duplicateMap |
private java.util.Map<org.objectweb.asm.Label,org.objectweb.asm.Label> |
labelDuplicates2orginMap |
private java.util.SortedMap<java.lang.Integer,java.util.List<TouchPointDescriptor>> |
line2touchPoints
List of touch-points stored in given line.
|
private static org.apache.log4j.Logger |
logger |
private int |
maxCounterId |
private java.lang.String |
source
Simple name of source-file that was used to generate that value
|
Constructor and Description |
---|
ClassMap() |
Modifier and Type | Method and Description |
---|---|
ClassData |
applyOnProjectData(ProjectData projectData,
boolean instrumented)
Upgrades
ProjectData to contain all information fount in class during class instrumentation. |
void |
assignCounterIds()
Iterates over all touch-points created during class analysis and assigns
hit-counter identifiers to each of the touchpoint (some of them needs mode then one
hit-counter).
|
java.util.Map<java.lang.Integer,java.lang.Integer> |
getBranchLabelDescriptorsForLabelEvent(int labelEventId)
Returns map: switchCounterId --> counterId
|
java.lang.String |
getClassName() |
java.lang.Integer |
getCounterIdForJumpFalse(int eventId) |
java.lang.Integer |
getCounterIdForJumpTrue(int eventId) |
java.lang.Integer |
getCounterIdForLineEventId(int eventId) |
java.lang.Integer |
getCounterIdForSwitch(int eventId) |
int |
getMaxCounterId() |
private java.util.List<TouchPointDescriptor> |
getOrCreateLineTouchPoints(int currentLine) |
private java.util.Set<TouchPointDescriptor> |
getOrCreateSourcePoints(org.objectweb.asm.Label label) |
java.lang.String |
getSource() |
java.util.List<TouchPointDescriptor> |
getTouchPointsInLineOrder() |
boolean |
isJumpDestinationLabel(int eventId) |
void |
putIntoDuplicatesMaps(org.objectweb.asm.Label label,
org.objectweb.asm.Label orgin) |
void |
registerLineNumber(int eventId,
int currentLine,
org.objectweb.asm.Label label,
java.lang.String methodName,
java.lang.String methodSignature) |
void |
registerNewJump(int eventId,
int currentLine,
org.objectweb.asm.Label destinationLabel) |
void |
registerNewLabel(int eventId,
int currentLine,
org.objectweb.asm.Label label) |
void |
registerSwitch(int eventId,
int currentLine,
org.objectweb.asm.Label def,
org.objectweb.asm.Label[] labels,
java.lang.String conditionType) |
void |
setClassName(java.lang.String className) |
void |
setSource(java.lang.String source) |
void |
unregisterLine(int eventId,
int currentLine) |
private static final org.apache.log4j.Logger logger
private java.lang.String source
private final java.util.Map<java.lang.Integer,TouchPointDescriptor> eventId2touchPointDescriptor
private final java.util.Map<org.objectweb.asm.Label,java.util.Set<TouchPointDescriptor>> label2sourcePoints
JumpTouchPointDescriptor
or SwitchTouchPointDescriptor
that the label could be destination of
The labels used here are Label
created during BuildClassMapClassVisitor
pass. Don't try to compare it with labels created by other instrumentation passes.
Instead you should use eventId and eventId2label
to get the label created in the first pass and lookup using the label.
private final java.util.Map<java.lang.Integer,org.objectweb.asm.Label> eventId2label
private final java.util.Set<java.lang.Integer> blockedLines
private final java.util.SortedMap<java.lang.Integer,java.util.List<TouchPointDescriptor>> line2touchPoints
private final java.util.Set<java.lang.Integer> alreadyRegisteredEvents
private final java.util.Map<org.objectweb.asm.Label,org.objectweb.asm.Label> labelDuplicates2orginMap
private final java.util.Map<org.objectweb.asm.Label,java.util.Set<org.objectweb.asm.Label>> labelDuplicates2duplicateMap
private java.lang.String className
private int maxCounterId
public ClassMap()
public void setSource(java.lang.String source)
public void registerNewJump(int eventId, int currentLine, org.objectweb.asm.Label destinationLabel)
private java.util.List<TouchPointDescriptor> getOrCreateLineTouchPoints(int currentLine)
private java.util.Set<TouchPointDescriptor> getOrCreateSourcePoints(org.objectweb.asm.Label label)
public void registerNewLabel(int eventId, int currentLine, org.objectweb.asm.Label label)
public void putIntoDuplicatesMaps(org.objectweb.asm.Label label, org.objectweb.asm.Label orgin)
public void registerLineNumber(int eventId, int currentLine, org.objectweb.asm.Label label, java.lang.String methodName, java.lang.String methodSignature)
public void unregisterLine(int eventId, int currentLine)
public void registerSwitch(int eventId, int currentLine, org.objectweb.asm.Label def, org.objectweb.asm.Label[] labels, java.lang.String conditionType)
public java.lang.Integer getCounterIdForJumpTrue(int eventId)
public java.lang.Integer getCounterIdForJumpFalse(int eventId)
public boolean isJumpDestinationLabel(int eventId)
public java.lang.Integer getCounterIdForSwitch(int eventId)
public java.lang.Integer getCounterIdForLineEventId(int eventId)
public java.util.Map<java.lang.Integer,java.lang.Integer> getBranchLabelDescriptorsForLabelEvent(int labelEventId)
labelEventId
- public void assignCounterIds()
This class assign hit-counter ids to each touch-point and upgrades maxCounterId to reflect the greatest assigned Id.
public int getMaxCounterId()
public java.lang.String getClassName()
public void setClassName(java.lang.String className)
public java.lang.String getSource()
public java.util.List<TouchPointDescriptor> getTouchPointsInLineOrder()
public ClassData applyOnProjectData(ProjectData projectData, boolean instrumented)
ProjectData
to contain all information fount in class during class instrumentation.
I don't like the idea o creating sar file during the instrumentation, but we need to do it, to be compatible with tools that expact that (such a cobertura-maven-plugin)
projectData
-