Class Advice.Dispatcher.Inlining.Resolved.AdviceMethodInliner.ExceptionTableSubstitutor

  • Enclosing class:
    Advice.Dispatcher.Inlining.Resolved.AdviceMethodInliner

    protected class Advice.Dispatcher.Inlining.Resolved.AdviceMethodInliner.ExceptionTableSubstitutor
    extends org.objectweb.asm.MethodVisitor
    A label substitutor allows to visit an advice method a second time after the exception handlers were already written. Doing so, this visitor substitutes all labels that were already created during the first visit to keep the mapping consistent. It is not required to resolve labels for non-code instructions as meta information is not propagated to the target method visitor for advice code.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int index
      The current index of the visited labels that are used for try-catch-finally blocks.
      private java.util.Map<org.objectweb.asm.Label,​org.objectweb.asm.Label> substitutions
      A map containing resolved substitutions.
      • Fields inherited from class org.objectweb.asm.MethodVisitor

        api, mv
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ExceptionTableSubstitutor​(org.objectweb.asm.MethodVisitor methodVisitor)
      Creates a label substitutor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private org.objectweb.asm.Label resolve​(org.objectweb.asm.Label label)
      Resolves a single label if mapped or returns the original label.
      private org.objectweb.asm.Label[] resolve​(org.objectweb.asm.Label[] label)
      Resolves an array of labels.
      void visitJumpInsn​(int opcode, org.objectweb.asm.Label label)  
      void visitLabel​(org.objectweb.asm.Label label)  
      void visitLookupSwitchInsn​(org.objectweb.asm.Label defaultOption, int[] keys, org.objectweb.asm.Label[] label)  
      void visitTableSwitchInsn​(int minimum, int maximum, org.objectweb.asm.Label defaultOption, org.objectweb.asm.Label... label)  
      org.objectweb.asm.AnnotationVisitor visitTryCatchAnnotation​(int typeReference, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)  
      void visitTryCatchBlock​(org.objectweb.asm.Label start, org.objectweb.asm.Label end, org.objectweb.asm.Label handler, java.lang.String type)  
      • Methods inherited from class org.objectweb.asm.MethodVisitor

        visitAnnotableParameterCount, visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitFieldInsn, visitFrame, visitIincInsn, visitInsn, visitInsnAnnotation, visitIntInsn, visitInvokeDynamicInsn, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLocalVariableAnnotation, visitMaxs, visitMethodInsn, visitMethodInsn, visitMultiANewArrayInsn, visitParameter, visitParameterAnnotation, visitTypeAnnotation, visitTypeInsn, visitVarInsn
      • Methods inherited from class java.lang.Object

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

      • substitutions

        private final java.util.Map<org.objectweb.asm.Label,​org.objectweb.asm.Label> substitutions
        A map containing resolved substitutions.
      • index

        private int index
        The current index of the visited labels that are used for try-catch-finally blocks.
    • Constructor Detail

      • ExceptionTableSubstitutor

        protected ExceptionTableSubstitutor​(org.objectweb.asm.MethodVisitor methodVisitor)
        Creates a label substitutor.
        Parameters:
        methodVisitor - The method visitor for which to substitute labels.
    • Method Detail

      • 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
      • visitTryCatchAnnotation

        public org.objectweb.asm.AnnotationVisitor visitTryCatchAnnotation​(int typeReference,
                                                                           org.objectweb.asm.TypePath typePath,
                                                                           java.lang.String descriptor,
                                                                           boolean visible)
        Overrides:
        visitTryCatchAnnotation in class org.objectweb.asm.MethodVisitor
      • visitLabel

        public void visitLabel​(org.objectweb.asm.Label label)
        Overrides:
        visitLabel 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
      • visitTableSwitchInsn

        public void visitTableSwitchInsn​(int minimum,
                                         int maximum,
                                         org.objectweb.asm.Label defaultOption,
                                         org.objectweb.asm.Label... label)
        Overrides:
        visitTableSwitchInsn in class org.objectweb.asm.MethodVisitor
      • visitLookupSwitchInsn

        public void visitLookupSwitchInsn​(org.objectweb.asm.Label defaultOption,
                                          int[] keys,
                                          org.objectweb.asm.Label[] label)
        Overrides:
        visitLookupSwitchInsn in class org.objectweb.asm.MethodVisitor
      • resolve

        private org.objectweb.asm.Label[] resolve​(org.objectweb.asm.Label[] label)
        Resolves an array of labels.
        Parameters:
        label - The labels to resolved.
        Returns:
        An array containing the resolved arrays.
      • resolve

        private org.objectweb.asm.Label resolve​(org.objectweb.asm.Label label)
        Resolves a single label if mapped or returns the original label.
        Parameters:
        label - The label to resolve.
        Returns:
        The resolved label.