Top Description Fields Constructors Methods
org.eclipse.persistence.internal.libraries.asm.commons

public Class TryCatchBlockSorter

extends MethodNode
Class Inheritance
Imports
java.util.Collections, .Comparator, org.eclipse.persistence.internal.libraries.asm.MethodVisitor, .Opcodes, org.eclipse.persistence.internal.libraries.asm.tree.MethodNode, .TryCatchBlockNode

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).

Author
Adrian Sampson

Field Summary

Inherited from org.eclipse.persistence.internal.libraries.asm.tree.MethodNode:
accessannotationDefaultattrsdescexceptionsinstructionsinvisibleAnnotableParameterCountinvisibleAnnotationsinvisibleLocalVariableAnnotationsinvisibleParameterAnnotationsinvisibleTypeAnnotationslocalVariablesmaxLocalsmaxStacknameparameterssignaturetryCatchBlocksvisibleAnnotableParameterCountvisibleAnnotationsvisibleLocalVariableAnnotationsvisibleParameterAnnotationsvisibleTypeAnnotations

Constructor Summary

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

Constructs a new TryCatchBlockSorter.

protected
TryCatchBlockSorter(final int api, final MethodVisitor methodVisitor, final int access, final String name, final String descriptor, final String signature, final String[] exceptions)

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from org.eclipse.persistence.internal.libraries.asm.tree.MethodNode:
acceptacceptcheckgetLabelNodevisitAnnotableParameterCountvisitAnnotationvisitAnnotationDefaultvisitAttributevisitCodevisitFieldInsnvisitFramevisitIincInsnvisitInsnvisitInsnAnnotationvisitIntInsnvisitInvokeDynamicInsnvisitJumpInsnvisitLabelvisitLdcInsnvisitLineNumbervisitLocalVariablevisitLocalVariableAnnotationvisitLookupSwitchInsnvisitMaxsvisitMethodInsnvisitMultiANewArrayInsnvisitParametervisitParameterAnnotationvisitTableSwitchInsnvisitTryCatchAnnotationvisitTryCatchBlockvisitTypeAnnotationvisitTypeInsnvisitVarInsn

Constructor Detail

TryCatchBlockSorterback to summary
public TryCatchBlockSorter(final MethodVisitor methodVisitor, final int access, final String name, final String descriptor, final String signature, final String[] exceptions)

Constructs a new TryCatchBlockSorter.

Parameters
methodVisitor:MethodVisitor

the method visitor to which this visitor must delegate method calls. May be null.

access:int

the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated.

name:String

the method's name.

descriptor:String

the method's descriptor (see org.eclipse.persistence.internal.libraries.asm.Type).

signature:String

the method's signature. May be null if the method parameters, return type and exceptions do not use generic types.

exceptions:String[]

the internal names of the method's exception classes (see org.eclipse.persistence.internal.libraries.asm.Type#getInternalName()). May be null.

TryCatchBlockSorterback to summary
protected TryCatchBlockSorter(final int api, final MethodVisitor methodVisitor, final int access, final String name, final String descriptor, final String signature, final String[] exceptions)

Method Detail

visitEndback to summary
public void visitEnd()

Overrides org.eclipse.persistence.internal.libraries.asm.tree.MethodNode.visitEnd.

Doc from org.eclipse.persistence.internal.libraries.asm.MethodVisitor.visitEnd.

Visits the end of the method. This method, which is the last one to be called, is used to inform the visitor that all the annotations and attributes of the method have been visited.

Annotations
@Override