Package: org.apache.groovy.ast.tools

## [Java] Class TypeUseUtils

- org.apache.groovy.ast.tools.TypeUseUtils

-     public final class TypeUseUtils
      extends Object

  Classification of a ClassNode as a type use (JLS 4.5, 4.7, 4.8). Distinct from a generic class declaration, whose ClassNode.getGenericsTypes are the formals.

  Since:
    6.0.0

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static String` | `describeTypeUse(ClassNode type)` Source-like display of a type use, including rare enclosing arguments (`Outer<String>.Inner`) and array brackets.
    `` | `public static boolean` | `hasWildcardTypeArgument(ClassNode type)` True when a type argument of `type` or an enclosing rare type is a wildcard.
    `` | `public static boolean` | `isParameterizedEnclosingType(ClassNode type)` True when `type` carries type arguments, including wildcards ({@code Outer
    `` | `public static boolean` | `isParameterizedTypeUsage(ClassNode type)` True when `type` is a parameterized usage (`Cell<String>`), as opposed to the generic type name (`Cell`) or the class declaration node (whose ClassNode.getGenericsTypes are the formals).
    `` | `public static boolean` | `isParameterizedTypeUsageIncludingEnclosing(ClassNode type)` True when `type` or any enclosing rare type is a parameterized usage.
    `` | `public static boolean` | `isRawGenericType(ClassNode type)` True when `type` is a raw use of a generic declaration (`Outer` for `class Outer<T>`).
    `` | `public static boolean` | `isReifiable(ClassNode type)` JLS 4.7: types available in full at run time.
    `` | `public static boolean` | `isStaticMemberType(ClassNode type)` Nested interfaces and enums are implicitly static; otherwise the `ACC_STATIC` bit on the declaration is authoritative.

  - ### 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 String describeTypeUse(ClassNode type)

      Source-like display of a type use, including rare enclosing arguments (`Outer<String>.Inner`) and array brackets.

    - #### public static boolean hasWildcardTypeArgument(ClassNode type)

      True when a type argument of `type` or an enclosing rare type is a wildcard.

    - #### public static boolean isParameterizedEnclosingType(ClassNode type)

      True when `type` carries type arguments, including wildcards (`Outer<?>`). Raw names (`Outer`) are not parameterized. Unlike isParameterizedTypeUsage(ClassNode), this does not require a redirect node: an enclosing type on a nested use may still be the parser's unresolved node.

    - #### public static boolean isParameterizedTypeUsage(ClassNode type)

      True when `type` is a parameterized usage (`Cell<String>`), as opposed to the generic type name (`Cell`) or the class declaration node (whose ClassNode.getGenericsTypes are the formals).

    - #### public static boolean isParameterizedTypeUsageIncludingEnclosing(ClassNode type)

      True when `type` or any enclosing rare type is a parameterized usage. Used for class literals (JLS 15.8.2): `Outer<String>.Inner.class`. Declaration formals on `Map` must not make `Map.Entry` a class-literal error.

    - #### public static boolean isRawGenericType(ClassNode type)

      True when `type` is a raw use of a generic declaration (`Outer` for `class Outer<T>`).

    - #### public static boolean isReifiable(ClassNode type)

      JLS 4.7: types available in full at run time. Used for array creation (JLS 15.10.1) and `instanceof` (JLS 15.20.2).

    - #### public static boolean isStaticMemberType(ClassNode type)

      Nested interfaces and enums are implicitly static; otherwise the `ACC_STATIC` bit on the declaration is authoritative.