Class ExceptionMethodBuilder

  • Direct Known Subclasses:
    ContextMethodBuilder

    public class ExceptionMethodBuilder
    extends MethodBuilder
    Builder for simple methods that may just pass checked exceptions on to caller.
    Author:
    Dennis M. Sosnoski
    • Field Detail

      • m_slotMap

        private java.util.HashMap m_slotMap
        Map for object to variable assignments.
    • Constructor Detail

      • ExceptionMethodBuilder

        public ExceptionMethodBuilder​(java.lang.String name,
                                      Type ret,
                                      Type[] args,
                                      ClassFile cf,
                                      int access)
        Constructor with types specified.
        Parameters:
        name - method name to be built
        ret - method return type
        args - types of arguments
        cf - owning class file information
        access - flags for method access
      • ExceptionMethodBuilder

        public ExceptionMethodBuilder​(java.lang.String name,
                                      java.lang.String sig,
                                      ClassFile cf,
                                      int access)
        Constructor from signature.
        Parameters:
        name - method name to be built
        sig - method signature
        cf - owning class file information
        access - flags for method access
      • ExceptionMethodBuilder

        public ExceptionMethodBuilder​(java.lang.String name,
                                      java.lang.String sig,
                                      ClassFile cf)
        Constructor from signature for public, final method.
        Parameters:
        name - method name to be built
        sig - method signature
        cf - owning class file information
    • Method Detail

      • defineSlot

        public int defineSlot​(java.lang.Object obj,
                              Type type)
        Define local variable slot for object. The current code in the method must have the initial value for the variable on the stack
        Parameters:
        obj - owning object of slot
        type - variable type
        Returns:
        slot number
      • getSlot

        public int getSlot​(java.lang.Object obj)
        Check if local variable slot defined for object.
        Parameters:
        obj - owning object of slot
        Returns:
        local variable slot assigned to object, or -1 if none
      • freeSlot

        public void freeSlot​(java.lang.Object obj)
        Free local variable slot for object. This clears the usage of the slot (if one has been defined for the object) so it can be reused for other purposes.
        Parameters:
        obj - owning object of slot
      • handleExceptions

        protected void handleExceptions()
        Process accumulated exceptions. Just adds the checked exceptions that may be thrown within the body to the list for this method, passing them on to the caller for handling.
        Specified by:
        handleExceptions in class MethodBuilder