Package: org.codehaus.groovy.vmplugin.v8

## [Java] Class IndyCompoundAssign

- org.codehaus.groovy.vmplugin.v8.IndyCompoundAssign

-     public final class IndyCompoundAssign
      extends Object

  GEP-15: resolver for dynamic compound-assignment operators (`+=`, `-=`, ...).

  This class holds only the GEP-15-specific policy; the call-site lifecycle is owned by IndyInterface. A compound-assignment `op=` is emitted as an `invokedynamic` to IndyInterface.bootstrap with call type IndyInterface.CallType#COMPOUND_ASSIGN, so it rides the same boot handle, per-receiver-class inline cache, monomorphic-promotion and deopt-storm protection as a normal method call. IndyInterface.fallback routes resolution here via resolve.

  What remains GEP-15-specific:

  - the two operator names (`assignName`/`baseName`) packed into the bootstrap `name` and unpacked here;
  - a `respondsTo` probe to pick `*Assign` vs base — run only on a cache miss;
  - the in-place return-receiver composition for the assign branch;
  - a `(receiver class, arg class)` guard (arg class is part of the key so overloads stay correct), under the shared MOP switch point;
  - a generic fall back to ScriptBytecodeAdapter.compoundAssign for null/unresolved receivers.

  The actual invocation is built by Selector.selectInvokeHandle, so selection/coercion/vargs/category/exception handling match a normal call.

  WARNING: internal, indy-only. Not for use outside this package.

  Since:
    6.0.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static char` | `NAME_SEPARATOR` | Separator packing `assignName` and `baseName` into one bootstrap constant (NUL cannot appear in a JVM method name, even a Groovy quoted one).

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static boolean` | `guard(Class<?> rc, Class<?> ac, Object receiver, Object arg)` Guard: receiver and argument runtime classes both match the cached shape.
    `` | `public static String` | `packNames(String assignName, String baseName)` Packs the two operator names into a single bootstrap `name` constant.
    `` | `public static MethodHandleWrapper` | `resolve(CacheableCallSite callSite, Class<?> sender, String packedNames, Object[] arguments)` Resolves the invocation for one receiver/arg shape and returns a MethodHandleWrapper for IndyInterface's inline cache.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### public static final char NAME_SEPARATOR

      Separator packing `assignName` and `baseName` into one bootstrap constant (NUL cannot appear in a JVM method name, even a Groovy quoted one).

  - ### Method Detail

    - #### public static boolean guard(Class<?> rc, Class<?> ac, Object receiver, Object arg)

      Guard: receiver and argument runtime classes both match the cached shape.

    - #### public static String packNames(String assignName, String baseName)

      Packs the two operator names into a single bootstrap `name` constant. Called from code generation.

    - #### public static MethodHandleWrapper resolve(CacheableCallSite callSite, Class<?> sender, String packedNames, Object[] arguments)

      Resolves the invocation for one receiver/arg shape and returns a MethodHandleWrapper for IndyInterface's inline cache. The wrapper's target handle is `(Object receiver, Object arg) -> Object`, guarded on the receiver/arg classes and the shared MOP switch point with the call site's fallback (re-resolve) path as the else-branch.

      Parameters:
        `callSite` - the compound-assignment call site (type `(Object,Object)->Object`)
        `sender` - the sending class
        `packedNames` - `assignName` and `baseName` joined by NAME_SEPARATOR
        `arguments` - the runtime arguments: `[receiver, arg]`