aastore


Operation Store into reference array

aastore


Forms aastore = 83 (0x53)

Stack ..., arrayref, index, value ...

Description The arrayref must be of type reference and must refer to an array whose components are of type reference. The index must be of type int and value must be of type reference. The arrayref, index, and value are popped from the operand stack. The reference value is stored as the component of the array at index.

The type of value must be assignment compatible (§2.6.6) with the type of the components of the array referenced by arrayref. Assignment of a value of reference type S (source) to a variable of reference type T (target) is allowed only when the type S supports all the operations defined on type T. The detailed rules follow:

S cannot be an interface type, because there are no instances of interfaces, only instances of classes and arrays.

Runtime Exceptions If arrayref is null, aastore throws a NullPointerException.

Otherwise, if index is not within the bounds of the array referenced by arrayref, the aastore instruction throws an ArrayIndex-OutOfBounds-Exception.

Otherwise, if arrayref is not null and the actual type of value is not assignment compatible (§2.6.6) with the actual type of the components of the array, aastore throws an ArrayStoreException.