Class 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 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.
      • Fields inherited from class org.objectweb.asm.MethodVisitor

        api, mv
    • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
    • Constructor Detail

      • LabelFlowAnalyzer

        public LabelFlowAnalyzer()
        Create new instance.
    • 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 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,
                                  java.lang.String type)
        Overrides:
        visitTypeInsn in class org.objectweb.asm.MethodVisitor
      • visitFieldInsn

        public void visitFieldInsn​(int opcode,
                                   java.lang.String owner,
                                   java.lang.String name,
                                   java.lang.String desc)
        Overrides:
        visitFieldInsn in class org.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 class org.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 class org.objectweb.asm.MethodVisitor
      • markMethodInvocationLine

        private void markMethodInvocationLine()
      • visitLdcInsn

        public void visitLdcInsn​(java.lang.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​(java.lang.String desc,
                                            int dims)
        Overrides:
        visitMultiANewArrayInsn in class org.objectweb.asm.MethodVisitor