public class BytecodeVariable
extends Object
Represents compile time variable metadata while compiling a method.
| Modifiers | Name | Description |
|---|---|---|
static BytecodeVariable |
SUPER_VARIABLE |
Sentinel metadata for the implicit super receiver. |
static BytecodeVariable |
THIS_VARIABLE |
Sentinel metadata for the implicit this receiver. |
| Constructor and description |
|---|
BytecodeVariable(int index, ClassNode type, String name, int prevCurrent)Creates bytecode metadata for a local variable slot. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
closeRange(org.objectweb.asm.Label end)Ends the currently open local-variable-table range at the given label, recording it for later emission. |
|
public List<org.objectweb.asm.Label> |
getClosedRanges()
|
|
public ClassNode |
getDeclaredType()Returns the type as declared in source, which carries any type annotations (JSR 308). |
|
public org.objectweb.asm.Label |
getEndLabel()
|
|
public int |
getIndex()
|
|
public String |
getName()
|
|
public int |
getPrevIndex()
|
|
public org.objectweb.asm.Label |
getStartLabel()
|
|
public ClassNode |
getType()
|
|
public boolean |
isDynamicTyped()
|
|
public boolean |
isHolder()
|
|
public boolean |
isRangeClosed()
|
|
public void |
reopenRange(org.objectweb.asm.Label start)Starts a new local-variable-table range at the given label after a closeRange. |
|
public void |
setDeclaredType(ClassNode declaredType)Records the type as declared in source. |
|
public void |
setDynamicTyped(boolean dynamicTyped)Marks whether the variable should be treated as dynamically typed. |
|
public void |
setEndLabel(org.objectweb.asm.Label endLabel)Sets the end label used for local-variable table metadata. |
|
public void |
setHolder(boolean holder)Marks whether this variable must be stored through a holder object. |
|
public void |
setStartLabel(org.objectweb.asm.Label startLabel)Sets the start label used for local-variable table metadata. |
|
public void |
setType(ClassNode type)Updates the tracked variable type. |
|
public String |
toString()Returns a string representation of the object.
|
Sentinel metadata for the implicit super receiver.
Sentinel metadata for the implicit this receiver.
Ends the currently open local-variable-table range at the given label, recording it for later emission. Used when flow scoping hides this variable (GROOVY-12242); a later reopenRange starts a new range if the variable becomes visible again.
end - the label at which visibility ends; ignored if null
or if no range is open
Returns the type as declared in source, which carries any type annotations (JSR 308). This may differ from getType(), e.g. when the slot type is an inferred or boxed type.
Starts a new local-variable-table range at the given label after a closeRange. The end label is reset to the start and extended by subsequent scope pops; a range that is never extended has zero width and is not emitted.
start - the label at which visibility resumes; ignored if
null or if no range was closedRecords the type as declared in source.
declaredType - the declared typeMarks whether the variable should be treated as dynamically typed.
dynamicTyped - true if the variable is dynamically typedSets the end label used for local-variable table metadata.
endLabel - the ending labelMarks whether this variable must be stored through a holder object.
holder - true if the variable is closure-sharedSets the start label used for local-variable table metadata.
startLabel - the starting labelUpdates the tracked variable type.
type - the new variable typeReturns a string representation of the object.
toString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The string output is not necessarily stable over time or across
JVM invocations.toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.