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

Improve out of bounds exception messages for MemorySegments

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 22, 23, 24
    • core-libs
    • None

      The out of bounds exception messages for MemorySegments can be improved. Rather than:

      Exception java.lang.IndexOutOfBoundsException: Out of bound access on segment MemorySegment{ heapBase: [B@4ccabbaa, address: 0x0, byteSize: 2 }; new offset = 2; new length = 1

      we could use:

      Exception java.lang.IndexOutOfBoundsException: Out of bound access on segment MemorySegment{ heapBase: [B@4ccabbaa, address: 0x0, byteSize: 2 }; attempting to access an element of length 1 at offset 2 which is outside the valid range 0 <= offset+length < byteSize (=2)

            pminborg Per-Ake Minborg
            pminborg Per-Ake Minborg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: