Package: org.codehaus.groovy.ast

## [Java] Class IntersectionTypeClassNode

- org.codehaus.groovy.ast.IntersectionTypeClassNode

-     public final class IntersectionTypeClassNode
      extends ClassNode

  Represents a user-written intersection type used as the target of a cast expression or `as` coercion, e.g.

           (Runnable & Serializable) () -> ...
           value as (A & B)

  Distinct from the implicit lowest-upper-bound nodes that StaticTypeCheckingVisitor synthesizes during inference: an instance of this class records the ordered list of components exactly as written by the user. That ordering is needed for cast-conversion checks, error messages and (in later phases) bytecode generation via `LambdaMetafactory.altMetafactory` markers.

  Lifecycle: at parse time the components have not yet been resolved to bound ClassNodes, so the constructor places all components in the inherited interfaces array with `Object` as the placeholder superclass. After `ResolveVisitor` resolves each component it should call reclassifyComponents() so that the interfaces array contains only interface components and the superclass is the (at most one) class component.

  Since:
    6.0.0

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class ClassNode` | `EMPTY_ARRAY, SUPER, THIS, clazz, isPrimaryNode, lazyInitLock`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `IntersectionTypeClassNode(ClassNode[] components)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public ClassNode[]` | `getComponents()` Returns the components of this intersection type in user-written order.
    `` | `public String` | `getText()`
    `` | `public void` | `reclassifyComponents()` Reclassifies the components after resolution: separates the (at most one) class component from the interface components and updates the inherited superclass and interfaces accordingly.
    `` | `public String` | `toString(boolean showRedirect)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ClassNode` | `addConstructor, addConstructor, addField, addField, addFieldFirst, addFieldFirst, addInterface, addMethod, addMethod, addMixin, addObjectInitializerStatements, addProperty, addProperty, addStaticInitializerStatements, addSyntheticMethod, addTransform, addTypeAnnotation, addTypeAnnotations, asGenericsType, declaresAnyInterfaces, declaresInterface, equals, getAbstractMethods, getAllDeclaredMethods, getAllInterfaces, getAnnotations, getAnnotations, getCompileUnit, getComponentType, getDeclaredConstructor, getDeclaredConstructors, getDeclaredField, getDeclaredMethod, getDeclaredMethods, getDeclaredMethodsMap, getEnclosingMethod, getField, getFieldIndex, getFields, getGenericsTypes, getGetterMethod, getGetterMethod, getInnerClasses, getInterfaces, getMethod, getMethods, getMethods, getMixins, getModifiers, getModule, getName, getNameWithoutPackage, getObjectInitializerStatements, getOuterClass, getOuterClassType, getOuterClasses, getOuterField, getPackage, getPackageName, getPermittedSubclasses, getPlainNodeReference, getPlainNodeReference, getProperties, getProperty, getRecordComponents, getSetterMethod, getSetterMethod, getSuperClass, getText, getTransforms, getTypeAnnotations, getTypeAnnotations, getTypeClass, getUnresolvedInterfaces, getUnresolvedInterfaces, getUnresolvedName, getUnresolvedSuperClass, getUnresolvedSuperClass, hasDeclaredMethod, hasMethod, hasPackageName, hasPossibleMethod, hasPossibleStaticMethod, hasProperty, hashCode, implementsAnyInterfaces, implementsInterface, isAbstract, isAnnotated, isAnnotationDefinition, isArray, isDerivedFrom, isDerivedFromGroovyObject, isEnum, isGenericsPlaceHolder, isInterface, isPrimaryClassNode, isRecord, isRedirectNode, isResolved, isScript, isScriptBody, isSealed, isStatic, isStaticClass, isSyntheticPublic, isUsingGenerics, makeArray, parametersEqual, positionStmtsAfterEnumInitStmts, redirect, removeConstructor, removeField, removeMethod, renameField, setAnnotated, setCompileUnit, setEnclosingMethod, setGenericsPlaceHolder, setGenericsTypes, setInterfaces, setMixins, setModifiers, setModule, setName, setOuterClassType, setPermittedSubclasses, setRecordComponents, setRedirect, setScript, setScriptBody, setStaticClass, setSuperClass, setSyntheticPublic, setUnresolvedSuperClass, setUsingGenerics, toString, toString, tryFindPossibleMethod, visitContents`
    `class AnnotatedNode` | `addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Constructor Detail

    - #### public IntersectionTypeClassNode(ClassNode[] components)

  - ### Method Detail

    - #### public ClassNode[] getComponents()

      Returns the components of this intersection type in user-written order.

    - #### public String getText()

    - #### public void reclassifyComponents()

      Reclassifies the components after resolution: separates the (at most one) class component from the interface components and updates the inherited superclass and interfaces accordingly. Components are resolved in place — callers do not need to substitute new instances.

    - #### public String toString(boolean showRedirect)