Class CodeExceptionGen

  • All Implemented Interfaces:
    java.lang.Cloneable, InstructionTargeter

    public final class CodeExceptionGen
    extends java.lang.Object
    implements InstructionTargeter, java.lang.Cloneable
    This class represents an exception handler, i.e., specifies the region where a handler is active and an instruction where the actual handling is done. pool as parameters. Opposed to the JVM specification the end of the handled region is set to be inclusive, i.e. all instructions between start and end are protected including the start and end instructions (handles) themselves. The end of the region is automatically mapped to be exclusive when calling getCodeException(), i.e., there is no difference semantically.
    See Also:
    MethodGen, CodeException, InstructionHandle
    • Constructor Detail

      • CodeExceptionGen

        public CodeExceptionGen​(InstructionHandle startPc,
                                InstructionHandle endPc,
                                InstructionHandle handlerPc,
                                ObjectType catchType)
        Add an exception handler, i.e., specify region where a handler is active and an instruction where the actual handling is done.
        Parameters:
        startPc - Start of handled region (inclusive)
        endPc - End of handled region (inclusive)
        handlerPc - Where handling is done
        catchType - which exception is handled, null for ANY
    • Method Detail

      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • getCatchType

        public ObjectType getCatchType()
        Gets the type of the Exception to catch, 'null' for ANY.
      • getCodeException

        public CodeException getCodeException​(ConstantPoolGen cp)
        Gets CodeException object.
        This relies on that the instruction list has already been dumped to byte code or that the 'setPositions' methods has been called for the instruction list.
        Parameters:
        cp - constant pool
      • getEndPC

        public InstructionHandle getEndPC()
        Returns:
        end of handled region (inclusive)
      • getStartPC

        public InstructionHandle getStartPC()
        Returns:
        start of handled region (inclusive)
      • setCatchType

        public void setCatchType​(ObjectType catchType)
        Sets the type of the Exception to catch. Set 'null' for ANY.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object