Class LabelFlowAnalyzer
java.lang.Object
org.objectweb.asm.MethodVisitor
org.jacoco.core.internal.flow.LabelFlowAnalyzer
public final class LabelFlowAnalyzer
extends org.objectweb.asm.MethodVisitor
Method visitor to collect flow related information about the
Labels
within a class. It calculates the properties "multitarget" and "successor"
that can afterwards be obtained via LabelInfo.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) booleantruefor the very first instruction only.(package private) org.objectweb.asm.LabelLabel instance of the last line start.(package private) booleantrueif the current instruction is a potential successor of the previous instruction.Fields inherited from class org.objectweb.asm.MethodVisitor
api, mv -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidmarkLabels(org.objectweb.asm.tree.MethodNode method) Marks all labels of the method with control flow information.private voidprivate static voidsetTargetIfNotDone(org.objectweb.asm.Label label) voidvisitFieldInsn(int opcode, String owner, String name, String desc) voidvisitIincInsn(int var, int increment) voidvisitInsn(int opcode) voidvisitIntInsn(int opcode, int operand) voidvisitInvokeDynamicInsn(String name, String desc, org.objectweb.asm.Handle bsm, Object... bsmArgs) voidvisitJumpInsn(int opcode, org.objectweb.asm.Label label) voidvisitLabel(org.objectweb.asm.Label label) voidvisitLdcInsn(Object cst) voidvisitLineNumber(int line, org.objectweb.asm.Label start) voidvisitLookupSwitchInsn(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels) voidvisitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) voidvisitMultiANewArrayInsn(String desc, int dims) private voidvisitSwitchInsn(org.objectweb.asm.Label dflt, org.objectweb.asm.Label[] labels) voidvisitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels) voidvisitTryCatchBlock(org.objectweb.asm.Label start, org.objectweb.asm.Label end, org.objectweb.asm.Label handler, String type) voidvisitTypeInsn(int opcode, String type) voidvisitVarInsn(int opcode, int var) Methods inherited from class org.objectweb.asm.MethodVisitor
getDelegate, visitAnnotableParameterCount, visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitFrame, visitInsnAnnotation, visitLocalVariable, visitLocalVariableAnnotation, visitMaxs, visitMethodInsn, visitParameter, visitParameterAnnotation, visitTryCatchAnnotation, visitTypeAnnotation
-
Field Details
-
successor
boolean successortrueif the current instruction is a potential successor of the previous instruction. Accessible for testing. -
first
boolean firsttruefor the very first instruction only. Accessible for testing. -
lineStart
org.objectweb.asm.Label lineStartLabel instance of the last line start.
-
-
Constructor Details
-
LabelFlowAnalyzer
public LabelFlowAnalyzer()Create new instance.
-
-
Method Details
-
markLabels
public static void markLabels(org.objectweb.asm.tree.MethodNode method) Marks all labels of the method with control flow information.- Parameters:
method- Method to mark labels
-
visitTryCatchBlock
public void visitTryCatchBlock(org.objectweb.asm.Label start, org.objectweb.asm.Label end, org.objectweb.asm.Label handler, String type) - Overrides:
visitTryCatchBlockin classorg.objectweb.asm.MethodVisitor
-
visitJumpInsn
public void visitJumpInsn(int opcode, org.objectweb.asm.Label label) - Overrides:
visitJumpInsnin classorg.objectweb.asm.MethodVisitor
-
visitLabel
public void visitLabel(org.objectweb.asm.Label label) - Overrides:
visitLabelin classorg.objectweb.asm.MethodVisitor
-
visitLineNumber
public void visitLineNumber(int line, org.objectweb.asm.Label start) - Overrides:
visitLineNumberin classorg.objectweb.asm.MethodVisitor
-
visitTableSwitchInsn
public void visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels) - Overrides:
visitTableSwitchInsnin classorg.objectweb.asm.MethodVisitor
-
visitLookupSwitchInsn
public void visitLookupSwitchInsn(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels) - Overrides:
visitLookupSwitchInsnin classorg.objectweb.asm.MethodVisitor
-
visitSwitchInsn
private void visitSwitchInsn(org.objectweb.asm.Label dflt, org.objectweb.asm.Label[] labels) -
setTargetIfNotDone
private static void setTargetIfNotDone(org.objectweb.asm.Label label) -
visitInsn
public void visitInsn(int opcode) - Overrides:
visitInsnin classorg.objectweb.asm.MethodVisitor
-
visitIntInsn
public void visitIntInsn(int opcode, int operand) - Overrides:
visitIntInsnin classorg.objectweb.asm.MethodVisitor
-
visitVarInsn
public void visitVarInsn(int opcode, int var) - Overrides:
visitVarInsnin classorg.objectweb.asm.MethodVisitor
-
visitTypeInsn
- Overrides:
visitTypeInsnin classorg.objectweb.asm.MethodVisitor
-
visitFieldInsn
-
visitMethodInsn
-
visitInvokeDynamicInsn
-
markMethodInvocationLine
private void markMethodInvocationLine() -
visitLdcInsn
- Overrides:
visitLdcInsnin classorg.objectweb.asm.MethodVisitor
-
visitIincInsn
public void visitIincInsn(int var, int increment) - Overrides:
visitIincInsnin classorg.objectweb.asm.MethodVisitor
-
visitMultiANewArrayInsn
- Overrides:
visitMultiANewArrayInsnin classorg.objectweb.asm.MethodVisitor
-