public class SwitchTouchPointDescriptor extends TouchPointDescriptor
A SWITCH touch-point uses one more counter then distinct number destination labels (getCountersForLabelsCnt()
).
One 'internal' counterId (counterId
) is a special identifier of SWITCH statement (used in runtime), but in fact we don't expect any
incrementation of the counter. We implemented this to use a counterId because we are storing the value inside 'internal variable' and we need to be sure
that the value is connected to the last seen SWITCH statement.
Or other counterIds represents different branches (different destination labels of the switch).
We also storing a #methodName
and a #methodSignature
(consider to move this fields into TouchPointDescriptor
).
Those fields are needed to properly create instance of LineData
.
Modifier and Type | Field and Description |
---|---|
private java.lang.Integer |
counterId |
private org.objectweb.asm.Label |
defaultDestinationLabel |
private java.lang.String |
enum_type
Encoded as:
org.objectweb.asm.commons#AnalyzerAdapter#stack |
private java.util.Map<org.objectweb.asm.Label,java.lang.Integer> |
label2counterId |
private org.objectweb.asm.Label[] |
labels |
Constructor and Description |
---|
SwitchTouchPointDescriptor(int eventId,
int currentLine,
org.objectweb.asm.Label def,
org.objectweb.asm.Label[] labels,
java.lang.String enum_type)
Creates o new switch-touch point.
|
Modifier and Type | Method and Description |
---|---|
int |
assignCounters(java.util.concurrent.atomic.AtomicInteger idGenerator)
Every touch-point will have assigned some counters.
|
java.lang.Integer |
getCounterId() |
java.lang.Integer |
getCounterIdForLabel(org.objectweb.asm.Label label) |
java.util.Collection<java.lang.Integer> |
getCountersForLabels() |
int |
getCountersForLabelsCnt()
Works before calling 'assignCounters'
|
java.lang.String |
getEnumType() |
void |
setCounterId(java.lang.Integer counterId) |
getEventId, getLineNumber, setEventId, setLineNumber
private final org.objectweb.asm.Label defaultDestinationLabel
private final org.objectweb.asm.Label[] labels
private final java.lang.String enum_type
org.objectweb.asm.commons#AnalyzerAdapter#stack
private java.lang.Integer counterId
private java.util.Map<org.objectweb.asm.Label,java.lang.Integer> label2counterId
public SwitchTouchPointDescriptor(int eventId, int currentLine, org.objectweb.asm.Label def, org.objectweb.asm.Label[] labels, java.lang.String enum_type)
eventId
- - eventId connected to the SWITCH instructioncurrentLine
- - line number of the switchdef
- - internal identifier of a default destination labellabels
- - table of other destination labels for different values (duplicates allowed)public java.lang.Integer getCounterId()
public void setCounterId(java.lang.Integer counterId)
public int assignCounters(java.util.concurrent.atomic.AtomicInteger idGenerator)
TouchPointDescriptor
assignCounters
in class TouchPointDescriptor
public java.lang.Integer getCounterIdForLabel(org.objectweb.asm.Label label)
public java.util.Collection<java.lang.Integer> getCountersForLabels()
public int getCountersForLabelsCnt()
Works before calling 'assignCounters'
public java.lang.String getEnumType()