Class RecursiveHandler

  • All Implemented Interfaces:
    InvocationHandler

    public final class RecursiveHandler
    extends Object
    implements InvocationHandler
    Invocation handler that pushes interpreter frames for bytecode-backed methods, dispatches registered natives, and stubs absent bodies with default values.
    • Constructor Detail

      • RecursiveHandler

        public RecursiveHandler​(ClassResolver resolver)
        Creates a handler with an empty native registry.
        Parameters:
        resolver - resolves virtual dispatch targets
        Throws:
        IllegalArgumentException - if resolver is null
      • RecursiveHandler

        public RecursiveHandler​(ClassResolver resolver,
                                NativeRegistry nativeRegistry)
        Creates a handler backed by the given native registry.
        Parameters:
        resolver - resolves virtual dispatch targets
        nativeRegistry - supplies handlers for native methods
        Throws:
        IllegalArgumentException - if resolver or nativeRegistry is null
    • Method Detail

      • invoke

        public InvocationResult invoke​(MethodEntry method,
                                       ObjectInstance receiver,
                                       ConcreteValue[] args,
                                       InvocationContext context)
        Description copied from interface: InvocationHandler
        Executes a resolved call.
        Specified by:
        invoke in interface InvocationHandler
        Parameters:
        method - the resolved target
        receiver - the instance for an instance call, null for a static call
        args - the argument values in declaration order
        context - the interpreter services available for the duration of the call
        Returns:
        the outcome: a completed value, a guest exception, a delegation, or a frame to push