Package org.codehaus.groovy.ast.tools

# Class ParameterUtils

java.lang.Object
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`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ParameterUtils()`

- ## Method Summary

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

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

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

- ## Constructor Details

  - ### ParameterUtils

    public ParameterUtils()

- ## Method Details

  - ### isVargs

    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

  - ### parametersEqual

    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[])`

  - ### parametersEqualWithWrapperType

    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[])`

  - ### parametersCompatible

    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(ClassNode, ClassNode)`