Class IntersectionTypeClassNode
- All Implemented Interfaces:
GroovydocHolder<AnnotatedNode>,NodeMetaDataHandler
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
-
Field Summary
Fields inherited from class org.codehaus.groovy.ast.ClassNode
clazz, EMPTY_ARRAY, isPrimaryNode, lazyInitLock, SUPER, THISFields inherited from interface groovy.lang.groovydoc.GroovydocHolder
DOC_COMMENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the components of this intersection type in user-written order.getText()Returns a human-readable text representation of this AST node.voidReclassifies the components after resolution: separates the (at most one) class component from the interface components and updates the inherited superclass and interfaces accordingly.toString(boolean showRedirect) Returns a string representation of this ClassNode with optional redirect information.Methods inherited from class org.codehaus.groovy.ast.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, getOuterClasses, getOuterField, getPackage, getPackageName, getPermittedSubclasses, getPlainNodeReference, getPlainNodeReference, getProperties, getProperty, getRecordComponents, getSetterMethod, getSetterMethod, getSuperClass, getTransforms, getTypeAnnotations, getTypeAnnotations, getTypeClass, getUnresolvedInterfaces, getUnresolvedInterfaces, getUnresolvedName, getUnresolvedSuperClass, getUnresolvedSuperClass, hasDeclaredMethod, hashCode, hasMethod, hasPackageName, hasPossibleMethod, hasPossibleStaticMethod, hasProperty, implementsAnyInterfaces, implementsInterface, isAbstract, isAnnotated, isAnnotationDefinition, isArray, isDerivedFrom, isDerivedFromGroovyObject, isEnum, isGenericsPlaceHolder, isInterface, isPrimaryClassNode, isRecord, isRedirectNode, isResolved, isScript, isScriptBody, isSealed, isStaticClass, isSyntheticPublic, isUsingGenerics, makeArray, parametersEqual, positionStmtsAfterEnumInitStmts, redirect, removeConstructor, removeField, removeMethod, renameField, setAnnotated, setCompileUnit, setEnclosingMethod, setGenericsPlaceHolder, setGenericsTypes, setInterfaces, setMixins, setModifiers, setModule, setName, setPermittedSubclasses, setRecordComponents, setRedirect, setScript, setScriptBody, setStaticClass, setSuperClass, setSyntheticPublic, setUnresolvedSuperClass, setUsingGenerics, toString, tryFindPossibleMethod, visitContentsMethods inherited from class org.codehaus.groovy.ast.AnnotatedNode
addAnnotation, addAnnotation, addAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSyntheticMethods inherited from class org.codehaus.groovy.ast.ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visitMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler
copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, newMetaDataMap, putNodeMetaData, removeNodeMetaData, setNodeMetaData
-
Constructor Details
-
IntersectionTypeClassNode
-
-
Method Details
-
getComponents
Returns the components of this intersection type in user-written order. -
reclassifyComponents
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. -
getText
Description copied from class:ASTNodeReturns a human-readable text representation of this AST node. Used for debugging and error messages. Default implementation returns a message indicating the representation is not yet implemented for this node type. -
toString
Description copied from class:ClassNodeReturns a string representation of this ClassNode with optional redirect information. For array types, appends "[]" to the component type's string representation. For generic types, includes generic type parameters (e.g., "List"). If showRedirectistrueand this is a redirect node, includes arrow notation showing the redirect target; otherwise the redirect information is omitted.
-