APIdia Launch Partner
Top Description Methods
java.lang.classfile.instruction

public sealed Interface LocalVariableType

extends PseudoInstruction
permits UnboundLocalVariableType, BoundLocalVariableType
Known Direct Implementers
jdk.internal.classfile.impl.AbstractPseudoInstruction.UnboundLocalVariableType, jdk.internal.classfile.impl.BoundLocalVariableType
Imports
java.lang.classfile.*, java.lang.classfile.attribute.LocalVariableTypeInfo, .LocalVariableTypeTableAttribute, java.lang.classfile.constantpool.Utf8Entry, jdk.internal.classfile.impl.AbstractPseudoInstruction, .BoundLocalVariableType, .TemporaryConstantPool

A pseudo-instruction which models a single entry in the LocalVariableTypeTable attribute. Delivered as a CodeElement during traversal of the elements of a CodeModel, according to the setting of the ClassFile.DebugElementsOption option.

A local variable type entry is composite:

LocalVariableType( int slot, String name, Signature signature, Label startScope, Label endScope )
LocalVariableType(
    int slot,
    String name,
    Signature signature,
    Label startScope,
    Label endScope
)
Where slot is u2.

Another model, LocalVariableTypeInfo, also models a local variable type entry; it has no dependency on a CodeModel and represents of bci values as ints instead of Labels, and is used as components of a LocalVariableTypeTableAttribute.

API Note

LocalVariableType is used if a local variable has a parameterized type, a type argument, or an array type of one of the previous types as its type. A LocalVariable with the erased type should still be created for that local variable.

Since
24
See Also
LocalVariableTypeInfo, CodeBuilder::localVariableType, ClassFile.DebugElementsOption

Method Summary

Modifier and TypeMethod and Description
public Label

Returns:

the end range of the local variable scope
endScope
()

Returns the end range of the local variable scope.

public Utf8Entry

Returns:

the local variable name
name
()

Returns the local variable name.

public static LocalVariableType

Returns:

a local variable type pseudo-instruction
of
(int
the local variable slot
slot
,
Utf8Entry
the local variable name
nameEntry
,
Utf8Entry
the local variable signature
signatureEntry
,
Label
the start range of the local variable scope
startScope
,
Label
the end range of the local variable scope
endScope
)

Returns a local variable type pseudo-instruction.

public static LocalVariableType

Returns:

a local variable type pseudo-instruction
of
(int
the local variable slot
slot
,
String
the local variable name
name
,
Signature
the local variable signature
signature
,
Label
the start range of the local variable scope
startScope
,
Label
the end range of the local variable scope
endScope
)

Returns a local variable type pseudo-instruction.

public Utf8Entry

Returns:

the local variable generic signature string
signature
()

Returns the local variable generic signature string.

public default Signature

Returns:

the local variable generic signature
signatureSymbol
()

Returns the local variable generic signature.

public int

Returns:

the local variable slot
slot
()

Returns the local variable slot.

public Label

Returns:

the start range of the local variable scope
startScope
()

Returns the start range of the local variable scope.

Method Detail

endScopeback to summary
public Label endScope()

Returns the end range of the local variable scope.

Returns:Label

the end range of the local variable scope

nameback to summary
public Utf8Entry name()

Returns the local variable name.

Returns:Utf8Entry

the local variable name

ofback to summary
public static LocalVariableType of(int slot, Utf8Entry nameEntry, Utf8Entry signatureEntry, Label startScope, Label endScope)

Returns a local variable type pseudo-instruction. slot must be u2.

Parameters
slot:int

the local variable slot

nameEntry:Utf8Entry

the local variable name

signatureEntry:Utf8Entry

the local variable signature

startScope:Label

the start range of the local variable scope

endScope:Label

the end range of the local variable scope

Returns:LocalVariableType

a local variable type pseudo-instruction

Exceptions
IllegalArgumentException:
if slot is not u2
ofback to summary
public static LocalVariableType of(int slot, String name, Signature signature, Label startScope, Label endScope)

Returns a local variable type pseudo-instruction. slot must be u2.

Parameters
slot:int

the local variable slot

name:String

the local variable name

signature:Signature

the local variable signature

startScope:Label

the start range of the local variable scope

endScope:Label

the end range of the local variable scope

Returns:LocalVariableType

a local variable type pseudo-instruction

Exceptions
IllegalArgumentException:
if slot is not u2
signatureback to summary
public Utf8Entry signature()

Returns the local variable generic signature string.

API Note

A symbolic generic signature of the local variable is available through signatureSymbol().

Returns:Utf8Entry

the local variable generic signature string

signatureSymbolback to summary
public default Signature signatureSymbol()

Returns the local variable generic signature.

Returns:Signature

the local variable generic signature

slotback to summary
public int slot()

Returns the local variable slot. It is a u2 value.

Returns:int

the local variable slot

startScopeback to summary
public Label startScope()

Returns the start range of the local variable scope.

Returns:Label

the start range of the local variable scope