---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 13 Edition"
java_version: 13
chapter: "Chapter 4. The class File Format"
section: "4.7.14"
heading: "4.7.14. The LocalVariableTypeTable Attribute"
parent: "4.7. Attributes"
source: https://docs.oracle.com/javase/specs/jvms/se13/html/jvms-4.html#jvms-4.7.14
id: "4.7.14"
url: https://jvm.obfuscated.software/jvms/se13/4.7.14.html
raw: https://jvm.obfuscated.software/jvms/se13/4.7.14.md
---

# 4.7.14. The `LocalVariableTypeTable` Attribute

The `LocalVariableTypeTable` attribute is an optional variable-length attribute in the `attributes` table of a `Code` attribute ([§4.7.3](4.7.3.md)). It may be used by debuggers to determine the value of a given local variable during the execution of a method.

If multiple `LocalVariableTypeTable` attributes are present in the `attributes` table of a given `Code` attribute, then they may appear in any order.

There may be no more than one `LocalVariableTypeTable` attribute *per local variable* in the `attributes` table of a `Code` attribute.

The `LocalVariableTypeTable` attribute differs from the `LocalVariableTable` attribute ([§4.7.13](4.7.13.md)) in that it provides signature information rather than descriptor information. This difference is only significant for variables whose type uses a type variable or parameterized type. Such variables will appear in both tables, while variables of other types will appear only in `LocalVariableTable`.

The `LocalVariableTypeTable` attribute has the following format:

```
LocalVariableTypeTable_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u2 local_variable_type_table_length;
    {   u2 start_pc;
        u2 length;
        u2 name_index;
        u2 signature_index;
        u2 index;
    } local_variable_type_table[local_variable_type_table_length];
}
```

The items of the `LocalVariableTypeTable_attribute` structure are as follows:

- **attribute_name_index**

  The value of the `attribute_name_index` item must be a valid index into the `constant_pool` table. The `constant_pool` entry at that index must be a `CONSTANT_Utf8_info` structure ([§4.4.7](4.4.7.md)) representing the string "`LocalVariableTypeTable`".

- **attribute_length**

  The value of the `attribute_length` item indicates the length of the attribute, excluding the initial six bytes.

- **local_variable_type_table_length**

  The value of the `local_variable_type_table_length` item indicates the number of entries in the `local_variable_type_table` array.

- **local_variable_type_table[]**

  Each entry in the `local_variable_type_table` array indicates a range of `code` array offsets within which a local variable has a value, and indicates the index into the local variable array of the current frame at which that local variable can be found. Each entry must contain the following five items:

  - **start_pc, length**

    The value of the `start_pc` item must be a valid index into the `code` array of this `Code` attribute and must be the index of the opcode of an instruction.

    The value of `start_pc + length` must either be a valid index into the `code` array of this `Code` attribute and be the index of the opcode of an instruction, or it must be the first index beyond the end of that `code` array.

    The `start_pc` and `length` items indicate that the given local variable has a value at indices into the `code` array in the interval [`start_pc`, `start_pc + length`), that is, between `start_pc` inclusive and `start_pc + length` exclusive.

  - **name_index**

    The value of the `name_index` item must be a valid index into the `constant_pool` table. The `constant_pool` entry at that index must contain a `CONSTANT_Utf8_info` structure representing a valid unqualified name denoting a local variable ([§4.2.2](4.2.2.md)).

  - **signature_index**

    The value of the `signature_index` item must be a valid index into the `constant_pool` table. The `constant_pool` entry at that index must contain a `CONSTANT_Utf8_info` structure representing a field signature which encodes the type of a local variable in the source program ([§4.7.9.1](4.7.9.1.md)).

  - **index**

    The value of the `index` item must be a valid index into the local variable array of the current frame. The given local variable is at `index` in the local variable array of the current frame.

    If the given local variable is of type `double` or `long`, it occupies both `index` and `index + 1`.
