Package org.jacoco.core.internal.flow
Class LabelInfo
java.lang.Object
org.jacoco.core.internal.flow.LabelInfo
Data container that is attached to
Label.info
objects to store flow
and instrumentation specific information. The information is only valid
locally in specific contexts.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private Instruction
private org.objectweb.asm.Label
private boolean
private boolean
static final int
Reserved ID for "no probe".private int
private boolean
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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 Details
-
NO_PROBE
public static final int NO_PROBEReserved ID for "no probe".- See Also:
-
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
-
-
Constructor Details
-
LabelInfo
private LabelInfo()
-
-
Method Details
-
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
Sets the instruction corresponding to this label.- Parameters:
label
- label to set the instruction forinstruction
- corresponding instruction
-
getInstruction
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
-
create
-