Class ExceptionHandler


  • public class ExceptionHandler
    extends Object
    One exception-table entry: a protected try region and the block handling its catch type.
    • Constructor Detail

      • ExceptionHandler

        public ExceptionHandler​(IRBlock tryStart,
                                IRBlock tryEnd,
                                IRBlock handlerBlock,
                                ReferenceType catchType)
        Creates an exception handler.
        Parameters:
        tryStart - the start block of the try region
        tryEnd - the end block of the try region
        handlerBlock - the handler block for caught exceptions
        catchType - the type of exception to catch, or null for catch-all
    • Method Detail

      • getTryStart

        public IRBlock getTryStart()
        Returns:
        the try start
      • setTryStart

        public void setTryStart​(IRBlock tryStart)
        Parameters:
        tryStart - the start block of the try region
      • getTryEnd

        public IRBlock getTryEnd()
        Returns:
        the try end
      • setTryEnd

        public void setTryEnd​(IRBlock tryEnd)
        Parameters:
        tryEnd - the end block of the try region
      • getHandlerBlock

        public IRBlock getHandlerBlock()
        Returns:
        the handler block
      • setHandlerBlock

        public void setHandlerBlock​(IRBlock handlerBlock)
        Parameters:
        handlerBlock - the block entered when the exception is caught
      • getCatchType

        public ReferenceType getCatchType()
        Returns:
        the catch type
      • setCatchType

        public void setCatchType​(ReferenceType catchType)
        Parameters:
        catchType - the exception type to catch, or null for catch-all
      • getTryBlocks

        public Set<IRBlock> getTryBlocks()
        Returns the full set of blocks making up the protected (try) region, when known.
        Returns:
        the protected blocks, or null when unknown
      • setTryBlocks

        public void setTryBlocks​(Set<IRBlock> tryBlocks)
        Parameters:
        tryBlocks - the full set of blocks in the protected region, or null when unknown
      • isCatchAll

        public boolean isCatchAll()
        Checks if this is a catch-all handler.
        Returns:
        true if catches all exception types, false otherwise