Interface FieldInstruction
- 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_ACCESSPREVIEW. Delivered as a CodeElementPREVIEW when
traversing the elements of a CodeModelPREVIEW.- Since:
- 22
-
Method Summary
Modifier and TypeMethodDescriptionfield()Returns theFieldRefEntryPREVIEW constant described by this instruction.name()Returns the name of the field.static FieldInstructionPREVIEWof(OpcodePREVIEW op, ClassEntryPREVIEW owner, NameAndTypeEntryPREVIEW nameAndType) Returns a field access instruction.static FieldInstructionPREVIEWReturns a field access instruction.static FieldInstructionPREVIEWof(OpcodePREVIEW op, FieldRefEntryPREVIEW field) Returns a field access instruction.default ClassEntryPREVIEWowner()Returns the class holding the field.type()Returns the field descriptor of the field.default ClassDescReturns 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 theFieldRefEntryPREVIEW constant described by this instruction.- Returns:
- the
FieldRefEntryPREVIEW 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_ACCESSPREVIEWfield- a constant pool entry describing the field- Returns:
- a field access instruction
- Throws:
IllegalArgumentException- if the opcode kind is notOpcode.Kind.FIELD_ACCESSPREVIEW.
-
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_ACCESSPREVIEWowner- 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_ACCESSPREVIEWowner- the class holding the fieldnameAndType- the name and field descriptor of the field- Returns:
- a field access instruction
-
FieldInstructionwhen preview features are enabled.