Package org.codehaus.groovy.vmplugin.v8

# Class IndyGuardsFiltersAndSignatures

java.lang.Object
org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures

public class IndyGuardsFiltersAndSignatures extends Object
This class contains guards, runtime filters and MethodType signatures used by indy.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final MethodHandle`
  `ARRAYLIST_CONSTRUCTOR`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `BEAN_CONSTRUCTOR_PROPERTY_SETTER`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `BOOLEAN_IDENTITY`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `CLASS_FOR_NAME`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `DTT_CAST_TO_TYPE`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `EQUALS`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `GROOVY_CAST_EXCEPTION`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `GROOVY_OBJECT_GET_PROPERTY`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `GROOVY_OBJECT_INVOKER`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `GROOVY_OBJECT_SET_PROPERTY`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `HAS_CATEGORY_IN_CURRENT_THREAD_GUARD`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `HASHSET_CONSTRUCTOR`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `INTERCEPTABLE_INVOKER`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `IS_NULL`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `META_CLASS_INVOKE_METHOD`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `META_CLASS_INVOKE_STATIC_METHOD`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `META_METHOD_INVOKER`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `META_PROPERTY_GETTER`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `MOP_GET`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `MOP_INVOKE_CONSTRUCTOR`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `MOP_INVOKE_METHOD`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `MOP_SET`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `NON_NULL`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `NULL_REF`
  Constant handle that always returns `null`.
  `protected static final MethodHandle`
  `SAM_CONVERSION`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `SAME_CLASS`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `SAME_CLASSES`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `SAME_CLASSES_2`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `SAME_CLASSES_3`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `SAME_CLASSES_4`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `SAME_MC`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `SET_PROPERTY`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `SLOW_META_CLASS_FIND`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `UNWRAP_EXCEPTION`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.
  `protected static final MethodHandle`
  `UNWRAP_METHOD`
  Shared guards, filters, constructors, and invokers used when assembling indy call paths.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IndyGuardsFiltersAndSignatures()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Object`
  `invokeGroovyObjectInvoker(MissingMethodException e, Object receiver, String name, Object[] args)`
  `GroovyObject.invokeMethod(String, Object)` path as fallback.
  `static boolean`
  `isNull(Object o)`
  Guard to check if the argument is null.
  `static boolean`
  `isSameMetaClass(MetaClass mc, Object receiver)`
  called by handle
  `static boolean`
  `sameClass(Class<?> c, Object o)`
  Guard to check if the provided Object has the same class as the provided Class.
  `static boolean`
  `sameClasses(Class<?>[] cs, Object[] os)`
  Guard to check if the provided objects have the same class as the provided classes.
  `static boolean`
  `sameClasses(Class<?> c0, Class<?> c1, Class<?> c2, Class<?> c3, Object o0, Object o1, Object o2, Object o3)`
  Four-argument same-class guard; see `sameClasses(Class, Class, Object, Object)`.
  `static boolean`
  `sameClasses(Class<?> c0, Class<?> c1, Class<?> c2, Object o0, Object o1, Object o2)`
  Three-argument same-class guard; see `sameClasses(Class, Class, Object, Object)`.
  `static boolean`
  `sameClasses(Class<?> c0, Class<?> c1, Object o0, Object o1)`
  Two-argument same-class guard used by hot indy sites so `asCollector(Object[].class, n)` does not allocate an `Object[]` on every invocation.
  `static Object`
  `setBeanProperties(MetaClass mc, Object bean, Map properties)`
  This method is called by the handle to realize the bean constructor with property map.
  `static void`
  `setProperty(String name, Class<?> sender, Object receiver, Object value)`
  Adapter shim for the non-fast-path property write of the indy `SetPropertySelector`.
  `static Object`
  `unwrap(GroovyRuntimeException gre)`
  Unwraps a `GroovyRuntimeException`.
  `static Object`
  `unwrap(Object o)`
  Unwraps a `Wrapper`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SAME_CLASS

    protected static final MethodHandle SAME_CLASS
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### SAME_CLASSES

    protected static final MethodHandle SAME_CLASSES
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### SAME_CLASSES_2

    protected static final MethodHandle SAME_CLASSES_2
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### SAME_CLASSES_3

    protected static final MethodHandle SAME_CLASSES_3
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### SAME_CLASSES_4

    protected static final MethodHandle SAME_CLASSES_4
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### SAME_MC

    protected static final MethodHandle SAME_MC
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### IS_NULL

    protected static final MethodHandle IS_NULL
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### NON_NULL

    protected static final MethodHandle NON_NULL
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### UNWRAP_METHOD

    protected static final MethodHandle UNWRAP_METHOD
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### UNWRAP_EXCEPTION

    protected static final MethodHandle UNWRAP_EXCEPTION
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### HAS_CATEGORY_IN_CURRENT_THREAD_GUARD

    protected static final MethodHandle HAS_CATEGORY_IN_CURRENT_THREAD_GUARD
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### GROOVY_OBJECT_INVOKER

    protected static final MethodHandle GROOVY_OBJECT_INVOKER
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### GROOVY_OBJECT_GET_PROPERTY

    protected static final MethodHandle GROOVY_OBJECT_GET_PROPERTY
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### GROOVY_OBJECT_SET_PROPERTY

    protected static final MethodHandle GROOVY_OBJECT_SET_PROPERTY
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### META_METHOD_INVOKER

    protected static final MethodHandle META_METHOD_INVOKER
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### META_CLASS_INVOKE_METHOD

    protected static final MethodHandle META_CLASS_INVOKE_METHOD
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### META_CLASS_INVOKE_STATIC_METHOD

    protected static final MethodHandle META_CLASS_INVOKE_STATIC_METHOD
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### BEAN_CONSTRUCTOR_PROPERTY_SETTER

    protected static final MethodHandle BEAN_CONSTRUCTOR_PROPERTY_SETTER
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### META_PROPERTY_GETTER

    protected static final MethodHandle META_PROPERTY_GETTER
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### SLOW_META_CLASS_FIND

    protected static final MethodHandle SLOW_META_CLASS_FIND
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### MOP_GET

    protected static final MethodHandle MOP_GET
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### MOP_SET

    protected static final MethodHandle MOP_SET
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### SET_PROPERTY

    protected static final MethodHandle SET_PROPERTY
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### MOP_INVOKE_CONSTRUCTOR

    protected static final MethodHandle MOP_INVOKE_CONSTRUCTOR
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### MOP_INVOKE_METHOD

    protected static final MethodHandle MOP_INVOKE_METHOD
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### INTERCEPTABLE_INVOKER

    protected static final MethodHandle INTERCEPTABLE_INVOKER
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### BOOLEAN_IDENTITY

    protected static final MethodHandle BOOLEAN_IDENTITY
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### CLASS_FOR_NAME

    protected static final MethodHandle CLASS_FOR_NAME
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### DTT_CAST_TO_TYPE

    protected static final MethodHandle DTT_CAST_TO_TYPE
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### SAM_CONVERSION

    protected static final MethodHandle SAM_CONVERSION
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### HASHSET_CONSTRUCTOR

    protected static final MethodHandle HASHSET_CONSTRUCTOR
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### ARRAYLIST_CONSTRUCTOR

    protected static final MethodHandle ARRAYLIST_CONSTRUCTOR
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### GROOVY_CAST_EXCEPTION

    protected static final MethodHandle GROOVY_CAST_EXCEPTION
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### EQUALS

    protected static final MethodHandle EQUALS
    Shared guards, filters, constructors, and invokers used when assembling indy call paths.

  - ### NULL_REF

    protected static final MethodHandle NULL_REF
    Constant handle that always returns `null`.

