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

public sealed Interface NewPrimitiveArrayInstruction

extends Instruction
permits BoundNewPrimitiveArrayInstruction, UnboundNewPrimitiveArrayInstruction
Known Direct Implementers
jdk.internal.classfile.impl.AbstractInstruction.BoundNewPrimitiveArrayInstruction, jdk.internal.classfile.impl.AbstractInstruction.UnboundNewPrimitiveArrayInstruction
Imports
java.lang.classfile.CodeBuilder, .CodeElement, .CodeModel, .Instruction, .Opcode, .TypeKind, jdk.internal.classfile.impl.AbstractInstruction

Models a newarray instruction in the code array of a Code attribute. Delivered as a CodeElement when traversing the elements of a CodeModel.

A new primitive array instruction is composite:

NewPrimitiveArrayInstruction(TypeKind typeKind)
NewPrimitiveArrayInstruction(TypeKind typeKind)
where typeKind is primitive and not void.
Since
24
Java Virtual Machine Specification
6.5.newarray newarray
See Also
Opcode.Kind#NEW_PRIMITIVE_ARRAY, CodeBuilder::newarray

Method Summary

Modifier and TypeMethod and Description
public static NewPrimitiveArrayInstruction

Returns:

a new primitive array instruction
of
(TypeKind
the component type of the array
typeKind
)

Returns a new primitive array instruction.

public TypeKind

Returns:

the component type of the array
typeKind
()

Returns the component type of the array.

Inherited from java.lang.classfile.Instruction:
opcodesizeInBytes

Method Detail

ofback to summary
public static NewPrimitiveArrayInstruction of(TypeKind typeKind)

Returns a new primitive array instruction.

Parameters
typeKind:TypeKind

the component type of the array

Returns:NewPrimitiveArrayInstruction

a new primitive array instruction

Exceptions
IllegalArgumentException:
when typeKind is not primitive or is void
See Also
TypeKind::fromNewarrayCode
typeKindback to summary
public TypeKind typeKind()

Returns the component type of the array.

API Note

The backing array code for this instruction is available through typeKind().newarrayCode().

Returns:TypeKind

the component type of the array