Package org.codehaus.groovy.ast
Class DynamicVariable
java.lang.Object
org.codehaus.groovy.ast.DynamicVariable
- All Implemented Interfaces:
Variable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the initialization expression for this variable, or null if no initialization is present.intReturns the modifiers (access flags) for this variable as perorg.objectweb.asm.Opcodes.getName()Returns the name of the variable.Returns the original type of this variable before any type wrapping or transformation.getType()Returns the type of the variable.booleanReturns true if this variable has an initialization expression.booleanReturns true if this variable is shared with and accessed by nested closures.booleanReturns true if this variable has dynamic type information that could not be resolved at compile time.booleanReturns true if this variable is declared or used in a static context.voidsetClosureSharedVariable(boolean inClosure) Marks this variable as shared with nested closures.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.codehaus.groovy.ast.Variable
isFinal, isPrivate, isProtected, isPublic, isStatic, isVolatile
-
Constructor Details
-
DynamicVariable
-
-
Method Details
-
getType
Description copied from interface:VariableReturns the type of the variable. If the type is not yet determined, implementations may return a dynamic or placeholder type. -
getName
Description copied from interface:VariableReturns the name of the variable. -
getInitialExpression
Description copied from interface:VariableReturns the initialization expression for this variable, or null if no initialization is present. For fields and local variables, this may contain the right-hand side of an assignment; for parameters, this represents a default value.- Specified by:
getInitialExpressionin interfaceVariable- Returns:
- the initialization
Expression, or null
-
hasInitialExpression
public boolean hasInitialExpression()Description copied from interface:VariableReturns true if this variable has an initialization expression.- Specified by:
hasInitialExpressionin interfaceVariable- Returns:
- true if initialized
-
isInStaticContext
public boolean isInStaticContext()Description copied from interface:VariableReturns true if this variable is declared or used in a static context. A static context includes static initializers, static field declarations, static method bodies, and class-level code without instance access.- Specified by:
isInStaticContextin interfaceVariable- Returns:
- true if in a static context
-
isDynamicTyped
public boolean isDynamicTyped()Description copied from interface:VariableReturns true if this variable has dynamic type information that could not be resolved at compile time.- Specified by:
isDynamicTypedin interfaceVariable- Returns:
- true if dynamically typed
-
getModifiers
public int getModifiers()Description copied from interface:VariableReturns the modifiers (access flags) for this variable as perorg.objectweb.asm.Opcodes. May include visibility modifiers (public, protected, private),static,final, etc.- Specified by:
getModifiersin interfaceVariable- Returns:
- the modifier flags
- See Also:
-
Opcodes
-
getOriginType
Description copied from interface:VariableReturns the original type of this variable before any type wrapping or transformation. For primitive types, this preserves the distinction between boxed and unboxed forms.- Specified by:
getOriginTypein interfaceVariable- Returns:
- the original
ClassNodebefore transformations
-