RFR(M): 8204943: Improve message of ArrayStoreException.
goetz.lindenmaier at sap.com
Thu Jun 14 15:42:34 UTC 2018
> 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?
Yes, fixed. Much better now!
> 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" ?
I also figured that it's not necessarily an array at all, and added
"arraycopy: source type java.lang.String is not an array");
"arraycopy: destination type java.lang.String is not an array");
I checked for the same problem in the JNI function,
but that catches it already and throws ArrayIndexOutOfBounds
But as I understand passing something that is not an array
is undefined for this function. (Also null is not catched.)
But I easily could add a check whether the oop is an array.
See test case testNativeASMessages2() ... which I will
> 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
> > "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"
> > "type mismatch: can not store java.lang.String to java.lang.Object"
> > For more examples see the included test.
> > Best regards,
> > Goetz.
More information about the hotspot-runtime-dev