Package org.jacoco.core.internal.flow
Class LabelInfo
- java.lang.Object
-
- org.jacoco.core.internal.flow.LabelInfo
-
public final class LabelInfo extends java.lang.ObjectData container that is attached toLabel.infoobjects 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 booleandoneprivate Instructioninstructionprivate org.objectweb.asm.Labelintermediateprivate booleanmethodInvocationLineprivate booleanmultiTargetstatic intNO_PROBEReserved ID for "no probe".private intprobeidprivate booleansuccessorprivate booleantarget
-
Constructor Summary
Constructors Modifier Constructor Description privateLabelInfo()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static LabelInfocreate(org.objectweb.asm.Label label)private static LabelInfoget(org.objectweb.asm.Label label)static InstructiongetInstruction(org.objectweb.asm.Label label)Returns the corresponding instruction for the given label if one has been defined.static org.objectweb.asm.LabelgetIntermediateLabel(org.objectweb.asm.Label label)Returns the intermediate label for the given label if one has been defined.static intgetProbeId(org.objectweb.asm.Label label)Returns the assigned probe id.static booleanisDone(org.objectweb.asm.Label label)Checks whether this label is marked as done.static booleanisMethodInvocationLine(org.objectweb.asm.Label label)Checks whether the a given label has been marked as a line with method invocations.static booleanisMultiTarget(org.objectweb.asm.Label label)Checks whether multiple control paths lead to a label.static booleanisSuccessor(org.objectweb.asm.Label label)Checks whether this label is the possible successor of the previous instruction in the method.static booleanneedsProbe(org.objectweb.asm.Label label)Determines whether the given label needs a probe to be inserted before.static voidresetDone(org.objectweb.asm.Label label)Resets the "done" status of a given label.static voidresetDone(org.objectweb.asm.Label[] labels)Resets the "done" status of all given labels.static voidsetDone(org.objectweb.asm.Label label)Mark a given label as done.static voidsetInstruction(org.objectweb.asm.Label label, Instruction instruction)Sets the instruction corresponding to this label.static voidsetIntermediateLabel(org.objectweb.asm.Label label, org.objectweb.asm.Label intermediate)Defines an intermediate label for the given label.static voidsetMethodInvocationLine(org.objectweb.asm.Label label)Mark a given label as the beginning of a line with method invocations.static voidsetProbeId(org.objectweb.asm.Label label, int id)Sets the given probe id to the given label.static voidsetSuccessor(org.objectweb.asm.Label label)Defines that the given label is the possible successor of the previous instruction in the method.static voidsetTarget(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:
trueif 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:
trueif 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:
trueif 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:
trueif 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:
trueif 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_PROBEif 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)
-
-