RFR(M): 8204943: Improve message of ArrayStoreException.

Harold David Seigel harold.seigel at oracle.com
Wed Jun 13 18:54:49 UTC 2018

Hi Goetz,

These are nice improvements.

In jni.cpp, is it possible to call dimension() and bottom_klass() 
instead of using a loop to count the dimensions?

Also, in objArrayKlass.cpp, line 263, would it be more consistent with 
the other messages in method ObjArrayKlass::copy_array() to replace 
"object[]" with "object array" ?

Thanks, Harold

On 6/13/2018 5:23 AM, Lindenmaier, Goetz wrote:
> Hi,
> this change improves the messages of the ArrayStoreException:
> http://cr.openjdk.java.net/~goetz/wr18/8204943-exMsg-ArrayStore/01/
> For example:
> When doing arraycopy:
> "arraycopy: type mismatch: can not copy double[] into object[]"
> "arraycopy: type mismatch: can not copy object[] into boolean[]"
> For Object arrays, be more precise:
> "arraycopy: type mismatch: can not copy java.lang.String[] into java.util.Date[]"
> "arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object[] to the type of the destination array, java.util.Date"
> For JNI call to SetObjectArrayElement() print types and index:
> "type mismatch: can not store java.lang.String to java.util.Date[0]"
> "type mismatch: can not store java.lang.String to java.lang.Object[1][][]"
> For more examples see the included test.
> Best regards,
>    Goetz.

More information about the hotspot-runtime-dev mailing list