Class TryCatchBlockSorter

java.lang.Object
org.objectweb.asm.MethodVisitor
org.objectweb.asm.tree.MethodNode
org.objectweb.asm.commons.TryCatchBlockSorter

public class TryCatchBlockSorter extends org.objectweb.asm.tree.MethodNode
A MethodVisitor adapter to sort the exception handlers. The handlers are sorted in a method innermost-to-outermost. This allows the programmer to add handlers without worrying about ordering them correctly with respect to existing, in-code handlers.

Behavior is only defined for properly-nested handlers. If any "try" blocks overlap (something that isn't possible in Java code) then this may not do what you want. In fact, this adapter just sorts by the length of the "try" block, taking advantage of the fact that a given try block must be larger than any block it contains).

  • Field Summary

    Fields inherited from class org.objectweb.asm.tree.MethodNode

    access, annotationDefault, attrs, desc, exceptions, instructions, invisibleAnnotableParameterCount, invisibleAnnotations, invisibleLocalVariableAnnotations, invisibleParameterAnnotations, invisibleTypeAnnotations, localVariables, maxLocals, maxStack, name, parameters, signature, tryCatchBlocks, visibleAnnotableParameterCount, visibleAnnotations, visibleLocalVariableAnnotations, visibleParameterAnnotations, visibleTypeAnnotations

    Fields inherited from class org.objectweb.asm.MethodVisitor

    api, mv
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    TryCatchBlockSorter(int api, org.objectweb.asm.MethodVisitor methodVisitor, int access, String name, String descriptor, String signature, String[] exceptions)
     
     
    TryCatchBlockSorter(org.objectweb.asm.MethodVisitor methodVisitor, int access, String name, String descriptor, String signature, String[] exceptions)
    Constructs a new TryCatchBlockSorter.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     

    Methods inherited from class org.objectweb.asm.tree.MethodNode

    accept, accept, check, getLabelNode, visitAnnotableParameterCount, visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitFieldInsn, visitFrame, visitIincInsn, visitInsn, visitInsnAnnotation, visitIntInsn, visitInvokeDynamicInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLocalVariableAnnotation, visitLookupSwitchInsn, visitMaxs, visitMethodInsn, visitMultiANewArrayInsn, visitParameter, visitParameterAnnotation, visitTableSwitchInsn, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeAnnotation, visitTypeInsn, visitVarInsn

    Methods inherited from class org.objectweb.asm.MethodVisitor

    getDelegate, visitMethodInsn

    Methods inherited from class java.lang.Object

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

    • TryCatchBlockSorter

      public TryCatchBlockSorter(org.objectweb.asm.MethodVisitor methodVisitor, int access, String name, String descriptor, String signature, String[] exceptions)
      Constructs a new TryCatchBlockSorter.
      Parameters:
      methodVisitor - the method visitor to which this visitor must delegate method calls. May be null.
      access - the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated.
      name - the method's name.
      descriptor - the method's descriptor (see Type).
      signature - the method's signature. May be null if the method parameters, return type and exceptions do not use generic types.
      exceptions - the internal names of the method's exception classes (see Type.getInternalName()). May be null.
    • TryCatchBlockSorter

      protected TryCatchBlockSorter(int api, org.objectweb.asm.MethodVisitor methodVisitor, int access, String name, String descriptor, String signature, String[] exceptions)
  • Method Details

    • visitEnd

      public void visitEnd()
      Overrides:
      visitEnd in class org.objectweb.asm.tree.MethodNode