Package: org.codehaus.groovy.ast.tools

## [Java] Class ParameterUtils

- org.codehaus.groovy.ast.tools.ParameterUtils

-     public class ParameterUtils
      extends Object

  Utility methods for working with method and constructor parameters.

  Provides predicates and comparison utilities for Parameter arrays, supporting parameter equality checks, compatibility analysis, and varargs detection. Used extensively in method resolution and signature matching during compilation and reflection.

  See Also:
    for the parameter node type
    for related type utilities

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static boolean` | `isVargs(Parameter[] parameters)` Checks if the last parameter in the array is a varargs parameter (array type).
    `` | `public static boolean` | `parametersCompatible(Parameter[] source, Parameter[] target)` Checks if source parameters are compatible with target parameters using type assignability.
    `` | `public static boolean` | `parametersEqual(Parameter[] a, Parameter[] b)` Checks if two parameter arrays have equal types (exact type matching).
    `` | `public static boolean` | `parametersEqualWithWrapperType(Parameter[] a, Parameter[] b)` Checks if two parameter arrays have equal types, treating wrapper and primitive types as equal.

  - ### Inherited Methods Summary

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

- - ### Method Detail

    - #### public static boolean isVargs(Parameter[] parameters)

      Checks if the last parameter in the array is a varargs parameter (array type).

      Parameters:
        `parameters` - the parameter array to check, may be null
      Returns:
        true if the array is non-empty and ends with an array-typed parameter, false otherwise
      Since:
        4.0.4

    - #### public static boolean parametersCompatible(Parameter[] source, Parameter[] target)

      Checks if source parameters are compatible with target parameters using type assignability. Each parameter type in source must be assignable to the corresponding target parameter type.

      Parameters:
        `source` - the source parameter array (may be null)
        `target` - the target parameter array (may be null)
      Returns:
        true if both arrays have the same length and all source types are assignable to target types, false otherwise
      Since:
        3.0.0
      See Also:
        StaticTypeCheckingSupport.isAssignableTo

    - #### public static boolean parametersEqual(Parameter[] a, Parameter[] b)

      Checks if two parameter arrays have equal types (exact type matching).

      Parameters:
        `a` - the first parameter array, may be null
        `b` - the second parameter array, may be null
      Returns:
        true if both arrays have the same length and parameter types match exactly, false otherwise
      Since:
        2.5.0
      See Also:
        parametersEqualWithWrapperType(Parameter[], Parameter[])

    - #### public static boolean parametersEqualWithWrapperType(Parameter[] a, Parameter[] b)

      Checks if two parameter arrays have equal types, treating wrapper and primitive types as equal.

      For example, `int.class` and `Integer.class` are considered equal.

      Parameters:
        `a` - the first parameter array, may be null
        `b` - the second parameter array, may be null
      Returns:
        true if both arrays have the same length and parameter types match (with wrapper equivalence), false otherwise
      Since:
        3.0.0
      See Also:
        parametersEqual(Parameter[], Parameter[])