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

Improve message of ArrayStoreException.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • 11
    • hotspot
    • None
    • b19

        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][][]"

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

                Created:
                Updated:
                Resolved: