Class ClassHelper

java.lang.Object
org.codehaus.groovy.ast.ClassHelper

public class ClassHelper extends Object
Helper for ClassNode creation and type management. Contains cached instances for all commonly used Groovy and Java types, plus factory methods for creating ClassNodes efficiently.

Provides:

  • Predefined ClassNode constants for primitive types, wrapper types, and common classes
  • Caching mechanisms to avoid creating duplicate ClassNode instances for the same class
  • Factory methods for constructing ClassNodes from Java Class or String names
  • Type utility methods for wrapper/unwrapper conversions and type comparisons
  • Dynamic type representation for Groovy's dynamic typing system

Performance Note: ClassNodes are cached by reference for all predefined types. Using make(Class) or make(String) returns cached instances when available, providing O(1) lookup. Use makeWithoutCaching() only when a unique instance is needed.

Type Categories:

  • Cached types: Common Java types (Object, String, Number, etc.) and all primitive types. These are pre-created once and reused for performance.
  • Uncached types: Collection types (Map, List, Set) created without caching.
See Also:
  • Field Details

    • TUPLE_CLASSES

      public static final Class[] TUPLE_CLASSES
      Classes of the fixed-arity tuple types, Tuple0 through Tuple16. The array index is the number of components.
    • OBJECT_TYPE

      public static final ClassNode OBJECT_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • CLOSURE_TYPE

      public static final ClassNode CLOSURE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • GSTRING_TYPE

      public static final ClassNode GSTRING_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • RANGE_TYPE

      public static final ClassNode RANGE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • PATTERN_TYPE

      public static final ClassNode PATTERN_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • STRING_TYPE

      public static final ClassNode STRING_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • SCRIPT_TYPE

      public static final ClassNode SCRIPT_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • BINDING_TYPE

      public static final ClassNode BINDING_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • THROWABLE_TYPE

      public static final ClassNode THROWABLE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • boolean_TYPE

      public static final ClassNode boolean_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • char_TYPE

      public static final ClassNode char_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • byte_TYPE

      public static final ClassNode byte_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • int_TYPE

      public static final ClassNode int_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • long_TYPE

      public static final ClassNode long_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • short_TYPE

      public static final ClassNode short_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • double_TYPE

      public static final ClassNode double_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • float_TYPE

      public static final ClassNode float_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Byte_TYPE

      public static final ClassNode Byte_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Short_TYPE

      public static final ClassNode Short_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Integer_TYPE

      public static final ClassNode Integer_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Long_TYPE

      public static final ClassNode Long_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Character_TYPE

      public static final ClassNode Character_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Float_TYPE

      public static final ClassNode Float_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Double_TYPE

      public static final ClassNode Double_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Boolean_TYPE

      public static final ClassNode Boolean_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • BigInteger_TYPE

      public static final ClassNode BigInteger_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • BigDecimal_TYPE

      public static final ClassNode BigDecimal_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Number_TYPE

      public static final ClassNode Number_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • VOID_TYPE

      public static final ClassNode VOID_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • void_WRAPPER_TYPE

      public static final ClassNode void_WRAPPER_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • METACLASS_TYPE

      public static final ClassNode METACLASS_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Iterator_TYPE

      public static final ClassNode Iterator_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Annotation_TYPE

      public static final ClassNode Annotation_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • ELEMENT_TYPE_TYPE

      public static final ClassNode ELEMENT_TYPE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • AUTOCLOSEABLE_TYPE

      public static final ClassNode AUTOCLOSEABLE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • CLONEABLE_TYPE

      public static final ClassNode CLONEABLE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • SERIALIZABLE_TYPE

      public static final ClassNode SERIALIZABLE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • SERIALIZEDLAMBDA_TYPE

      public static final ClassNode SERIALIZEDLAMBDA_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • SEALED_TYPE

      public static final ClassNode SEALED_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • OVERRIDE_TYPE

      public static final ClassNode OVERRIDE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • DEPRECATED_TYPE

      public static final ClassNode DEPRECATED_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • MAP_TYPE

      public static final ClassNode MAP_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • SET_TYPE

      public static final ClassNode SET_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • LIST_TYPE

      public static final ClassNode LIST_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • Enum_Type

      public static final ClassNode Enum_Type
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • CLASS_Type

      public static final ClassNode CLASS_Type
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • TUPLE_TYPE

      public static final ClassNode TUPLE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • STREAM_TYPE

      public static final ClassNode STREAM_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • ITERABLE_TYPE

      public static final ClassNode ITERABLE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • REFERENCE_TYPE

      public static final ClassNode REFERENCE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • COLLECTION_TYPE

      public static final ClassNode COLLECTION_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • COMPARABLE_TYPE

      public static final ClassNode COMPARABLE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • GROOVY_OBJECT_TYPE

      public static final ClassNode GROOVY_OBJECT_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • GENERATED_LAMBDA_TYPE

      public static final ClassNode GENERATED_LAMBDA_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • GENERATED_CLOSURE_Type

      public static final ClassNode GENERATED_CLOSURE_Type
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • GROOVY_INTERCEPTABLE_TYPE

      public static final ClassNode GROOVY_INTERCEPTABLE_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • GROOVY_OBJECT_SUPPORT_TYPE

      public static final ClassNode GROOVY_OBJECT_SUPPORT_TYPE
      Canonical ClassNode constants for the types named by the fields. Callers reuse these instances instead of allocating a node for each comparison.

      OBJECT_TYPE through DEPRECATED_TYPE are created with makeCached(Class). MAP_TYPE through GROOVY_OBJECT_SUPPORT_TYPE are created with makeWithoutCaching(Class). The one-argument form of that factory returns the soft-cached node, so those fields are still the single cached instance of their class. VOID_TYPE is primitive void and void_WRAPPER_TYPE is Void.

    • DYNAMIC_TYPE

      @Deprecated public static final ClassNode DYNAMIC_TYPE
      Deprecated.
      use dynamicType() when the type is unknown
      Historical alias of OBJECT_TYPE. The field does not carry the metadata flag that isDynamicTyped(ClassNode) reads; dynamicType() produces a node that does.
    • EMPTY_TYPE_ARRAY

      protected static final ClassNode[] EMPTY_TYPE_ARRAY
      Empty ClassNode array, the same instance as ClassNode.EMPTY_ARRAY.
    • OBJECT

      public static final String OBJECT
      Binary name of Object, for call sites that need the name as a string.
      See Also:
  • Constructor Details

    • ClassHelper

      public ClassHelper()
  • Method Details

    • dynamicType

      public static ClassNode dynamicType()
      Provides the dynamic type representation, used by Groovy for dynamic typing when type information is unknown. Returns a ClassNode marked with metadata indicating it represents a dynamic type.
      Returns:
      a ClassNode representing the dynamic type (Object with metadata flag)
      See Also:
    • makeCached

      public static ClassNode makeCached(Class c)
      Creates a cached ClassNode for the given Java class. Cached instances are reused across the compilation unit, reducing memory overhead. If the cache does not contain an entry, a new ClassNode is created, cached, and returned.
      Parameters:
      c - the Java class to create a ClassNode for
      Returns:
      a cached ClassNode for the given class
    • make

      public static ClassNode[] make(Class[] classes)
      Creates an array of ClassNodes using an array of Java classes, using caching where available. Each class is converted to a ClassNode via make(Class).
      Parameters:
      classes - the Java classes to convert to ClassNodes
      Returns:
      an array of ClassNodes corresponding to the input classes, preserving order
      See Also:
    • make

      public static ClassNode make(Class c)
      Creates a ClassNode for the given Java class, using caching when available. Predefined types (like Integer, String, etc.) return cached instances. For first-time requests of non-predefined types, a new ClassNode is created via makeWithoutCaching(Class).
      Parameters:
      c - the Java class to create a ClassNode for
      Returns:
      a ClassNode representing the given class
      See Also:
    • make

      public static ClassNode make(Class c, boolean includeGenerics)
      Creates a ClassNode for the given Java class, optionally including generic type parameters. Predefined types return cached instances; others are created uncached.
      Parameters:
      c - the Java class to create a ClassNode for
      includeGenerics - whether to include generic type parameters from the class definition
      Returns:
      a ClassNode representing the given class
    • makeWithoutCaching

      public static ClassNode makeWithoutCaching(Class c)
      Creates a new ClassNode for the given Java class without caching. Each call creates a unique ClassNode instance, suitable for cases requiring independent instances.
      Parameters:
      c - the Java class to create a ClassNode for
      Returns:
      a new ClassNode representing the given class (not cached)
      See Also:
    • makeWithoutCaching

      public static ClassNode makeWithoutCaching(Class c, boolean includeGenerics)
      Creates a new ClassNode for the given Java class without caching, optionally including generic types. Always creates a unique instance, even for predefined types.
      Parameters:
      c - the Java class to create a ClassNode for
      includeGenerics - whether to include generic type parameters from the class
      Returns:
      a new ClassNode representing the given class (not cached)
    • makeWithoutCaching

      public static ClassNode makeWithoutCaching(String name)
      Creates a new ClassNode for the given class name without caching. Always creates a unique instance. The ClassNode is set up with Object as superclass. This is typically used for dynamically-created or parsed class names.
      Parameters:
      name - the fully-qualified or simple class name
      Returns:
      a new ClassNode representing the named class (not cached)
      See Also:
    • make

      public static ClassNode make(String name)
      Creates a ClassNode for the given class name, returning cached instances for predefined types. Returns the dynamic type for null or empty names. Checks both primitive names ("int", "boolean") and fully-qualified names ("java.lang.String", "java.util.Map").
      Parameters:
      name - the fully-qualified or simple class name, or null/empty for dynamic type
      Returns:
      a ClassNode for the named class, or the dynamic type if name is null or empty
      See Also:
    • getWrapper

      public static ClassNode getWrapper(ClassNode cn)
      Creates a ClassNode containing the wrapper of a ClassNode of primitive type. Any ClassNode representing a primitive type should be created using the predefined types used in class. The method will check the parameter for known references of ClassNode representing a primitive type. If Reference is found, then a ClassNode will be contained that represents the wrapper class. For example for boolean, the wrapper class is java.lang.Boolean.

      If the parameter is no primitive type, the redirected ClassNode will be returned

      Parameters:
      cn - the ClassNode containing a possible primitive type
      See Also:
    • getUnwrapper

      public static ClassNode getUnwrapper(ClassNode cn)
      Maps a wrapper ClassNode to its primitive node. The argument is replaced by its redirect. When isPrimitiveType(ClassNode) is true, that redirected node is returned unchanged. Otherwise it is looked up as a wrapper and the matching primitive constant is returned. The wrappers in the table are Boolean, Byte, Character, Short, Integer, Long, Float, Double, and Void, the last of which unwraps to void. A node that is neither a primitive nor one of those wrappers is returned after redirection.
      Parameters:
      cn - the type to unwrap; a null node is rejected
      Returns:
      the primitive constant for a known wrapper, or the redirected node
      See Also:
    • isPrimitiveType

      public static boolean isPrimitiveType(ClassNode cn)
      Test to determine if a ClassNode is a primitive type. Note: this only works for ClassNodes created using a predefined ClassNode
      Parameters:
      cn - the ClassNode containing a possible primitive type
      Returns:
      true if the ClassNode is a primitive type
      See Also:
    • isStaticConstantInitializerType

      public static boolean isStaticConstantInitializerType(ClassNode cn)
      Test to determine if a ClassNode is a type belongs to the list of types which are allowed to initialize constants directly in bytecode instead of using <cinit>

      Note: this only works for ClassNodes created using a predefined ClassNode

      Parameters:
      cn - the ClassNode to be tested
      Returns:
      true if the ClassNode is of int, float, long, double or String type
      See Also:
    • isNumberType

      public static boolean isNumberType(ClassNode cn)
      Tests whether cn redirects to a numeric primitive or the matching wrapper. The twelve nodes are byte, short, int, long, float, double, and Byte, Short, Integer, Long, Float, Double. BigInteger, BigDecimal, and Number are outside this test, as are boolean, char, and void. The wrapper checks accept a null node as a miss, and the later primitive checks dereference cn.
      Parameters:
      cn - the type to test; must not be null
      Returns:
      true when cn redirects to one of those twelve nodes
    • makeReference

      public static ClassNode makeReference()
      Returns a new non-primary ClassNode for Reference. The node redirects to the cached reference type. Each call allocates a distinct node, leaving the shared reference constant unchanged.
      Returns:
      a plain node whose redirect is the cached groovy.lang.Reference type
    • isCachedType

      public static boolean isCachedType(ClassNode type)
      Tests whether type is identical to an entry in this class's predefined ClassNode table. A different node with the same resolved name yields false, including a redirect whose target sits in the table. null yields false.
      Parameters:
      type - the node to test, or null
      Returns:
      true when type is one of those instances
    • isDynamicTyped

      public static boolean isDynamicTyped(ClassNode type)
      Tests whether type carries the dynamic-type metadata written by dynamicType(). The flag is stored on the node, so OBJECT_TYPE and the DYNAMIC_TYPE alias yield false. Only Boolean.TRUE counts, and null yields false.
      Parameters:
      type - the node to test, or null
      Returns:
      true when the dynamic-type metadata is Boolean.TRUE
    • isPrimitiveBoolean

      public static boolean isPrimitiveBoolean(ClassNode type)
      Tests whether the redirect of type is boolean_TYPE by identity. That constant is the cached primitive boolean node. A Boolean node is a different type. type is dereferenced, so a null argument is rejected.
      Parameters:
      type - the type to test
      Returns:
      true when the redirected node is boolean_TYPE
    • isPrimitiveChar

      public static boolean isPrimitiveChar(ClassNode type)
      Tests whether the redirect of type is char_TYPE by identity. That constant is the cached primitive char node. A Character node is a different type. type is dereferenced, so a null argument is rejected.
      Parameters:
      type - the type to test
      Returns:
      true when the redirected node is char_TYPE
    • isPrimitiveByte

      public static boolean isPrimitiveByte(ClassNode type)
      Tests whether the redirect of type is byte_TYPE by identity. That constant is the cached primitive byte node. A Byte node is a different type. type is dereferenced, so a null argument is rejected.
      Parameters:
      type - the type to test
      Returns:
      true when the redirected node is byte_TYPE
    • isPrimitiveInt

      public static boolean isPrimitiveInt(ClassNode type)
      Tests whether the redirect of type is int_TYPE by identity. That constant is the cached primitive int node. A Integer node is a different type. type is dereferenced, so a null argument is rejected.
      Parameters:
      type - the type to test
      Returns:
      true when the redirected node is int_TYPE
    • isPrimitiveLong

      public static boolean isPrimitiveLong(ClassNode type)
      Tests whether the redirect of type is long_TYPE by identity. That constant is the cached primitive long node. A Long node is a different type. type is dereferenced, so a null argument is rejected.
      Parameters:
      type - the type to test
      Returns:
      true when the redirected node is long_TYPE
    • isPrimitiveShort

      public static boolean isPrimitiveShort(ClassNode type)
      Tests whether the redirect of type is short_TYPE by identity. That constant is the cached primitive short node. A Short node is a different type. type is dereferenced, so a null argument is rejected.
      Parameters:
      type - the type to test
      Returns:
      true when the redirected node is short_TYPE
    • isPrimitiveDouble

      public static boolean isPrimitiveDouble(ClassNode type)
      Tests whether the redirect of type is double_TYPE by identity. That constant is the cached primitive double node. A Double node is a different type. type is dereferenced, so a null argument is rejected.
      Parameters:
      type - the type to test
      Returns:
      true when the redirected node is double_TYPE
    • isPrimitiveFloat

      public static boolean isPrimitiveFloat(ClassNode type)
      Tests whether the redirect of type is float_TYPE by identity. That constant is the cached primitive float node. A Float node is a different type. type is dereferenced, so a null argument is rejected.
      Parameters:
      type - the type to test
      Returns:
      true when the redirected node is float_TYPE
    • isPrimitiveVoid

      public static boolean isPrimitiveVoid(ClassNode type)
      Tests whether the redirect of type is VOID_TYPE by identity. That constant is the cached primitive void node. A Void node is a different type. type is dereferenced, so a null argument is rejected.
      Parameters:
      type - the type to test
      Returns:
      true when the redirected node is VOID_TYPE
    • isWrapperBoolean

      public static boolean isWrapperBoolean(ClassNode type)
      Tests whether the redirect of type is Boolean_TYPE by identity. null yields false. The primitive boolean node is a different type.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type is non-null and redirects to Boolean_TYPE
    • isWrapperCharacter

      public static boolean isWrapperCharacter(ClassNode type)
      Tests whether the redirect of type is Character_TYPE by identity. null yields false. The primitive char node is a different type.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type is non-null and redirects to Character_TYPE
    • isWrapperByte

      public static boolean isWrapperByte(ClassNode type)
      Tests whether the redirect of type is Byte_TYPE by identity. null yields false. The primitive byte node is a different type.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type is non-null and redirects to Byte_TYPE
    • isWrapperInteger

      public static boolean isWrapperInteger(ClassNode type)
      Tests whether the redirect of type is Integer_TYPE by identity. null yields false. The primitive int node is a different type.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type is non-null and redirects to Integer_TYPE
    • isWrapperLong

      public static boolean isWrapperLong(ClassNode type)
      Tests whether the redirect of type is Long_TYPE by identity. null yields false. The primitive long node is a different type.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type is non-null and redirects to Long_TYPE
    • isWrapperShort

      public static boolean isWrapperShort(ClassNode type)
      Tests whether the redirect of type is Short_TYPE by identity. null yields false. The primitive short node is a different type.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type is non-null and redirects to Short_TYPE
    • isWrapperDouble

      public static boolean isWrapperDouble(ClassNode type)
      Tests whether the redirect of type is Double_TYPE by identity. null yields false. The primitive double node is a different type.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type is non-null and redirects to Double_TYPE
    • isWrapperFloat

      public static boolean isWrapperFloat(ClassNode type)
      Tests whether the redirect of type is Float_TYPE by identity. null yields false. The primitive float node is a different type.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type is non-null and redirects to Float_TYPE
    • isWrapperVoid

      public static boolean isWrapperVoid(ClassNode type)
      Tests whether the redirect of type is void_WRAPPER_TYPE by identity. null yields false. The primitive void node is a different type.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type is non-null and redirects to void_WRAPPER_TYPE
    • isBigIntegerType

      public static boolean isBigIntegerType(ClassNode type)
      Tests whether type names BigInteger, using ClassNode.equals(Object) against BigInteger_TYPE. Equality follows the resolved name, so a redirect to that name matches even when the node is not the cached constant. null yields false.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type equals BigInteger_TYPE
    • isBigDecimalType

      public static boolean isBigDecimalType(ClassNode type)
      Tests whether type names BigDecimal, using ClassNode.equals(Object) against BigDecimal_TYPE. Equality follows the resolved name, so a redirect to that name matches even when the node is not the cached constant. null yields false.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type equals BigDecimal_TYPE
    • isStringType

      public static boolean isStringType(ClassNode type)
      Tests whether type names String, using ClassNode.equals(Object) against STRING_TYPE. Equality follows the resolved name, so a redirect to that name matches even when the node is not the cached constant. null yields false.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type equals STRING_TYPE
    • isGStringType

      public static boolean isGStringType(ClassNode type)
      Tests whether type names GString, using ClassNode.equals(Object) against GSTRING_TYPE. Equality follows the resolved name, so a redirect to that name matches even when the node is not the cached constant. null yields false.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type equals GSTRING_TYPE
    • isObjectType

      public static boolean isObjectType(ClassNode type)
      Tests whether type names Object, using ClassNode.equals(Object) against OBJECT_TYPE. Equality follows the resolved name, so a plain reference to object matches, including a node from dynamicType(). The dynamic-type metadata flag is a separate test; use isDynamicTyped(ClassNode) for it. null yields false.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type equals OBJECT_TYPE
    • isGroovyObjectType

      public static boolean isGroovyObjectType(ClassNode type)
      Tests whether type names GroovyObject, using ClassNode.equals(Object) against GROOVY_OBJECT_TYPE. Equality follows the resolved name, so a redirect to that name matches even when the node is not the cached constant. null yields false.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type equals GROOVY_OBJECT_TYPE
    • isClassType

      public static boolean isClassType(ClassNode type)
      Tests whether type names Class, using ClassNode.equals(Object) against CLASS_Type. Equality follows the resolved name, so a redirect to that name matches even when the node is not the cached constant. null yields false.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type equals CLASS_Type
    • isSAMType

      public static boolean isSAMType(ClassNode type)
      Tests whether findSAM(ClassNode) finds one abstract method on type. On an interface, trait methods that already have a default implementation and methods Object already declares are set aside. On an abstract class, an abstract method that already has a usable implementation on a superclass is set aside. Zero remaining methods, or more than one, means the type is not a SAM type. null yields false.
      Parameters:
      type - the type to test, or null
      Returns:
      true when exactly one abstract method remains
    • isFunctionalInterface

      public static boolean isFunctionalInterface(ClassNode type)
      Tests whether type is an interface and isSAMType(ClassNode) is true. null yields false. An abstract class is rejected even when it has a single abstract method, because the JVM converts a lambda only when the target is an interface.
      Parameters:
      type - the type to test, or null
      Returns:
      true when type is a non-null interface with one remaining abstract method
    • isGeneratedFunction

      public static boolean isGeneratedFunction(ClassNode type)
      Checks if the type is a generated function, i.e. closure or lambda.
      Since:
      3.0.0
    • findSAM

      public static MethodNode findSAM(ClassNode type)
      Returns the single abstract method of a class node, if it is a SAM type, or null otherwise.
      Parameters:
      type - a type for which to search for a single abstract method
      Returns:
      the method node if type is a SAM type, null otherwise
    • getNextSuperClass

      public static ClassNode getNextSuperClass(ClassNode source, ClassNode target)
      Returns a super class or interface for a given class depending on supplied target. If the target is not a super class or interface, then null will be returned. For a non-primitive array type -- if the target is also an array -- returns an array of the component type's super class or interface.