RFR(xs): 8205141: runtime/exceptionMsgs/ArrayStoreException/ArrayStoreExceptionTest.java failed with "assert(k->is_objArray_klass()) failed: cast to ObjArrayKlass"

Thomas Stüfe thomas.stuefe at gmail.com
Tue Jun 19 07:26:36 UTC 2018

Hi all,

may I have reviews for this fix please:


Goetz' new ArrayStoreExceptionTest uncovered a problem if the caller
erroneously feeds an jobject as jobjectArray parameter to

The current behavior is to randomly either return a misleading
ArrayIndexOOBE, or to assert (debug) or to overwrite some memory
(release) and potentially crash.

I know that feeding an jobject as jobjectArray is of course all wrong
and UB I still think it makes in this case sense to catch that and
throw a correct ArrayStoreException instead of the current behavior.

Now, SetObjectArrayElement will throw:

- "xxx is not an array" for types which are not even an array
- "xxx is not an object array" for primitive arrays.

Thank you,


More information about the hotspot-runtime-dev mailing list