Package org.jacoco.core.internal.flow
Class LabelInfo
- java.lang.Object
-
- org.jacoco.core.internal.flow.LabelInfo
-
public final class LabelInfo extends java.lang.Object
Data container that is attached toLabel.info
objects to store flow and instrumentation specific information. The information is only valid locally in specific contexts.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
done
private Instruction
instruction
private org.objectweb.asm.Label
intermediate
private boolean
methodInvocationLine
private boolean
multiTarget
static int
NO_PROBE
Reserved ID for "no probe".private int
probeid
private boolean
successor
private boolean
target
-
Constructor Summary
Constructors Modifier Constructor Description private
LabelInfo()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static LabelInfo
create(org.objectweb.asm.Label label)
private static LabelInfo
get(org.objectweb.asm.Label label)
static Instruction
getInstruction(org.objectweb.asm.Label label)
Returns the corresponding instruction for the given label if one has been defined.static org.objectweb.asm.Label
getIntermediateLabel(org.objectweb.asm.Label label)
Returns the intermediate label for the given label if one has been defined.static int
getProbeId(org.objectweb.asm.Label label)
Returns the assigned probe id.static boolean
isDone(org.objectweb.asm.Label label)
Checks whether this label is marked as done.static boolean
isMethodInvocationLine(org.objectweb.asm.Label label)
Checks whether the a given label has been marked as a line with method invocations.static boolean
isMultiTarget(org.objectweb.asm.Label label)
Checks whether multiple control paths lead to a label.static boolean
isSuccessor(org.objectweb.asm.Label label)
Checks whether this label is the possible successor of the previous instruction in the method.static boolean
needsProbe(org.objectweb.asm.Label label)
Determines whether the given label needs a probe to be inserted before.static void
resetDone(org.objectweb.asm.Label label)
Resets the "done" status of a given label.static void
resetDone(org.objectweb.asm.Label[] labels)
Resets the "done" status of all given labels.static void
setDone(org.objectweb.asm.Label label)
Mark a given label as done.static void
setInstruction(org.objectweb.asm.Label label, Instruction instruction)
Sets the instruction corresponding to this label.static void
setIntermediateLabel(org.objectweb.asm.Label label, org.objectweb.asm.Label intermediate)
Defines an intermediate label for the given label.static void
setMethodInvocationLine(org.objectweb.asm.Label label)
Mark a given label as the beginning of a line with method invocations.static void
setProbeId(org.objectweb.asm.Label label, int id)
Sets the given probe id to the given label.static void
setSuccessor(org.objectweb.asm.Label label)
Defines that the given label is the possible successor of the previous instruction in the method.static void
setTarget(org.objectweb.asm.Label label)
Defines that the given label is a jump target.
-
-
-
Field Detail
-
NO_PROBE
public static final int NO_PROBE
Reserved ID for "no probe".- See Also:
- Constant Field Values
-
target
private boolean target
-
multiTarget
private boolean multiTarget
-
successor
private boolean successor
-
methodInvocationLine
private boolean methodInvocationLine
-
done
private boolean done
-
probeid
private int probeid
-
intermediate
private org.objectweb.asm.Label intermediate
-
instruction
private Instruction instruction
-
-
Method Detail
-
setTarget
public static void setTarget(org.objectweb.asm.Label label)
Defines that the given label is a jump target.- Parameters:
label
- label to define
-
setSuccessor
public static void setSuccessor(org.objectweb.asm.Label label)
Defines that the given label is the possible successor of the previous instruction in the method.- Parameters:
label
- label to define
-
isMultiTarget
public static boolean isMultiTarget(org.objectweb.asm.Label label)
Checks whether multiple control paths lead to a label. Control flow path to a certain label are: jump targets, exception handlers and normal control flow from its predecessor instruction (unless this is an unconditional jump or method exit).- Parameters:
label
- label to check- Returns:
true
if the given multiple control paths lead to the given label
-
isSuccessor
public static boolean isSuccessor(org.objectweb.asm.Label label)
Checks whether this label is the possible successor of the previous instruction in the method. This is the case if the predecessor isn't a unconditional jump or method exit instruction.- Parameters:
label
- label to check- Returns:
true
if the label is a possible instruction successor
-
setMethodInvocationLine
public static void setMethodInvocationLine(org.objectweb.asm.Label label)
Mark a given label as the beginning of a line with method invocations.- Parameters:
label
- label to mark
-
isMethodInvocationLine
public static boolean isMethodInvocationLine(org.objectweb.asm.Label label)
Checks whether the a given label has been marked as a line with method invocations.- Parameters:
label
- label to check- Returns:
true
if the label represents a line with method invocations
-
needsProbe
public static boolean needsProbe(org.objectweb.asm.Label label)
Determines whether the given label needs a probe to be inserted before.- Parameters:
label
- label to test- Returns:
true
if a probe should be inserted before
-
setDone
public static void setDone(org.objectweb.asm.Label label)
Mark a given label as done.- Parameters:
label
- label to mark
-
resetDone
public static void resetDone(org.objectweb.asm.Label label)
Resets the "done" status of a given label.- Parameters:
label
- label to reset
-
resetDone
public static void resetDone(org.objectweb.asm.Label[] labels)
Resets the "done" status of all given labels.- Parameters:
labels
- labels to reset
-
isDone
public static boolean isDone(org.objectweb.asm.Label label)
Checks whether this label is marked as done.- Parameters:
label
- label to check- Returns:
true
if this label is marked as done
-
setProbeId
public static void setProbeId(org.objectweb.asm.Label label, int id)
Sets the given probe id to the given label.- Parameters:
label
- label to assign a probe toid
- id of the probe
-
getProbeId
public static int getProbeId(org.objectweb.asm.Label label)
Returns the assigned probe id.- Parameters:
label
- label to check- Returns:
- probe id or
NO_PROBE
if no probe is assigned to the label
-
setIntermediateLabel
public static void setIntermediateLabel(org.objectweb.asm.Label label, org.objectweb.asm.Label intermediate)
Defines an intermediate label for the given label. Such intermediate labels are required during instrumentation to add probes to jump targets.- Parameters:
label
- label to define forintermediate
- intermediate label
-
getIntermediateLabel
public static org.objectweb.asm.Label getIntermediateLabel(org.objectweb.asm.Label label)
Returns the intermediate label for the given label if one has been defined.- Parameters:
label
- label to look for- Returns:
- intermediate label or
null
-
setInstruction
public static void setInstruction(org.objectweb.asm.Label label, Instruction instruction)
Sets the instruction corresponding to this label.- Parameters:
label
- label to set the instruction forinstruction
- corresponding instruction
-
getInstruction
public static Instruction getInstruction(org.objectweb.asm.Label label)
Returns the corresponding instruction for the given label if one has been defined.- Parameters:
label
- label to look for- Returns:
- corresponding instruction or
null
-
get
private static LabelInfo get(org.objectweb.asm.Label label)
-
create
private static LabelInfo create(org.objectweb.asm.Label label)
-
-