Package org.jacoco.core.internal.flow
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 theLabel
s within a class. It calculates the properties "multitarget" and "successor" that can afterwards be obtained viaLabelInfo
.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
first
true
for the very first instruction only.(package private) org.objectweb.asm.Label
lineStart
Label instance of the last line start.(package private) boolean
successor
true
if the current instruction is a potential successor of the previous instruction.
-
Constructor Summary
Constructors Constructor Description LabelFlowAnalyzer()
Create new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
markLabels(org.objectweb.asm.tree.MethodNode method)
Marks all labels of the method with control flow information.private void
markMethodInvocationLine()
private static void
setTargetIfNotDone(org.objectweb.asm.Label label)
void
visitFieldInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc)
void
visitIincInsn(int var, int increment)
void
visitInsn(int opcode)
void
visitIntInsn(int opcode, int operand)
void
visitInvokeDynamicInsn(java.lang.String name, java.lang.String desc, org.objectweb.asm.Handle bsm, java.lang.Object... bsmArgs)
void
visitJumpInsn(int opcode, org.objectweb.asm.Label label)
void
visitLabel(org.objectweb.asm.Label label)
void
visitLdcInsn(java.lang.Object cst)
void
visitLineNumber(int line, org.objectweb.asm.Label start)
void
visitLookupSwitchInsn(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels)
void
visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc, boolean itf)
void
visitMultiANewArrayInsn(java.lang.String desc, int dims)
private void
visitSwitchInsn(org.objectweb.asm.Label dflt, org.objectweb.asm.Label[] labels)
void
visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels)
void
visitTryCatchBlock(org.objectweb.asm.Label start, org.objectweb.asm.Label end, org.objectweb.asm.Label handler, java.lang.String type)
void
visitTypeInsn(int opcode, java.lang.String type)
void
visitVarInsn(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 Detail
-
successor
boolean successor
true
if the current instruction is a potential successor of the previous instruction. Accessible for testing.
-
first
boolean first
true
for the very first instruction only. Accessible for testing.
-
lineStart
org.objectweb.asm.Label lineStart
Label instance of the last line start.
-
-
Method Detail
-
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, java.lang.String type)
- Overrides:
visitTryCatchBlock
in classorg.objectweb.asm.MethodVisitor
-
visitJumpInsn
public void visitJumpInsn(int opcode, org.objectweb.asm.Label label)
- Overrides:
visitJumpInsn
in classorg.objectweb.asm.MethodVisitor
-
visitLabel
public void visitLabel(org.objectweb.asm.Label label)
- Overrides:
visitLabel
in classorg.objectweb.asm.MethodVisitor
-
visitLineNumber
public void visitLineNumber(int line, org.objectweb.asm.Label start)
- Overrides:
visitLineNumber
in classorg.objectweb.asm.MethodVisitor
-
visitTableSwitchInsn
public void visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels)
- Overrides:
visitTableSwitchInsn
in classorg.objectweb.asm.MethodVisitor
-
visitLookupSwitchInsn
public void visitLookupSwitchInsn(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels)
- Overrides:
visitLookupSwitchInsn
in 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:
visitInsn
in classorg.objectweb.asm.MethodVisitor
-
visitIntInsn
public void visitIntInsn(int opcode, int operand)
- Overrides:
visitIntInsn
in classorg.objectweb.asm.MethodVisitor
-
visitVarInsn
public void visitVarInsn(int opcode, int var)
- Overrides:
visitVarInsn
in classorg.objectweb.asm.MethodVisitor
-
visitTypeInsn
public void visitTypeInsn(int opcode, java.lang.String type)
- Overrides:
visitTypeInsn
in classorg.objectweb.asm.MethodVisitor
-
visitFieldInsn
public void visitFieldInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc)
- Overrides:
visitFieldInsn
in classorg.objectweb.asm.MethodVisitor
-
visitMethodInsn
public void visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc, boolean itf)
- Overrides:
visitMethodInsn
in classorg.objectweb.asm.MethodVisitor
-
visitInvokeDynamicInsn
public void visitInvokeDynamicInsn(java.lang.String name, java.lang.String desc, org.objectweb.asm.Handle bsm, java.lang.Object... bsmArgs)
- Overrides:
visitInvokeDynamicInsn
in classorg.objectweb.asm.MethodVisitor
-
markMethodInvocationLine
private void markMethodInvocationLine()
-
visitLdcInsn
public void visitLdcInsn(java.lang.Object cst)
- Overrides:
visitLdcInsn
in classorg.objectweb.asm.MethodVisitor
-
visitIincInsn
public void visitIincInsn(int var, int increment)
- Overrides:
visitIincInsn
in classorg.objectweb.asm.MethodVisitor
-
visitMultiANewArrayInsn
public void visitMultiANewArrayInsn(java.lang.String desc, int dims)
- Overrides:
visitMultiANewArrayInsn
in classorg.objectweb.asm.MethodVisitor
-
-