ClassFileElement, CodeElement, Instructionpublic sealed interface FieldInstruction extends Instruction
code array of a Code attribute. Corresponding opcodes have a kind of Opcode.Kind.FIELD_ACCESS. Delivered as a CodeElement when traversing the elements of a CodeModel. A field access instruction is composite:
FieldInstruction(
Opcode opcode,
FieldRefEntry field,
)
| Modifier and Type | Method | Description |
|---|---|---|
FieldRefEntry |
field() |
Returns the FieldRefEntry constant described by this instruction. |
default Utf8Entry |
name() |
Returns the name of the field. |
static FieldInstruction |
of |
Returns a field access instruction. |
static FieldInstruction |
of |
Returns a field access instruction. |
static FieldInstruction |
of |
Returns a field access instruction. |
default ClassEntry |
owner() |
Returns the class holding the field. |
default Utf8Entry |
type() |
Returns the field descriptor string of the field. |
default ClassDesc |
typeSymbol() |
Returns a symbolic descriptor for the type of the field. |
opcode, sizeInBytes
FieldRefEntry field()
FieldRefEntry constant described by this instruction.FieldRefEntry constant described by this instructiondefault ClassEntry owner()
default Utf8Entry name()
default Utf8Entry type()
typeSymbol().default ClassDesc typeSymbol()
static FieldInstruction of(Opcode op, FieldRefEntry field)
op - the opcode for the specific type of field access instruction, which must be of kind Opcode.Kind.FIELD_ACCESS
field - a constant pool entry describing the fieldIllegalArgumentException - if the opcode kind is not Opcode.Kind.FIELD_ACCESS.static FieldInstruction of(Opcode op, ClassEntry owner, Utf8Entry name, Utf8Entry type)
op - the opcode for the specific type of field access instruction, which must be of kind Opcode.Kind.FIELD_ACCESS
owner - the class holding the fieldname - the name of the fieldtype - the field descriptorIllegalArgumentException - if the opcode kind is not Opcode.Kind.FIELD_ACCESS.static FieldInstruction of(Opcode op, ClassEntry owner, NameAndTypeEntry nameAndType)
op - the opcode for the specific type of field access instruction, which must be of kind Opcode.Kind.FIELD_ACCESS
owner - the class holding the fieldnameAndType - the name and field descriptor of the fieldIllegalArgumentException - if the opcode kind is not Opcode.Kind.FIELD_ACCESS.
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/instruction/FieldInstruction.html