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

Harold David Seigel harold.seigel at oracle.com
Thu Jun 14 18:57:22 UTC 2018


Hi Goetz,

The new webrev looks good!

Thanks, Harold


On 6/14/2018 11:58 AM, Lindenmaier, Goetz wrote:
> Hi Lois,
>
> thanks for looking at my change!
>
> I prepared a new webrev considering your and Harold's comments:
> http://cr.openjdk.java.net/~goetz/wr18/8204943-exMsg-ArrayStore/02/
>
>> Looks good, nice improvement.
> Thanks :)
>
>> - I think "ResourceMark rm;" could be changed to "ResourceMark rm(THREAD);"
>>     objArrayKlass.cpp line #238 & 261,
>>     typeArrayKlass.cpp line #136
> Good point. Fixed all of them in the functions I touched.
>
>> - objArrayKlass.cpp line #263 - can you capitalize the word "object" as
>> I am assuming it is a java/lang/Object[]?
> No, it just wants to say that the array has some object type instead of
> primitives.  See also Harolds mail. I changed it to 'object array' as in
> the exception texts below.
> I could change it to java.lang.Object[] or java.lang.Date[],
> but then I should do that for the AIOOBs, too?
> And how to put multidimensional arrays?
>
> 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");
> See also my Mail to Harold.
>
> Best regards,
>    Goetz.
>
>
>
>> Thanks,
>> Lois
>>
>> 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