- ## Constructor Details

  - ### IndyGuardsFiltersAndSignatures

    public IndyGuardsFiltersAndSignatures()

- ## Method Details

  - ### setProperty

    public static void setProperty(String name, Class<?> sender, Object receiver, Object value) throws Throwable
    Adapter shim for the non-fast-path property write of the indy `SetPropertySelector`. The parameter order — `name`, `sender`, `receiver`, `value` — is chosen so that binding the compile-time-known `name` and `sender` as a leading prefix with a single `MethodHandles.insertArguments(java.lang.invoke.MethodHandle, int, java.lang.Object...)` call leaves exactly the call-site shape `(receiver, value)void`, with no permute required. For now it just reorders into `ScriptBytecodeAdapter.setProperty(java.lang.Object, java.lang.Class, java.lang.Object, java.lang.String)`; this is also the natural seam for inlining that resolution logic in the future.
    Throws:
      `Throwable`

  - ### setBeanProperties

    public static Object setBeanProperties(MetaClass mc, Object bean, Map properties)
    This method is called by the handle to realize the bean constructor with property map.

  - ### invokeGroovyObjectInvoker

    public static Object invokeGroovyObjectInvoker(MissingMethodException e, Object receiver, String name, Object[] args)
    `GroovyObject.invokeMethod(String, Object)` path as fallback. This method is called by the handle as exception handler in case the selected method causes a MissingMethodExecutionFailed, where we will just give through the exception, and a normal MissingMethodException where we call `GroovyObject.invokeMethod(String, Object)` if receiver class, the type transported by the exception and the name for the method stored in the exception and our current method name are equal. Should those conditions not apply we just rethrow the exception.

  - ### unwrap

    public static Object unwrap(GroovyRuntimeException gre) throws Throwable
    Unwraps a `GroovyRuntimeException`. This method is called by the handle to unwrap internal exceptions of the runtime.
    Throws:
      `Throwable`

  - ### isSameMetaClass

    public static boolean isSameMetaClass(MetaClass mc, Object receiver)
    called by handle

  - ### unwrap

    public static Object unwrap(Object o)
    Unwraps a `Wrapper`. This method is called by the handle to unwrap a Wrapper, which we use to force method selection.

  - ### isNull

    public static boolean isNull(Object o)
    Guard to check if the argument is null. This method is called by the handle to check if the provided argument is null.

  - ### sameClass

    public static boolean sameClass(Class<?> c, Object o)
    Guard to check if the provided Object has the same class as the provided Class. This method will return false if the Object is null.

  - ### sameClasses

    public static boolean sameClasses(Class<?>[] cs, Object[] os)
    Guard to check if the provided objects have the same class as the provided classes.

  - ### sameClasses

    public static boolean sameClasses(Class<?> c0, Class<?> c1, Object o0, Object o1)
    Two-argument same-class guard used by hot indy sites so `asCollector(Object[].class, n)` does not allocate an `Object[]` on every invocation. `Selector` binds the expected classes with a single `MethodHandles.insertArguments(java.lang.invoke.MethodHandle, int, java.lang.Object...)` call.

  - ### sameClasses

    public static boolean sameClasses(Class<?> c0, Class<?> c1, Class<?> c2, Object o0, Object o1, Object o2)
    Three-argument same-class guard; see `sameClasses(Class, Class, Object, Object)`.

  - ### sameClasses

    public static boolean sameClasses(Class<?> c0, Class<?> c1, Class<?> c2, Class<?> c3, Object o0, Object o1, Object o2, Object o3)
    Four-argument same-class guard; see `sameClasses(Class, Class, Object, Object)`.