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

Thomas Stüfe thomas.stuefe at gmail.com
Mon Jun 18 16:12:25 UTC 2018


See comment in JBS. I think the problem is that we read length from an
assumed arrayOop which is really an instanceOop, which yields random
results.

..Thomas

On Mon, Jun 18, 2018 at 2:24 PM, Thomas Stüfe <thomas.stuefe at gmail.com> wrote:
> Thanks, we can reproduce the error locally and will take a look (Goetz
> is out today and will be back tomorrow).
>
> On Mon, Jun 18, 2018 at 8:17 AM, David Holmes <david.holmes at oracle.com> wrote:
>> Just so reviewers are aware the new test is failing intermittently:
>>
>> https://bugs.openjdk.java.net/browse/JDK-8205141
>>
>> Though how it can be intermittent has me baffled.
>>
>> David
>>
>>
>> On 15/06/2018 8:29 PM, Lindenmaier, Goetz wrote:
>>>
>>> Hi Lois,
>>>
>>> thanks a lot!
>>>
>>> I'll run it through jdk-submit and then push.
>>>
>>> Best regards,
>>>    Goetz.
>>>
>>>> -----Original Message-----
>>>> From: hotspot-runtime-dev [mailto:hotspot-runtime-dev-
>>>> bounces at openjdk.java.net] On Behalf Of Lois Foltan
>>>> Sent: Donnerstag, 14. Juni 2018 22:50
>>>> To: Harold David Seigel <harold.seigel at oracle.com>; hotspot-runtime-
>>>> dev at openjdk.java.net
>>>> Subject: Re: RFR(M): 8204943: Improve message of ArrayStoreException.
>>>>
>>>> +1
>>>> Lois
>>>>
>>>> On 6/14/2018 2:57 PM, Harold David Seigel wrote:
>>>>>
>>>>> 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