Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8204943

Improve message of ArrayStoreException.

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b19

      Backports

        Description

        Print the problematic types in ArrayStoreException.

        When doing arraycopy:

        "arraycopy: type mismatch: can not copy double[] into object array[]"
        "arraycopy: type mismatch: can not copy object array[] into boolean[]"

        For Object arrays, be more precise:

        If one of the objects passed to araycopy is not an array at all:
        "arraycopy: source type java.lang.String is not an array"
        "arraycopy: destination type java.lang.String is not an array"
        If the element types of the array mismatch:
        "arraycopy: type mismatch: can not copy java.lang.String[] into java.util.Date[]"
        If one of the elements of source can not be cast to the type of the destination:
        "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][][]"

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                goetz Goetz Lindenmaier
                Reporter:
                goetz Goetz Lindenmaier
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: