athrow |
Description
The objectref must be of type reference
and must refer to an object which is an instance of class Throwable
or of a subclass of Throwable
. It is popped from the operand stack. The objectref is then thrown by searching the current frame (§3.6) for the most recent catch
clause that catches the class of objectref or one of its superclasses.
If a catch
clause is found, it contains the location of the code intended to handle this exception. The pc
register is reset to that location, the operand stack of the current frame is cleared, objectref is pushed back onto the operand stack, and execution continues. If no appropriate clause is found in the current frame, that frame is popped, the frame of its invoker is reinstated, and the objectref is rethrown.
If no catch
clause is found that handles this exception, the current thread exits.
Runtime Exception
If objectref is null
, athrow throws a NullPointerException
instead of objectref.