Package: org.codehaus.groovy.classgen.asm

## [Java] Class BytecodeVariable

- org.codehaus.groovy.classgen.asm.BytecodeVariable

-     public class BytecodeVariable
      extends Object

  Represents compile time variable metadata while compiling a method.

- - ### Field Summary

    Fields
    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 Summary

    Constructors
    Constructor and description
    `BytecodeVariable(int index, ClassNode type, String name, int prevCurrent)` Creates bytecode metadata for a local variable slot.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public org.objectweb.asm.Label` | `getEndLabel()` Returns: the end label used for local-variable table metadata
    `` | `public int` | `getIndex()` Returns: the stack index for this variable
    `` | `public String` | `getName()` Returns: the source-level variable name
    `` | `public int` | `getPrevIndex()` Returns: the previous current-variable index
    `` | `public org.objectweb.asm.Label` | `getStartLabel()` Returns: the start label used for local-variable table metadata
    `` | `public ClassNode` | `getType()` Returns: the variable type
    `` | `public boolean` | `isDynamicTyped()` Returns: whether the variable uses dynamic typing
    `` | `public boolean` | `isHolder()` Returns: is this local variable shared in other scopes (and so must use a ValueHolder)
    `` | `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. API Note: In general, the `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. Implementation Requirements: The `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())
    Returns: a string representation of the object.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### public static final BytecodeVariable SUPER_VARIABLE

      Sentinel metadata for the implicit `super` receiver.

    - #### public static final BytecodeVariable THIS_VARIABLE

      Sentinel metadata for the implicit `this` receiver.

  - ### Constructor Detail

    - #### public BytecodeVariable(int index, ClassNode type, String name, int prevCurrent)

      Creates bytecode metadata for a local variable slot.

      Parameters:
        `index` - the JVM local-variable index
        `type` - the variable type
        `name` - the variable name
        `prevCurrent` - the previous current-variable index

  - ### Method Detail

    - #### public org.objectweb.asm.Label getEndLabel()

      Returns:
        the end label used for local-variable table metadata

    - #### public int getIndex()

      Returns:
        the stack index for this variable

    - #### public String getName()

      Returns:
        the source-level variable name

    - #### public int getPrevIndex()

      Returns:
        the previous current-variable index

    - #### public org.objectweb.asm.Label getStartLabel()

      Returns:
        the start label used for local-variable table metadata

    - #### public ClassNode getType()

      Returns:
        the variable type

    - #### public boolean isDynamicTyped()

      Returns:
        whether the variable uses dynamic typing

    - #### public boolean isHolder()

      Returns:
        is this local variable shared in other scopes (and so must use a ValueHolder)

    - #### public void setDynamicTyped(boolean dynamicTyped)

      Marks whether the variable should be treated as dynamically typed.

      Parameters:
        `dynamicTyped` - `true` if the variable is dynamically typed

    - #### public void setEndLabel(org.objectweb.asm.Label endLabel)

      Sets the end label used for local-variable table metadata.

      Parameters:
        `endLabel` - the ending label

    - #### public void setHolder(boolean holder)

      Marks whether this variable must be stored through a holder object.

      Parameters:
        `holder` - `true` if the variable is closure-shared

    - #### public void setStartLabel(org.objectweb.asm.Label startLabel)

      Sets the start label used for local-variable table metadata.

      Parameters:
        `startLabel` - the starting label

    - #### public void setType(ClassNode type)

      Updates the tracked variable type.

      Parameters:
        `type` - the new variable type

    - #### public String toString()

      Returns a string representation of the object.

      API Note:
        In general, the `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.
      Implementation Requirements:
        The `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())

      Returns:
        a string representation of the object.