Package: org.apache.groovy.runtime

## [Java] Class ObjectUtil

- org.apache.groovy.runtime.ObjectUtil

-     @Deprecated
      public class ObjectUtil
      extends Object

  Binary-compatibility facade for class files compiled by Groovy 4.0.5+ (GROOVY-12257).

  The `@Immutable` transform in Groovy 4.0.5 through 4.0.x emitted `INVOKESTATIC` calls to cloneObject(Object) into generated constructors and getters for defensive copies (GROOVY-10747). The original class was removed together with the `$getLookup` machinery it relied on (GROOVY-10931), which broke such pre-compiled classes with a NoClassDefFoundError at first instantiation. This facade restores the call target with equivalent behaviour, minus the lookup dependency: arrays are cloned via ArrayUtil exactly as before, and other Cloneables through their public `clone()` via the MOP.

  Nothing compiled by Groovy 5+ references this class; its transforms emit `invokedynamic`-based or `InvokerHelper` clone calls instead.

  deprecated:
    retained only so Groovy 4 compiled bytecode keeps linking; not emitted by any current transform and not intended for direct use
  Since:
    4.0.5

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `<T>` | `public static T` | `cloneObject(T object)` Clone the specified object

  - ### Inherited Methods Summary

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

- - ### Method Detail

    - #### <T> @SuppressWarnings("unchecked")
      public static T cloneObject(T object)

      Clone the specified object

      throws:
        Throwable some exception or error
      Parameters:
        `object` - the object to clone
      Returns:
        the cloned object
      Type Parameters:
        `T` - the object type
      Since:
        4.0.5