Package org.apache.groovy.internal.runtime.invoke

# Interface DirectInvoker

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface DirectInvoker
JIT-constant trampoline for a single `Method`.

Not user API. Not an invokedynamic target. Valid for the `Method` lifetime, not across `MetaMethod` wrappers.

Public because generated nestmates of a foreign host (other package, other loader) must `implements` this interface. The containing `internal` package is japicmp-excluded.

Since:
  6.0.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `invoke(Object receiver, Object[] arguments)`
  Invokes the bound method on `receiver` with `arguments`.

- ## Method Details

  - ### invoke

    Object invoke(Object receiver, Object[] arguments) throws Throwable
    Invokes the bound method on `receiver` with `arguments`.

    Arguments are assumed already coerced (see `MetaMethod.doMethodInvoke`) except when a `TransformMetaMethod` skipped coercion. Generated trampolines require a non-null `arguments` array (use `MetaClassHelper.EMPTY_ARRAY` for no args); `CachedMethod.invoke` performs that substitution. Primitive returns are boxed; the caller runs `normalizeBoxedReturn`.

    Parameters:
      `receiver` - the receiver, ignored for static methods
      `arguments` - the positional arguments (non-null; empty if none)
    Returns:
      the boxed result, or `null` for `void`
    Throws:
      `Throwable` - the target's thrown exception, unwrapped. A narrower type would wrap `Error` and checked exceptions the reflective path leaves as `ITE` causes.