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

    Fields
    Modifier and Type
    Field
    Description
    (package private) boolean
    true for the very first instruction only.
    (package private) org.objectweb.asm.Label
    Label instance of the last line start.
    (package private) boolean
    true if the current instruction is a potential successor of the previous instruction.

    Fields inherited from class org.objectweb.asm.MethodVisitor

    api, mv
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create new instance.
  • Method Summary

    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
     
    private static void
    setTargetIfNotDone(org.objectweb.asm.Label label)
     
    void
    visitFieldInsn(int opcode, String owner, String name, String desc)
     
    void
    visitIincInsn(int var, int increment)
     
    void
    visitInsn(int opcode)
     
    void
    visitIntInsn(int opcode, int operand)
     
    void
    visitInvokeDynamicInsn(String name, String desc, org.objectweb.asm.Handle bsm, Object... bsmArgs)
     
    void
    visitJumpInsn(int opcode, org.objectweb.asm.Label label)
     
    void
    visitLabel(org.objectweb.asm.Label label)
     
    void
     
    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, String owner, String name, String desc, boolean itf)
     
    void
     
    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, String type)
     
    void
    visitTypeInsn(int opcode, 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • 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.
  • 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:
      visitTryCatchBlock in class org.objectweb.asm.MethodVisitor
    • visitJumpInsn

      public void visitJumpInsn(int opcode, org.objectweb.asm.Label label)
      Overrides:
      visitJumpInsn in class org.objectweb.asm.MethodVisitor
    • visitLabel

      public void visitLabel(org.objectweb.asm.Label label)
      Overrides:
      visitLabel in class org.objectweb.asm.MethodVisitor
    • visitLineNumber

      public void visitLineNumber(int line, org.objectweb.asm.Label start)
      Overrides:
      visitLineNumber in class org.objectweb.asm.MethodVisitor
    • visitTableSwitchInsn

      public void visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels)
      Overrides:
      visitTableSwitchInsn in class org.objectweb.asm.MethodVisitor
    • visitLookupSwitchInsn

      public void visitLookupSwitchInsn(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels)
      Overrides:
      visitLookupSwitchInsn in class org.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 class org.objectweb.asm.MethodVisitor
    • visitIntInsn

      public void visitIntInsn(int opcode, int operand)
      Overrides:
      visitIntInsn in class org.objectweb.asm.MethodVisitor
    • visitVarInsn

      public void visitVarInsn(int opcode, int var)
      Overrides:
      visitVarInsn in class org.objectweb.asm.MethodVisitor
    • visitTypeInsn

      public void visitTypeInsn(int opcode, String type)
      Overrides:
      visitTypeInsn in class org.objectweb.asm.MethodVisitor
    • visitFieldInsn

      public void visitFieldInsn(int opcode, String owner, String name, String desc)
      Overrides:
      visitFieldInsn in class org.objectweb.asm.MethodVisitor
    • visitMethodInsn

      public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf)
      Overrides:
      visitMethodInsn in class org.objectweb.asm.MethodVisitor
    • visitInvokeDynamicInsn

      public void visitInvokeDynamicInsn(String name, String desc, org.objectweb.asm.Handle bsm, Object... bsmArgs)
      Overrides:
      visitInvokeDynamicInsn in class org.objectweb.asm.MethodVisitor
    • markMethodInvocationLine

      private void markMethodInvocationLine()
    • visitLdcInsn

      public void visitLdcInsn(Object cst)
      Overrides:
      visitLdcInsn in class org.objectweb.asm.MethodVisitor
    • visitIincInsn

      public void visitIincInsn(int var, int increment)
      Overrides:
      visitIincInsn in class org.objectweb.asm.MethodVisitor
    • visitMultiANewArrayInsn

      public void visitMultiANewArrayInsn(String desc, int dims)
      Overrides:
      visitMultiANewArrayInsn in class org.objectweb.asm.MethodVisitor