- All Superinterfaces:
ClassFileElementPREVIEW
,CodeElementPREVIEW
,InstructionPREVIEW
FieldInstruction
is a preview API of the Java platform.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a field access instruction in the
code
array of a Code
attribute. Corresponding opcodes will have a kind
of Opcode.Kind.FIELD_ACCESS
PREVIEW. Delivered as a CodeElement
PREVIEW when
traversing the elements of a CodeModel
PREVIEW.- Since:
- 22
-
Method Summary
Modifier and TypeMethodDescriptionfield()
Returns theFieldRefEntry
PREVIEW constant described by this instruction.name()
Returns the name of the field.static FieldInstructionPREVIEW
of
(OpcodePREVIEW op, ClassEntryPREVIEW owner, NameAndTypeEntryPREVIEW nameAndType) Returns a field access instruction.static FieldInstructionPREVIEW
Returns a field access instruction.static FieldInstructionPREVIEW
of
(OpcodePREVIEW op, FieldRefEntryPREVIEW field) Returns a field access instruction.default ClassEntryPREVIEW
owner()
Returns the class holding the field.type()
Returns the field descriptor of the field.default ClassDesc
Returns a symbolic descriptor for the type of the field.Methods declared in interface java.lang.classfile.InstructionPREVIEW
opcode, sizeInBytes
-
Method Details
-
field
FieldRefEntryPREVIEW field()Returns theFieldRefEntry
PREVIEW constant described by this instruction.- Returns:
- the
FieldRefEntry
PREVIEW constant described by this instruction
-
owner
Returns the class holding the field.- Returns:
- the class holding the field
-
name
-
type
-
typeSymbol
Returns a symbolic descriptor for the type of the field.- Returns:
- a symbolic descriptor for the type of the field
-
of
Returns a field access instruction.- Parameters:
op
- the opcode for the specific type of field access instruction, which must be of kindOpcode.Kind.FIELD_ACCESS
PREVIEWfield
- a constant pool entry describing the field- Returns:
- a field access instruction
-
of
static FieldInstructionPREVIEW of(OpcodePREVIEW op, ClassEntryPREVIEW owner, Utf8EntryPREVIEW name, Utf8EntryPREVIEW type) Returns a field access instruction.- Parameters:
op
- the opcode for the specific type of field access instruction, which must be of kindOpcode.Kind.FIELD_ACCESS
PREVIEWowner
- the class holding the fieldname
- the name of the fieldtype
- the field descriptor- Returns:
- a field access instruction
-
of
static FieldInstructionPREVIEW of(OpcodePREVIEW op, ClassEntryPREVIEW owner, NameAndTypeEntryPREVIEW nameAndType) Returns a field access instruction.- Parameters:
op
- the opcode for the specific type of field access instruction, which must be of kindOpcode.Kind.FIELD_ACCESS
PREVIEWowner
- the class holding the fieldnameAndType
- the name and field descriptor of the field- Returns:
- a field access instruction
-
FieldInstruction
when preview features are enabled.