Package: org.codehaus.groovy.ast.tools

## [Java] Class GeneralUtils

- org.codehaus.groovy.ast.tools.GeneralUtils

-     public class GeneralUtils
      extends Object

  Handy methods when working with the Groovy AST. Provides factory methods for creating common AST nodes and utility methods for expression and statement construction.

  This utility class offers shorthand methods (often with abbreviated names) for building AST structures:

  - Statement constructors: `block()`, `expr()`, `assign()`, `ret()`, etc.
  - Expression constructors: `var()`, `constX()`, `classX()`, `cast()`, etc.
  - Operator expressions: `binX()`, `andX()`, `orX()`, `cmp()`, etc.
  - Collection literals: `list()`, `map()`, `tuple()`, `array()`, etc.
  - Method calls: `call()`, `invokeMethod()`, `staticCall()`, etc.

  Common patterns use abbreviated names like `X` suffix for expression factories (e.g., `varX()` for VariableExpression) and `S` suffix for statement factories (e.g., `blockS()` for BlockStatement).

  Null Handling: Most methods handle null gracefully, often returning empty or no-op structures rather than throwing exceptions.

  See Also:
    for the base expression type
    for the base statement type
    for type information
    for generic type utilities

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `enum` | `GeneralUtils.ConditionValue` | Represents the compile-time constant value of a boolean loop-condition or branch expression.

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static Token` | `AND` | AST logical AND operator token ("&&").
    `static Token` | `ASSIGN` | AST assignment operator token ("=").
    `static Token` | `CMP` | AST compare-to operator token ("<=>").
    `static Token` | `EQ` | AST equality operator token ("==").
    `static Token` | `GE` | AST greater-than-or-equal operator token (">=").
    `static Token` | `GT` | AST greater-than operator token (">").
    `static Token` | `INSTANCEOF` | AST instanceof keyword token.
    `static Token` | `LE` | AST less-than-or-equal operator token ("<=").
    `static Token` | `LT` | AST less-than operator token ("<").
    `static Token` | `MINUS` | AST subtraction operator token ("-").
    `static Token` | `NE` | AST inequality operator token ("!
    `static Token` | `NOT_IDENTICAL` | AST non-identity operator token ("!
    `static Token` | `OR` | AST logical OR operator token ("||").
    `static Token` | `PLUS` | AST addition operator token ("+").

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static BinaryExpression` | `andX(Expression lhv, Expression rhv)` Creates a binary expression with the AND operator joining two expressions.
    `` | `public static ArgumentListExpression` | `args(Expression expressions)` Creates an ArgumentListExpression from individual expression arguments.
    `` | `public static ArgumentListExpression` | `args(List<Expression> expressions)` Creates an ArgumentListExpression from a list of expressions.
    `` | `public static ArgumentListExpression` | `args(Parameter parameters)` Creates an ArgumentListExpression from parameter nodes, extracting their names as variable references.
    `` | `public static ArgumentListExpression` | `args(String names)` Creates an ArgumentListExpression from variable names, converting each to a VariableExpression.
    `` | `public static ArrayExpression` | `arrayX(ClassNode elementType, List<Expression> initExpressions)` Creates an ArrayExpression for the given element type and initial value expressions.
    `` | `public static ArrayExpression` | `arrayX(ClassNode elementType, List<Expression> initExpressions, List<Expression> sizeExpressions)` Creates an ArrayExpression for the given element type, dimensions, and initial values.
    `` | `public static CastExpression` | `asX(ClassNode type, Expression expression)` Creates a CastExpression converting the given expression to the specified type.
    `` | `public static Statement` | `assignNullS(Expression target)` Creates a statement that assigns a null/empty value to the target expression.
    `` | `public static Statement` | `assignS(Expression target, Expression value)` Creates an assignment statement for the supplied target and value.
    `` | `public static Expression` | `assignX(Expression target, Expression value)` Creates an assignment expression using ASSIGN.
    `` | `public static AttributeExpression` | `attrX(Expression owner, String attribute)` Since: 5.0.0
    `` | `public static AttributeExpression` | `attrX(Expression owner, Expression attribute)` Creates an attribute access expression.
    `` | `public static BinaryExpression` | `binX(Expression left, Token token, Expression right)` Creates a binary expression from operands and an operator token.
    `` | `public static BlockStatement` | `block(VariableScope scope, Statement stmts)` Creates a block statement from statements and optional scope.
    `` | `public static BlockStatement` | `block(VariableScope scope, List<Statement> stmts)` Creates a block statement from statements and optional scope.
    `` | `public static BlockStatement` | `block(Statement stmts)` Creates a block statement from statements and optional scope.
    `` | `public static BooleanExpression` | `boolX(Expression expr)` Wraps an expression in a BooleanExpression.
    `` | `public static BytecodeExpression` | `bytecodeX(Consumer<org.objectweb.asm.MethodVisitor> writer)` Creates a custom BytecodeExpression.
    `` | `public static BytecodeExpression` | `bytecodeX(ClassNode type, Consumer<org.objectweb.asm.MethodVisitor> writer)` Creates a custom BytecodeExpression.
    `` | `public static MethodCallExpression` | `callSuperX(String methodName)` Creates a method call expression on `super`.
    `` | `public static MethodCallExpression` | `callSuperX(String methodName, Expression args)` Creates a method call expression on `super`.
    `` | `public static MethodCallExpression` | `callThisX(String methodName)` Creates a method call expression on `this`.
    `` | `public static MethodCallExpression` | `callThisX(String methodName, Expression args)` Creates a method call expression on `this`.
    `` | `public static MethodCallExpression` | `callX(Expression receiver, String methodName)` Creates a method call expression.
    `` | `public static MethodCallExpression` | `callX(Expression receiver, String methodName, Expression args)` Creates a method call expression.
    `` | `public static MethodCallExpression` | `callX(Expression receiver, Expression method, Expression args)` Creates a method call expression.
    `` | `public static StaticMethodCallExpression` | `callX(ClassNode receiver, String methodName)` Creates a method call expression.
    `` | `public static StaticMethodCallExpression` | `callX(ClassNode receiver, String methodName, Expression args)` Creates a method call expression.
    `` | `public static CaseStatement` | `caseS(Expression expression, Statement code)` Creates a switch-case statement.
    `` | `public static CastExpression` | `castX(ClassNode type, Expression expression)` Creates a cast expression.
    `` | `public static CastExpression` | `castX(ClassNode type, Expression expression, boolean ignoreAutoboxing)` Creates a cast expression.
    `` | `public static CatchStatement` | `catchS(Parameter variable, Statement code)` Creates a catch statement.
    `` | `public static ListExpression` | `classList2args(List<String> args)` Converts class-name strings into class-literal expressions.
    `` | `public static ClassExpression` | `classX(ClassNode clazz)` Creates a class literal expression.
    `` | `public static ClassExpression` | `classX(Class<?> clazz)` Creates a class literal expression.
    `` | `public static Parameter[]` | `cloneParams(Parameter[] parameters)` Clones parameter metadata as new Parameter instances with original type and name.
    `` | `public static ClosureExpression` | `closureX(Parameter[] params, Statement code)` Creates a closure expression.
    `` | `public static ClosureExpression` | `closureX(Statement code)` Creates a closure expression.
    `` | `public static BinaryExpression` | `cmpX(Expression lhv, Expression rhv)` Builds a binary expression that compares two values.
    `` | `public static ConstantExpression` | `constX(Object val)` Creates a constant expression.
    `` | `public static ConstantExpression` | `constX(Object val, boolean keepPrimitive)` Creates a constant expression.
    `` | `public static String` | `convertASTToSource(ReaderSource readerSource, ASTNode expression)` Converts an expression into the String source.
    `` | `public static void` | `copyAnnotatedNodeAnnotations(AnnotatedNode annotatedNode, List<AnnotationNode> copied, List<AnnotationNode> notCopied)` Copies all `candidateAnnotations` with retention policy RetentionPolicy.RUNTIME and RetentionPolicy.CLASS.
    `` | `public static void` | `copyAnnotatedNodeAnnotations(AnnotatedNode annotatedNode, List<AnnotationNode> copied, List<AnnotationNode> notCopied, boolean includeGenerated)` Copies all `candidateAnnotations` with retention policy RetentionPolicy.RUNTIME and RetentionPolicy.CLASS.
    `` | `public static boolean` | `copyStatementsWithSuperAdjustment(ClosureExpression pre, BlockStatement body)` Copies closure statements into a block and rewrites a leading `super(...)` call when present.
    `` | `public static Statement` | `createConstructorStatementDefault(FieldNode fNode)` Builds default constructor-assignment logic for a field and matching argument.
    `` | `public static Statement` | `ctorSuperS(Expression args)` Creates a `super(...)` constructor call statement.
    `` | `public static Statement` | `ctorSuperS()` Creates a `super(...)` constructor call statement.
    `` | `public static ConstructorCallExpression` | `ctorSuperX(Expression args)` Creates a `super(...)` constructor call expression.
    `` | `public static ConstructorCallExpression` | `ctorSuperX()` Creates a `super(...)` constructor call expression.
    `` | `public static Statement` | `ctorThisS(Expression args)` Creates a `this(...)` constructor call statement.
    `` | `public static Statement` | `ctorThisS()` Creates a `this(...)` constructor call statement.
    `` | `public static ConstructorCallExpression` | `ctorThisX(Expression args)` Creates a `this(...)` constructor call expression.
    `` | `public static ConstructorCallExpression` | `ctorThisX()` Creates a `this(...)` constructor call expression.
    `` | `public static ConstructorCallExpression` | `ctorX(ClassNode type, Expression args)` Creates a constructor call expression.
    `` | `public static ConstructorCallExpression` | `ctorX(ClassNode type)` Creates a constructor call expression.
    `` | `public static Statement` | `declS(Expression target, Expression init)` Creates a variable declaration statement.
    `` | `public static DeclarationExpression` | `declX(Expression target, Expression init)` Creates a variable declaration expression.
    `` | `public static ConstantExpression` | `defaultValueX(ClassNode type)` Returns a constant expression with the default value for the given type (i.e., `false` for boolean, `0` for numbers or `null`).
    `` | `public static ElvisOperatorExpression` | `elvisX(Expression base, Expression otherwise)` Creates an Elvis operator expression.
    `` | `public static MapEntryExpression` | `entryX(Expression key, Expression value)` Creates a map entry expression.
    `` | `public static BinaryExpression` | `eqX(Expression left, Expression right)` Creates an equality comparison expression.
    `` | `public static BooleanExpression` | `equalsNullX(Expression expr)` Creates a null-equality test expression.
    `` | `public static FieldExpression` | `fieldX(FieldNode fieldNode)` Creates a field expression.
    `` | `public static FieldExpression` | `fieldX(ClassNode owner, String fieldName)` Creates a field expression.
    `` | `public static Expression` | `findArg(String argName)` Creates an expression that resolves an entry from script args.
    `` | `public static MethodNode` | `findDeclaredMethod(ClassNode cNode, String name, int argsCount)` Finds the first declared method with the specified name and arity.
    `` | `public static ForStatement` | `forS(Parameter variable, Expression collectionExpression, Statement loopS)` Creates a for-loop statement.
    `` | `public static BinaryExpression` | `geX(Expression lhv, Expression rhv)` Creates a greater-than-or-equal comparison expression.
    `` | `public static List<MethodNode>` | `getAllMethods(ClassNode type)` Collects methods declared on a class and its super classes.
    `` | `public static List<PropertyNode>` | `getAllProperties(ClassNode type)` Collects properties according to the supplied inclusion flags.
    `` | `public static List<PropertyNode>` | `getAllProperties(Set<String> names, ClassNode cNode, boolean includeProperties, boolean includeFields, boolean includePseudoGetters, boolean includePseudoSetters, boolean traverseSuperClasses, boolean skipReadonly)` Collects properties according to the supplied inclusion flags.
    `` | `public static List<PropertyNode>` | `getAllProperties(Set<String> names, ClassNode origType, ClassNode cNode, boolean includeProperties, boolean includeFields, boolean includePseudoGetters, boolean includePseudoSetters, boolean traverseSuperClasses, boolean skipReadonly)` Collects properties according to the supplied inclusion flags.
    `` | `public static List<PropertyNode>` | `getAllProperties(Set<String> names, ClassNode origType, ClassNode cNode, boolean includeProperties, boolean includeFields, boolean includePseudoGetters, boolean includePseudoSetters, boolean traverseSuperClasses, boolean skipReadonly, boolean reverse, boolean allNames, boolean includeStatic)` Collects properties according to the supplied inclusion flags.
    `` | `public static String` | `getGetterName(PropertyNode pNode)` Generally preferred to use PropertyNode.getGetterNameOrDefault directly.
    `` | `public static String` | `getGetterName(String name, Class<?> type)` WARNING: Avoid this method unless just the name and type are available.
    `` | `public static String` | `getGetterName(String name)` WARNING: Avoid this method unless just the name is available.
    `` | `public static List<String>` | `getInstanceNonPropertyFieldNames(ClassNode cNode)` Collects names of instance fields that are not exposed as properties.
    `` | `public static List<FieldNode>` | `getInstanceNonPropertyFields(ClassNode cNode)` Collects instance fields that are not exposed as properties.
    `` | `public static List<PropertyNode>` | `getInstanceProperties(ClassNode cNode)` Collects instance (non-static) properties.
    `` | `public static List<FieldNode>` | `getInstancePropertyFields(ClassNode cNode)` Collects backing fields for instance properties.
    `` | `public static List<String>` | `getInstancePropertyNames(ClassNode cNode)` Collects names of instance properties.
    `` | `public static Set<ClassNode>` | `getInterfacesAndSuperInterfaces(ClassNode cNode)` Collects interfaces implemented directly or transitively.
    `` | `public static String` | `getSetterName(String name)` Computes the JavaBean setter name for a property.
    `` | `public static List<FieldNode>` | `getSuperNonPropertyFields(ClassNode cNode)` Collects inherited instance fields that are not properties.
    `` | `public static List<FieldNode>` | `getSuperPropertyFields(ClassNode cNode)` Collects inherited property backing fields.
    `` | `public static Expression` | `getterThisX(ClassNode annotatedNode, PropertyNode pNode)` This method is similar to propX(Expression, Expression) but will make sure that if the property being accessed is defined inside the classnode provided as a parameter, then a getter call is generated instead of a field access.
    `` | `public static Expression` | `getterX(ClassNode annotatedNode, Expression receiver, PropertyNode pNode)` This method is similar to propX(Expression, Expression) but will make sure that if the property being accessed is defined inside the classnode provided as a parameter, then a getter call is generated instead of a field access.
    `` | `public static BinaryExpression` | `gtX(Expression lhv, Expression rhv)` Creates a greater-than comparison expression.
    `` | `public static BinaryExpression` | `hasClassX(Expression instance, ClassNode cNode)` Creates an expression testing whether `instance.getClass()` equals the supplied class.
    `` | `public static boolean` | `hasDeclaredMethod(ClassNode cNode, String name, int argsCount)` Checks whether a class declares a method with the specified name and arity.
    `` | `public static BinaryExpression` | `hasEqualFieldX(FieldNode fNode, Expression other)` Creates an equality comparison against another object's field value.
    `` | `public static BinaryExpression` | `hasEqualPropertyX(ClassNode cNode, PropertyNode pNode, VariableExpression other)` Creates an equality comparison against another object's property value.
    `` | `public static BinaryExpression` | `hasEqualPropertyX(PropertyNode pNode, Expression other)` Creates an equality comparison against another object's property value.
    `` | `public static BooleanExpression` | `hasSameFieldX(FieldNode fNode, Expression other)` Creates an identity comparison against another object's field value.
    `` | `public static BooleanExpression` | `hasSamePropertyX(PropertyNode pNode, Expression other)` Creates an identity comparison against another object's property value.
    `` | `public static IfStatement` | `ifElseS(Expression cond, Statement thenStmt, Statement elseStmt)` Creates an if/else statement.
    `` | `public static IfStatement` | `ifS(Expression cond, Expression trueExpr)` Creates an if statement with an empty else branch.
    `` | `public static IfStatement` | `ifS(Expression cond, Statement trueStmt)` Creates an if statement with an empty else branch.
    `` | `public static boolean` | `inSamePackage(ClassNode first, ClassNode second)` Checks whether two classes belong to the same package.
    `` | `public static boolean` | `inSamePackage(Class<?> first, Class<?> second)` Checks whether two classes belong to the same package.
    `` | `public static Expression` | `indexX(Expression target, Expression value)` Creates an index access expression.
    `` | `public static boolean` | `isDefaultVisibility(int modifiers)` Checks whether modifier bits indicate package-private visibility.
    `` | `public static BooleanExpression` | `isInstanceOfX(Expression expr, ClassNode type)` Creates an `instanceof` test expression.
    `` | `public static BooleanExpression` | `isNullOrInstanceOfX(Expression expr, ClassNode type)` Since: 4.0.8
    `` | `public static BooleanExpression` | `isNullX(Expression expr)` Alias for equalsNullX(Expression)
    `` | `public static BooleanExpression` | `isOneX(Expression expr)` Creates an equality test against numeric one.
    `` | `public static boolean` | `isOrImplements(ClassNode type, ClassNode interfaceType)` Checks whether a type equals or implements an interface type.
    `` | `public static BooleanExpression` | `isTrueX(Expression argExpr)` Creates an equality test against Boolean.TRUE.
    `` | `public static BooleanExpression` | `isZeroX(Expression expr)` Creates an equality test against numeric zero.
    `` | `public static LambdaExpression` | `lambdaX(Parameter[] params, Statement code)` Builds a lambda expression
    `` | `public static LambdaExpression` | `lambdaX(Statement code)` Builds a lambda expression with no parameters
    `` | `public static BinaryExpression` | `leX(Expression lhv, Expression rhv)` Creates a less-than-or-equal comparison expression.
    `` | `public static ListExpression` | `list2args(List<?> args)` Converts values into a constant-based list expression.
    `` | `public static ListExpression` | `listX(List<Expression> args)` Creates a list expression.
    `` | `public static VariableExpression` | `localVarX(String name)` Creates a local variable expression and marks it as the accessed variable.
    `` | `public static VariableExpression` | `localVarX(String name, ClassNode type)` Creates a local variable expression and marks it as the accessed variable.
    `` | `public static BinaryExpression` | `ltX(Expression lhv, Expression rhv)` Creates a less-than comparison expression.
    `` | `public static String` | `makeDescriptorWithoutReturnType(MethodNode mn)` deprecated: use MethodNodeUtils#methodDescriptorWithoutReturnType(MethodNode) instead
    `` | `public static MapEntryExpression` | `mapEntryX(Expression keyExpr, Expression valueExpr)` Creates a map entry expression.
    `` | `public static MapEntryExpression` | `mapEntryX(String key, Expression valueExpr)` Creates a map entry expression.
    `` | `public static MapExpression` | `mapX()` Creates a map expression.
    `` | `public static MapExpression` | `mapX(List<MapEntryExpression> expressions)` Creates a map expression.
    `` | `public static boolean` | `maybeFallsThrough(Statement statement)` Determines whether execution may continue past the supplied statement.
    `` | `public static BinaryExpression` | `minusX(Expression lhv, Expression rhv)` Creates a subtraction expression.
    `` | `public static BinaryExpression` | `neX(Expression lhv, Expression rhv)` Creates an inequality comparison expression.
    `` | `public static BinaryExpression` | `notIdenticalX(Expression lhv, Expression rhv)` Creates a non-identity comparison expression.
    `` | `public static BooleanExpression` | `notNullX(Expression expr)` Creates a non-null test expression.
    `` | `public static NotExpression` | `notX(Expression expr)` Creates a logical NOT expression.
    `` | `public static ConstantExpression` | `nullX()` Creates a `null` constant expression.
    `` | `public static BinaryExpression` | `orX(Expression lhv, Expression rhv)` Creates a logical OR expression.
    `` | `public static Parameter` | `param(ClassNode type, String name)` Creates a parameter node.
    `` | `public static Parameter` | `param(ClassNode type, String name, Expression initialExpression)` Creates a parameter node.
    `` | `public static Parameter[]` | `params(Parameter params)` Returns the input parameters or Parameter.EMPTY_ARRAY when input is `null`.
    `` | `public static BinaryExpression` | `plusX(Expression lhv, Expression rhv)` Creates an addition expression.
    `` | `public static PropertyExpression` | `propX(Expression owner, String property)` Creates a property access expression.
    `` | `public static PropertyExpression` | `propX(Expression owner, Expression property)` Creates a property access expression.
    `` | `public static PropertyExpression` | `propX(Expression owner, Expression property, boolean safe)` Creates a property access expression.
    `` | `public static Statement` | `returnS(Expression expr)` Creates a return statement.
    `` | `public static Statement` | `safeExpression(Expression fieldExpr, Expression expression)` Creates a null-guarded statement sequence.
    `` | `public static BooleanExpression` | `sameX(Expression self, Expression other)` Creates an identity test expression using Groovy's `is` method.
    `` | `public static SpreadExpression` | `spreadX(Expression expr)` Creates a spread expression.
    `` | `public static Statement` | `stmt(Expression expr)` Wraps an expression in an ExpressionStatement.
    `` | `public static SwitchStatement` | `switchS(Expression expr)` Creates a switch statement.
    `` | `public static SwitchStatement` | `switchS(Expression expr, Statement defaultStatement)` Creates a switch statement.
    `` | `public static SwitchStatement` | `switchS(Expression expr, List<CaseStatement> caseStatements, Statement defaultStatement)` Creates a switch statement.
    `` | `public static TernaryExpression` | `ternaryX(Expression cond, Expression trueExpr, Expression elseExpr)` Creates a ternary expression.
    `` | `public static PropertyExpression` | `thisPropX(boolean implicit, String property)` Creates a property expression on `this` with configurable implicit-this behavior.
    `` | `public static ThrowStatement` | `throwS(Expression expr)` Creates a throw statement.
    `` | `public static TryCatchStatement` | `tryCatchS(Statement tryStatement)` Creates a try/catch/finally statement.
    `` | `public static TryCatchStatement` | `tryCatchS(Statement tryStatement, Statement finallyStatement)` Creates a try/catch/finally statement.
    `` | `public static TryCatchStatement` | `tryCatchS(Statement tryStatement, Statement finallyStatement, CatchStatement catchStatements)` Creates a try/catch/finally statement.
    `` | `public static VariableExpression` | `varX(String name)` Creates a variable expression.
    `` | `public static VariableExpression` | `varX(Variable variable)` Creates a variable expression.
    `` | `public static VariableExpression` | `varX(String name, ClassNode type)` Creates a variable expression.

  - ### 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 Token AND

      AST logical AND operator token ("&&").

    - #### public static final Token ASSIGN

      AST assignment operator token ("=").

    - #### public static final Token CMP

      AST compare-to operator token ("<=>").

    - #### public static final Token EQ

      AST equality operator token ("==").

    - #### public static final Token GE

      AST greater-than-or-equal operator token (">=").

    - #### public static final Token GT

      AST greater-than operator token (">").

    - #### public static final Token INSTANCEOF

      AST instanceof keyword token.

    - #### public static final Token LE

      AST less-than-or-equal operator token ("<=").

    - #### public static final Token LT

      AST less-than operator token ("<").

    - #### public static final Token MINUS

      AST subtraction operator token ("-").

    - #### public static final Token NE

      AST inequality operator token ("!=").

    - #### public static final Token NOT_IDENTICAL

      AST non-identity operator token ("!==").

    - #### public static final Token OR

      AST logical OR operator token ("||").

    - #### public static final Token PLUS

      AST addition operator token ("+").

  - ### Method Detail

    - #### public static BinaryExpression andX(Expression lhv, Expression rhv)

      Creates a binary expression with the AND operator joining two expressions.

      Parameters:
        `lhv` - the left-hand-side operand
        `rhv` - the right-hand-side operand
      Returns:
        a BinaryExpression with AND operator
      See Also:
        binX(Expression, Token, Expression)

    - #### public static ArgumentListExpression args(Expression expressions)

      Creates an ArgumentListExpression from individual expression arguments.

      Parameters:
        `expressions` - the argument expressions (may be empty)
      Returns:
        an ArgumentListExpression containing the arguments

    - #### public static ArgumentListExpression args(List<Expression> expressions)

      Creates an ArgumentListExpression from a list of expressions.

      Parameters:
        `expressions` - the list of argument expressions (may be empty)
      Returns:
        an ArgumentListExpression containing the arguments

    - #### public static ArgumentListExpression args(Parameter parameters)

      Creates an ArgumentListExpression from parameter nodes, extracting their names as variable references.

      Parameters:
        `parameters` - the parameter nodes
      Returns:
        an ArgumentListExpression with variable expressions for each parameter

    - #### public static ArgumentListExpression args(String names)

      Creates an ArgumentListExpression from variable names, converting each to a VariableExpression.

      Parameters:
        `names` - the variable names (non-null strings)
      Returns:
        an ArgumentListExpression with variable expressions for each name

    - #### public static ArrayExpression arrayX(ClassNode elementType, List<Expression> initExpressions)

      Creates an ArrayExpression for the given element type and initial value expressions.

      Parameters:
        `elementType` - the ClassNode representing the array element type
        `initExpressions` - the expressions providing initial array values
      Returns:
        an ArrayExpression with the given element type and values

    - #### public static ArrayExpression arrayX(ClassNode elementType, List<Expression> initExpressions, List<Expression> sizeExpressions)

      Creates an ArrayExpression for the given element type, dimensions, and initial values.

      Parameters:
        `elementType` - the ClassNode representing the array element type
        `initExpressions` - the expressions providing initial array values
        `sizeExpressions` - the expressions providing array dimensions
      Returns:
        an ArrayExpression with the given element type, dimensions, and values

    - #### public static CastExpression asX(ClassNode type, Expression expression)

      Creates a CastExpression converting the given expression to the specified type.

      Parameters:
        `type` - the ClassNode to cast to
        `expression` - the expression to cast
      Returns:
        a CastExpression with the given type and expression

    - #### public static Statement assignNullS(Expression target)

      Creates a statement that assigns a null/empty value to the target expression. Used to clear or reset variable values.

      Parameters:
        `target` - the expression to assign to
      Returns:
        an ExpressionStatement assigning null to the target

    - #### public static Statement assignS(Expression target, Expression value)

      Creates an assignment statement for the supplied target and value.

      Parameters:
        `target` - the assignment target expression
        `value` - the value expression
      Returns:
        the resulting Statement

    - #### public static Expression assignX(Expression target, Expression value)

      Creates an assignment expression using ASSIGN.

      Parameters:
        `target` - the assignment target expression
        `value` - the value expression
      Returns:
        the resulting Expression

    - #### public static AttributeExpression attrX(Expression owner, String attribute)

      Since:
        5.0.0

    - #### public static AttributeExpression attrX(Expression owner, Expression attribute)

      Creates an attribute access expression.

      Parameters:
        `owner` - the owner expression
        `attribute` - the attribute expression
      Returns:
        the resulting AttributeExpression

    - #### public static BinaryExpression binX(Expression left, Token token, Expression right)

      Creates a binary expression from operands and an operator token.

      Parameters:
        `left` - the left-hand operand
        `token` - the operator token
        `right` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### public static BlockStatement block(VariableScope scope, Statement stmts)

      Creates a block statement from statements and optional scope.

      Parameters:
        `scope` - the variable scope for the block
        `stmts` - the statements to include in the block
      Returns:
        the resulting BlockStatement

    - #### public static BlockStatement block(VariableScope scope, List<Statement> stmts)

      Creates a block statement from statements and optional scope.

      Parameters:
        `scope` - the variable scope for the block
        `stmts` - the statements to include in the block
      Returns:
        the resulting BlockStatement

    - #### public static BlockStatement block(Statement stmts)

      Creates a block statement from statements and optional scope.

      Parameters:
        `stmts` - the statements to include in the block
      Returns:
        the resulting BlockStatement

    - #### public static BooleanExpression boolX(Expression expr)

      Wraps an expression in a BooleanExpression.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting BooleanExpression

    - #### public static BytecodeExpression bytecodeX(Consumer<org.objectweb.asm.MethodVisitor> writer)

      Creates a custom BytecodeExpression.

      Parameters:
        `writer` - the bytecode writer callback
      Returns:
        the resulting BytecodeExpression

    - #### public static BytecodeExpression bytecodeX(ClassNode type, Consumer<org.objectweb.asm.MethodVisitor> writer)

      Creates a custom BytecodeExpression.

      Parameters:
        `type` - the target type
        `writer` - the bytecode writer callback
      Returns:
        the resulting BytecodeExpression

    - #### public static MethodCallExpression callSuperX(String methodName)

      Creates a method call expression on `super`.

      Parameters:
        `methodName` - the method name
      Returns:
        the resulting MethodCallExpression

    - #### public static MethodCallExpression callSuperX(String methodName, Expression args)

      Creates a method call expression on `super`.

      Parameters:
        `methodName` - the method name
        `args` - the argument expression(s)
      Returns:
        the resulting MethodCallExpression

    - #### public static MethodCallExpression callThisX(String methodName)

      Creates a method call expression on `this`.

      Parameters:
        `methodName` - the method name
      Returns:
        the resulting MethodCallExpression

    - #### public static MethodCallExpression callThisX(String methodName, Expression args)

      Creates a method call expression on `this`.

      Parameters:
        `methodName` - the method name
        `args` - the argument expression(s)
      Returns:
        the resulting MethodCallExpression

    - #### public static MethodCallExpression callX(Expression receiver, String methodName)

      Creates a method call expression.

      Parameters:
        `receiver` - the call receiver
        `methodName` - the method name
      Returns:
        the resulting MethodCallExpression

    - #### public static MethodCallExpression callX(Expression receiver, String methodName, Expression args)

      Creates a method call expression.

      Parameters:
        `receiver` - the call receiver
        `methodName` - the method name
        `args` - the argument expression(s)
      Returns:
        the resulting MethodCallExpression

    - #### public static MethodCallExpression callX(Expression receiver, Expression method, Expression args)

      Creates a method call expression.

      Parameters:
        `receiver` - the call receiver
        `method` - the method expression
        `args` - the argument expression(s)
      Returns:
        the resulting MethodCallExpression

    - #### public static StaticMethodCallExpression callX(ClassNode receiver, String methodName)

      Creates a method call expression.

      Parameters:
        `receiver` - the call receiver
        `methodName` - the method name
      Returns:
        the resulting StaticMethodCallExpression

    - #### public static StaticMethodCallExpression callX(ClassNode receiver, String methodName, Expression args)

      Creates a method call expression.

      Parameters:
        `receiver` - the call receiver
        `methodName` - the method name
        `args` - the argument expression(s)
      Returns:
        the resulting StaticMethodCallExpression

    - #### public static CaseStatement caseS(Expression expression, Statement code)

      Creates a switch-case statement.

      Parameters:
        `expression` - the expression
        `code` - the statement body
      Returns:
        the resulting CaseStatement

    - #### public static CastExpression castX(ClassNode type, Expression expression)

      Creates a cast expression.

      Parameters:
        `type` - the target type
        `expression` - the expression
      Returns:
        the resulting CastExpression

    - #### public static CastExpression castX(ClassNode type, Expression expression, boolean ignoreAutoboxing)

      Creates a cast expression.

      Parameters:
        `type` - the target type
        `expression` - the expression
        `ignoreAutoboxing` - whether autoboxing should be ignored
      Returns:
        the resulting CastExpression

    - #### public static CatchStatement catchS(Parameter variable, Statement code)

      Creates a catch statement.

      Parameters:
        `variable` - the loop or catch parameter
        `code` - the statement body
      Returns:
        the resulting CatchStatement

    - #### public static ListExpression classList2args(List<String> args)

      Converts class-name strings into class-literal expressions.

      Parameters:
        `args` - the argument expression(s)
      Returns:
        the resulting ListExpression

    - #### public static ClassExpression classX(ClassNode clazz)

      Creates a class literal expression.

      Parameters:
        `clazz` - the class reference
      Returns:
        the resulting ClassExpression

    - #### public static ClassExpression classX(Class<?> clazz)

      Creates a class literal expression.

      Parameters:
        `clazz` - the class reference
      Returns:
        the resulting ClassExpression

    - #### public static Parameter[] cloneParams(Parameter[] parameters)

      Clones parameter metadata as new Parameter instances with original type and name.

      Parameters:
        `parameters` - the parameters to clone
      Returns:
        the resulting Parameter[]

    - #### public static ClosureExpression closureX(Parameter[] params, Statement code)

      Creates a closure expression.

      Parameters:
        `params` - the parameter array
        `code` - the statement body
      Returns:
        the resulting ClosureExpression

    - #### public static ClosureExpression closureX(Statement code)

      Creates a closure expression.

      Parameters:
        `code` - the statement body
      Returns:
        the resulting ClosureExpression

    - #### public static BinaryExpression cmpX(Expression lhv, Expression rhv)

      Builds a binary expression that compares two values.

      Parameters:
        `lhv` - expression for the value to compare from
        `rhv` - expression for the value to compare to
      Returns:
        the expression comparing two values

    - #### public static ConstantExpression constX(Object val)

      Creates a constant expression.

      Parameters:
        `val` - the val
      Returns:
        the resulting ConstantExpression

    - #### public static ConstantExpression constX(Object val, boolean keepPrimitive)

      Creates a constant expression.

      Parameters:
        `val` - the val
        `keepPrimitive` - whether primitive-wrapper constants should be preserved
      Returns:
        the resulting ConstantExpression

    - #### public static String convertASTToSource(ReaderSource readerSource, ASTNode expression)

      Converts an expression into the String source. Only some specific expressions like closure expression support this.

      throws:
        java.lang.IllegalArgumentException when expression is null
      throws:
        java.lang.Exception when closure can't be read from source
      Parameters:
        `readerSource` - a source
        `expression` - an expression. Can't be null
      Returns:
        the source the closure was created from

    - #### public static void copyAnnotatedNodeAnnotations(AnnotatedNode annotatedNode, List<AnnotationNode> copied, List<AnnotationNode> notCopied)

      Copies all `candidateAnnotations` with retention policy RetentionPolicy.RUNTIME and RetentionPolicy.CLASS.

      Annotations with GeneratedClosure members are not supported at present.

    - #### public static void copyAnnotatedNodeAnnotations(AnnotatedNode annotatedNode, List<AnnotationNode> copied, List<AnnotationNode> notCopied, boolean includeGenerated)

      Copies all `candidateAnnotations` with retention policy RetentionPolicy.RUNTIME and RetentionPolicy.CLASS. Generated annotations will be copied if `includeGenerated` is true.

      Annotations with GeneratedClosure members are not supported at present.

    - #### public static boolean copyStatementsWithSuperAdjustment(ClosureExpression pre, BlockStatement body)

      Copies closure statements into a block and rewrites a leading `super(...)` call when present.

      Parameters:
        `pre` - the closure containing statements to copy
        `body` - the destination block
      Returns:
        true if a leading super call was rewritten; false otherwise

    - #### public static Statement createConstructorStatementDefault(FieldNode fNode)

      Builds default constructor-assignment logic for a field and matching argument.

      Parameters:
        `fNode` - the field node
      Returns:
        the resulting Statement

    - #### public static Statement ctorSuperS(Expression args)

      Creates a `super(...)` constructor call statement.

      Parameters:
        `args` - the argument expression(s)
      Returns:
        the resulting Statement

    - #### public static Statement ctorSuperS()

      Creates a `super(...)` constructor call statement.

      Returns:
        the resulting Statement

    - #### public static ConstructorCallExpression ctorSuperX(Expression args)

      Creates a `super(...)` constructor call expression.

      Parameters:
        `args` - the argument expression(s)
      Returns:
        the resulting ConstructorCallExpression

    - #### public static ConstructorCallExpression ctorSuperX()

      Creates a `super(...)` constructor call expression.

      Returns:
        the resulting ConstructorCallExpression

    - #### public static Statement ctorThisS(Expression args)

      Creates a `this(...)` constructor call statement.

      Parameters:
        `args` - the argument expression(s)
      Returns:
        the resulting Statement

    - #### public static Statement ctorThisS()

      Creates a `this(...)` constructor call statement.

      Returns:
        the resulting Statement

    - #### public static ConstructorCallExpression ctorThisX(Expression args)

      Creates a `this(...)` constructor call expression.

      Parameters:
        `args` - the argument expression(s)
      Returns:
        the resulting ConstructorCallExpression

    - #### public static ConstructorCallExpression ctorThisX()

      Creates a `this(...)` constructor call expression.

      Returns:
        the resulting ConstructorCallExpression

    - #### public static ConstructorCallExpression ctorX(ClassNode type, Expression args)

      Creates a constructor call expression.

      Parameters:
        `type` - the target type
        `args` - the argument expression(s)
      Returns:
        the resulting ConstructorCallExpression

    - #### public static ConstructorCallExpression ctorX(ClassNode type)

      Creates a constructor call expression.

      Parameters:
        `type` - the target type
      Returns:
        the resulting ConstructorCallExpression

    - #### public static Statement declS(Expression target, Expression init)

      Creates a variable declaration statement.

      Parameters:
        `target` - the assignment target expression
        `init` - the initializer expression
      Returns:
        the resulting Statement

    - #### public static DeclarationExpression declX(Expression target, Expression init)

      Creates a variable declaration expression.

      Parameters:
        `target` - the assignment target expression
        `init` - the initializer expression
      Returns:
        the resulting DeclarationExpression

    - #### public static ConstantExpression defaultValueX(ClassNode type)

      Returns a constant expression with the default value for the given type (i.e., `false` for boolean, `0` for numbers or `null`).

      Since:
        4.0.0

    - #### public static ElvisOperatorExpression elvisX(Expression base, Expression otherwise)

      Creates an Elvis operator expression.

      Parameters:
        `base` - the base expression
        `otherwise` - the fallback expression
      Returns:
        the resulting ElvisOperatorExpression

    - #### public static MapEntryExpression entryX(Expression key, Expression value)

      Creates a map entry expression.

      Parameters:
        `key` - the key expression
        `value` - the value expression
      Returns:
        the resulting MapEntryExpression

    - #### public static BinaryExpression eqX(Expression left, Expression right)

      Creates an equality comparison expression.

      Parameters:
        `left` - the left-hand operand
        `right` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### public static BooleanExpression equalsNullX(Expression expr)

      Creates a null-equality test expression.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting BooleanExpression

    - #### public static FieldExpression fieldX(FieldNode fieldNode)

      Creates a field expression.

      Parameters:
        `fieldNode` - the fieldNode
      Returns:
        the resulting FieldExpression

    - #### public static FieldExpression fieldX(ClassNode owner, String fieldName)

      Creates a field expression.

      Parameters:
        `owner` - the owner expression
        `fieldName` - the field name
      Returns:
        the resulting FieldExpression

    - #### public static Expression findArg(String argName)

      Creates an expression that resolves an entry from script args.

      Parameters:
        `argName` - the argument name
      Returns:
        the resulting Expression

    - #### public static MethodNode findDeclaredMethod(ClassNode cNode, String name, int argsCount)

      Finds the first declared method with the specified name and arity.

      Parameters:
        `cNode` - the class node
        `name` - the property name
        `argsCount` - the expected argument count
      Returns:
        the matching method node, or `null` if not found

    - #### public static ForStatement forS(Parameter variable, Expression collectionExpression, Statement loopS)

      Creates a for-loop statement.

      Parameters:
        `variable` - the loop or catch parameter
        `collectionExpression` - the collection expression
        `loopS` - the loop body statement
      Returns:
        the resulting ForStatement

    - #### public static BinaryExpression geX(Expression lhv, Expression rhv)

      Creates a greater-than-or-equal comparison expression.

      Parameters:
        `lhv` - the left-hand operand
        `rhv` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### public static List<MethodNode> getAllMethods(ClassNode type)

      Collects methods declared on a class and its super classes.

      Parameters:
        `type` - the target type
      Returns:
        the resulting List

    - #### public static List<PropertyNode> getAllProperties(ClassNode type)

      Collects properties according to the supplied inclusion flags.

      Parameters:
        `type` - the target type
      Returns:
        the resulting List

    - #### public static List<PropertyNode> getAllProperties(Set<String> names, ClassNode cNode, boolean includeProperties, boolean includeFields, boolean includePseudoGetters, boolean includePseudoSetters, boolean traverseSuperClasses, boolean skipReadonly)

      Collects properties according to the supplied inclusion flags.

      Parameters:
        `names` - the set tracking already-added property names
        `cNode` - the class node
        `includeProperties` - whether declared properties are included
        `includeFields` - whether fields are exposed as properties
        `includePseudoGetters` - whether pseudo-getter properties are included
        `includePseudoSetters` - whether pseudo-setter properties are included
        `traverseSuperClasses` - whether super classes are traversed
        `skipReadonly` - whether read-only initialized fields are excluded
      Returns:
        the resulting List

    - #### public static List<PropertyNode> getAllProperties(Set<String> names, ClassNode origType, ClassNode cNode, boolean includeProperties, boolean includeFields, boolean includePseudoGetters, boolean includePseudoSetters, boolean traverseSuperClasses, boolean skipReadonly)

      Collects properties according to the supplied inclusion flags.

      Parameters:
        `names` - the set tracking already-added property names
        `origType` - the original class node used for pseudo-property resolution
        `cNode` - the class node
        `includeProperties` - whether declared properties are included
        `includeFields` - whether fields are exposed as properties
        `includePseudoGetters` - whether pseudo-getter properties are included
        `includePseudoSetters` - whether pseudo-setter properties are included
        `traverseSuperClasses` - whether super classes are traversed
        `skipReadonly` - whether read-only initialized fields are excluded
      Returns:
        the resulting List

    - #### public static List<PropertyNode> getAllProperties(Set<String> names, ClassNode origType, ClassNode cNode, boolean includeProperties, boolean includeFields, boolean includePseudoGetters, boolean includePseudoSetters, boolean traverseSuperClasses, boolean skipReadonly, boolean reverse, boolean allNames, boolean includeStatic)

      Collects properties according to the supplied inclusion flags.

      Parameters:
        `names` - the set tracking already-added property names
        `origType` - the original class node used for pseudo-property resolution
        `cNode` - the class node
        `includeProperties` - whether declared properties are included
        `includeFields` - whether fields are exposed as properties
        `includePseudoGetters` - whether pseudo-getter properties are included
        `includePseudoSetters` - whether pseudo-setter properties are included
        `traverseSuperClasses` - whether super classes are traversed
        `skipReadonly` - whether read-only initialized fields are excluded
        `reverse` - whether superclass traversal order is reversed
        `allNames` - whether special/internal field names are included
        `includeStatic` - whether static members are included
      Returns:
        the resulting List

    - #### public static String getGetterName(PropertyNode pNode)

      Generally preferred to use PropertyNode.getGetterNameOrDefault directly.

    - #### public static String getGetterName(String name, Class<?> type)

      WARNING: Avoid this method unless just the name and type are available. Use getGetterName(PropertyNode) if the propertyNode is available.

    - #### public static String getGetterName(String name)

      WARNING: Avoid this method unless just the name is available. Use getGetterName(PropertyNode) if the propertyNode is available. Use getGetterName(String, Class) if the type is available.

    - #### public static List<String> getInstanceNonPropertyFieldNames(ClassNode cNode)

      Collects names of instance fields that are not exposed as properties.

      Parameters:
        `cNode` - the class node
      Returns:
        the resulting List

    - #### public static List<FieldNode> getInstanceNonPropertyFields(ClassNode cNode)

      Collects instance fields that are not exposed as properties.

      Parameters:
        `cNode` - the class node
      Returns:
        the resulting List

    - #### public static List<PropertyNode> getInstanceProperties(ClassNode cNode)

      Collects instance (non-static) properties.

      Parameters:
        `cNode` - the class node
      Returns:
        the resulting List

    - #### public static List<FieldNode> getInstancePropertyFields(ClassNode cNode)

      Collects backing fields for instance properties.

      Parameters:
        `cNode` - the class node
      Returns:
        the resulting List

    - #### public static List<String> getInstancePropertyNames(ClassNode cNode)

      Collects names of instance properties.

      Parameters:
        `cNode` - the class node
      Returns:
        the resulting List

    - #### public static Set<ClassNode> getInterfacesAndSuperInterfaces(ClassNode cNode)

      Collects interfaces implemented directly or transitively.

      Parameters:
        `cNode` - the class node
      Returns:
        the resulting Set

    - #### public static String getSetterName(String name)

      Computes the JavaBean setter name for a property.

      Parameters:
        `name` - the property name
      Returns:
        the resulting String

    - #### public static List<FieldNode> getSuperNonPropertyFields(ClassNode cNode)

      Collects inherited instance fields that are not properties.

      Parameters:
        `cNode` - the class node
      Returns:
        the resulting List

    - #### public static List<FieldNode> getSuperPropertyFields(ClassNode cNode)

      Collects inherited property backing fields.

      Parameters:
        `cNode` - the class node
      Returns:
        the resulting List

    - #### public static Expression getterThisX(ClassNode annotatedNode, PropertyNode pNode)

      This method is similar to propX(Expression, Expression) but will make sure that if the property being accessed is defined inside the classnode provided as a parameter, then a getter call is generated instead of a field access.

      Parameters:
        `annotatedNode` - the class node where the property node is accessed from
        `pNode` - the property being accessed
      Returns:
        a method call expression or a property expression

    - #### public static Expression getterX(ClassNode annotatedNode, Expression receiver, PropertyNode pNode)

      This method is similar to propX(Expression, Expression) but will make sure that if the property being accessed is defined inside the classnode provided as a parameter, then a getter call is generated instead of a field access.

      Parameters:
        `annotatedNode` - the class node where the property node is accessed from
        `receiver` - the object having the property
        `pNode` - the property being accessed
      Returns:
        a method call expression or a property expression

    - #### public static BinaryExpression gtX(Expression lhv, Expression rhv)

      Creates a greater-than comparison expression.

      Parameters:
        `lhv` - the left-hand operand
        `rhv` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### public static BinaryExpression hasClassX(Expression instance, ClassNode cNode)

      Creates an expression testing whether `instance.getClass()` equals the supplied class.

      Parameters:
        `instance` - the instance expression
        `cNode` - the class node
      Returns:
        the resulting BinaryExpression

    - #### public static boolean hasDeclaredMethod(ClassNode cNode, String name, int argsCount)

      Checks whether a class declares a method with the specified name and arity.

      Parameters:
        `cNode` - the class node
        `name` - the property name
        `argsCount` - the expected argument count
      Returns:
        true if a matching declared method exists; false otherwise

    - #### public static BinaryExpression hasEqualFieldX(FieldNode fNode, Expression other)

      Creates an equality comparison against another object's field value.

      Parameters:
        `fNode` - the field node
        `other` - the other object/value expression
      Returns:
        the resulting BinaryExpression

    - #### public static BinaryExpression hasEqualPropertyX(ClassNode cNode, PropertyNode pNode, VariableExpression other)

      Creates an equality comparison against another object's property value.

      Parameters:
        `cNode` - the class node
        `pNode` - the property node
        `other` - the other object/value expression
      Returns:
        the resulting BinaryExpression

    - #### @Deprecated
      public static BinaryExpression hasEqualPropertyX(PropertyNode pNode, Expression other)

      Creates an equality comparison against another object's property value.

      Parameters:
        `pNode` - the property node
        `other` - the other object/value expression
      Returns:
        the resulting BinaryExpression

    - #### public static BooleanExpression hasSameFieldX(FieldNode fNode, Expression other)

      Creates an identity comparison against another object's field value.

      Parameters:
        `fNode` - the field node
        `other` - the other object/value expression
      Returns:
        the resulting BooleanExpression

    - #### public static BooleanExpression hasSamePropertyX(PropertyNode pNode, Expression other)

      Creates an identity comparison against another object's property value.

      Parameters:
        `pNode` - the property node
        `other` - the other object/value expression
      Returns:
        the resulting BooleanExpression

    - #### public static IfStatement ifElseS(Expression cond, Statement thenStmt, Statement elseStmt)

      Creates an if/else statement.

      Parameters:
        `cond` - the condition expression
        `thenStmt` - the true-branch statement
        `elseStmt` - the false-branch statement
      Returns:
        the resulting IfStatement

    - #### public static IfStatement ifS(Expression cond, Expression trueExpr)

      Creates an if statement with an empty else branch.

      Parameters:
        `cond` - the condition expression
        `trueExpr` - the true-branch expression
      Returns:
        the resulting IfStatement

    - #### public static IfStatement ifS(Expression cond, Statement trueStmt)

      Creates an if statement with an empty else branch.

      Parameters:
        `cond` - the condition expression
        `trueStmt` - the true-branch statement
      Returns:
        the resulting IfStatement

    - #### public static boolean inSamePackage(ClassNode first, ClassNode second)

      Checks whether two classes belong to the same package.

      Parameters:
        `first` - the first class/type
        `second` - the second class/type
      Returns:
        true if both classes are in the same package; false otherwise

    - #### public static boolean inSamePackage(Class<?> first, Class<?> second)

      Checks whether two classes belong to the same package.

      Parameters:
        `first` - the first class/type
        `second` - the second class/type
      Returns:
        true if both classes are in the same package; false otherwise

    - #### public static Expression indexX(Expression target, Expression value)

      Creates an index access expression.

      Parameters:
        `target` - the assignment target expression
        `value` - the value expression
      Returns:
        the resulting Expression

    - #### public static boolean isDefaultVisibility(int modifiers)

      Checks whether modifier bits indicate package-private visibility.

      Parameters:
        `modifiers` - the modifier bit mask
      Returns:
        true if no public/protected/private visibility flag is set; false otherwise

    - #### public static BooleanExpression isInstanceOfX(Expression expr, ClassNode type)

      Creates an `instanceof` test expression.

      Parameters:
        `expr` - the expression
        `type` - the target type
      Returns:
        the resulting BooleanExpression

    - #### public static BooleanExpression isNullOrInstanceOfX(Expression expr, ClassNode type)

      Since:
        4.0.8

    - #### public static BooleanExpression isNullX(Expression expr)

      Alias for equalsNullX(Expression)

    - #### public static BooleanExpression isOneX(Expression expr)

      Creates an equality test against numeric one.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting BooleanExpression

    - #### public static boolean isOrImplements(ClassNode type, ClassNode interfaceType)

      Checks whether a type equals or implements an interface type.

      Parameters:
        `type` - the target type
        `interfaceType` - the interface to test against
      Returns:
        true if the type equals or implements the interface type; false otherwise

    - #### public static BooleanExpression isTrueX(Expression argExpr)

      Creates an equality test against Boolean.TRUE.

      Parameters:
        `argExpr` - the argument expression
      Returns:
        the resulting BooleanExpression

    - #### public static BooleanExpression isZeroX(Expression expr)

      Creates an equality test against numeric zero.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting BooleanExpression

    - #### public static LambdaExpression lambdaX(Parameter[] params, Statement code)

      Builds a lambda expression

      Parameters:
        `params` - lambda parameters
        `code` - lambda code
      Returns:
        the lambda expression

    - #### public static LambdaExpression lambdaX(Statement code)

      Builds a lambda expression with no parameters

      Parameters:
        `code` - lambda code
      Returns:
        the lambda expression

    - #### public static BinaryExpression leX(Expression lhv, Expression rhv)

      Creates a less-than-or-equal comparison expression.

      Parameters:
        `lhv` - the left-hand operand
        `rhv` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### public static ListExpression list2args(List<?> args)

      Converts values into a constant-based list expression.

      Parameters:
        `args` - the argument expression(s)
      Returns:
        the resulting ListExpression

    - #### public static ListExpression listX(List<Expression> args)

      Creates a list expression.

      Parameters:
        `args` - the argument expression(s)
      Returns:
        the resulting ListExpression

    - #### public static VariableExpression localVarX(String name)

      Creates a local variable expression and marks it as the accessed variable.

      Parameters:
        `name` - the property name
      Returns:
        the resulting VariableExpression

    - #### public static VariableExpression localVarX(String name, ClassNode type)

      Creates a local variable expression and marks it as the accessed variable.

      Parameters:
        `name` - the property name
        `type` - the target type
      Returns:
        the resulting VariableExpression

    - #### public static BinaryExpression ltX(Expression lhv, Expression rhv)

      Creates a less-than comparison expression.

      Parameters:
        `lhv` - the left-hand operand
        `rhv` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### @Deprecated
      public static String makeDescriptorWithoutReturnType(MethodNode mn)

      deprecated:
        use MethodNodeUtils#methodDescriptorWithoutReturnType(MethodNode) instead

    - #### public static MapEntryExpression mapEntryX(Expression keyExpr, Expression valueExpr)

      Creates a map entry expression.

      Parameters:
        `keyExpr` - the map-entry key expression
        `valueExpr` - the map-entry value expression
      Returns:
        the resulting MapEntryExpression

    - #### public static MapEntryExpression mapEntryX(String key, Expression valueExpr)

      Creates a map entry expression.

      Parameters:
        `key` - the key expression
        `valueExpr` - the map-entry value expression
      Returns:
        the resulting MapEntryExpression

    - #### public static MapExpression mapX()

      Creates a map expression.

      Returns:
        the resulting MapExpression

    - #### public static MapExpression mapX(List<MapEntryExpression> expressions)

      Creates a map expression.

      Parameters:
        `expressions` - the map-entry expressions
      Returns:
        the resulting MapExpression

    - #### public static boolean maybeFallsThrough(Statement statement)

      Determines whether execution may continue past the supplied statement.

      Parameters:
        `statement` - the statement to analyze
      Returns:
        true if execution may continue after the statement; false otherwise

    - #### public static BinaryExpression minusX(Expression lhv, Expression rhv)

      Creates a subtraction expression.

      Parameters:
        `lhv` - the left-hand operand
        `rhv` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### public static BinaryExpression neX(Expression lhv, Expression rhv)

      Creates an inequality comparison expression.

      Parameters:
        `lhv` - the left-hand operand
        `rhv` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### public static BinaryExpression notIdenticalX(Expression lhv, Expression rhv)

      Creates a non-identity comparison expression.

      Parameters:
        `lhv` - the left-hand operand
        `rhv` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### public static BooleanExpression notNullX(Expression expr)

      Creates a non-null test expression.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting BooleanExpression

    - #### public static NotExpression notX(Expression expr)

      Creates a logical NOT expression.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting NotExpression

    - #### public static ConstantExpression nullX()

      Creates a `null` constant expression.

      Returns:
        the resulting ConstantExpression

    - #### public static BinaryExpression orX(Expression lhv, Expression rhv)

      Creates a logical OR expression.

      Parameters:
        `lhv` - the left-hand operand
        `rhv` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### public static Parameter param(ClassNode type, String name)

      Creates a parameter node.

      Parameters:
        `type` - the target type
        `name` - the property name
      Returns:
        the resulting Parameter

    - #### public static Parameter param(ClassNode type, String name, Expression initialExpression)

      Creates a parameter node.

      Parameters:
        `type` - the target type
        `name` - the property name
        `initialExpression` - the initial expression for the parameter
      Returns:
        the resulting Parameter

    - #### public static Parameter[] params(Parameter params)

      Returns the input parameters or Parameter.EMPTY_ARRAY when input is `null`.

      Parameters:
        `params` - the parameter array
      Returns:
        the resulting Parameter[]

    - #### public static BinaryExpression plusX(Expression lhv, Expression rhv)

      Creates an addition expression.

      Parameters:
        `lhv` - the left-hand operand
        `rhv` - the right-hand operand
      Returns:
        the resulting BinaryExpression

    - #### public static PropertyExpression propX(Expression owner, String property)

      Creates a property access expression.

      Parameters:
        `owner` - the owner expression
        `property` - the property name/expression
      Returns:
        the resulting PropertyExpression

    - #### public static PropertyExpression propX(Expression owner, Expression property)

      Creates a property access expression.

      Parameters:
        `owner` - the owner expression
        `property` - the property name/expression
      Returns:
        the resulting PropertyExpression

    - #### public static PropertyExpression propX(Expression owner, Expression property, boolean safe)

      Creates a property access expression.

      Parameters:
        `owner` - the owner expression
        `property` - the property name/expression
        `safe` - whether safe-navigation is enabled
      Returns:
        the resulting PropertyExpression

    - #### public static Statement returnS(Expression expr)

      Creates a return statement.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting Statement

    - #### public static Statement safeExpression(Expression fieldExpr, Expression expression)

      Creates a null-guarded statement sequence.

      Parameters:
        `fieldExpr` - the field expression used in the guard
        `expression` - the expression
      Returns:
        the resulting Statement

    - #### public static BooleanExpression sameX(Expression self, Expression other)

      Creates an identity test expression using Groovy's `is` method.

      Parameters:
        `self` - the left-hand expression
        `other` - the other object/value expression
      Returns:
        the resulting BooleanExpression

    - #### public static SpreadExpression spreadX(Expression expr)

      Creates a spread expression.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting SpreadExpression

    - #### public static Statement stmt(Expression expr)

      Wraps an expression in an ExpressionStatement.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting Statement

    - #### public static SwitchStatement switchS(Expression expr)

      Creates a switch statement.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting SwitchStatement

    - #### public static SwitchStatement switchS(Expression expr, Statement defaultStatement)

      Creates a switch statement.

      Parameters:
        `expr` - the expression
        `defaultStatement` - the default branch statement
      Returns:
        the resulting SwitchStatement

    - #### public static SwitchStatement switchS(Expression expr, List<CaseStatement> caseStatements, Statement defaultStatement)

      Creates a switch statement.

      Parameters:
        `expr` - the expression
        `caseStatements` - the case statements
        `defaultStatement` - the default branch statement
      Returns:
        the resulting SwitchStatement

    - #### public static TernaryExpression ternaryX(Expression cond, Expression trueExpr, Expression elseExpr)

      Creates a ternary expression.

      Parameters:
        `cond` - the condition expression
        `trueExpr` - the true-branch expression
        `elseExpr` - the false-branch expression
      Returns:
        the resulting TernaryExpression

    - #### public static PropertyExpression thisPropX(boolean implicit, String property)

      Creates a property expression on `this` with configurable implicit-this behavior.

      Parameters:
        `implicit` - whether the receiver is implicit this
        `property` - the property name/expression
      Returns:
        the resulting PropertyExpression

    - #### public static ThrowStatement throwS(Expression expr)

      Creates a throw statement.

      Parameters:
        `expr` - the expression
      Returns:
        the resulting ThrowStatement

    - #### public static TryCatchStatement tryCatchS(Statement tryStatement)

      Creates a try/catch/finally statement.

      Parameters:
        `tryStatement` - the try-block statement
      Returns:
        the resulting TryCatchStatement

    - #### public static TryCatchStatement tryCatchS(Statement tryStatement, Statement finallyStatement)

      Creates a try/catch/finally statement.

      Parameters:
        `tryStatement` - the try-block statement
        `finallyStatement` - the finally-block statement
      Returns:
        the resulting TryCatchStatement

    - #### public static TryCatchStatement tryCatchS(Statement tryStatement, Statement finallyStatement, CatchStatement catchStatements)

      Creates a try/catch/finally statement.

      Parameters:
        `tryStatement` - the try-block statement
        `finallyStatement` - the finally-block statement
        `catchStatements` - the catch statements
      Returns:
        the resulting TryCatchStatement

    - #### public static VariableExpression varX(String name)

      Creates a variable expression.

      Parameters:
        `name` - the property name
      Returns:
        the resulting VariableExpression

    - #### public static VariableExpression varX(Variable variable)

      Creates a variable expression.

      Parameters:
        `variable` - the loop or catch parameter
      Returns:
        the resulting VariableExpression

    - #### public static VariableExpression varX(String name, ClassNode type)

      Creates a variable expression.

      Parameters:
        `name` - the property name
        `type` - the target type
      Returns:
        the resulting VariableExpression