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

SegmentAllocator:allocateArray throws IllegalArgumentException in some cases

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 19
    • core-libs

      Observed that SegmentAllocator:allocateArray(*) methods throws undocumented IllegalArgumentException where the layout alignment is more than their bitsize.

      The possible scenario of these methods throwing IAEx is not documented.

      For the below case :
       SegmentAllocator.implicitAllocator().allocateArray(ValueLayout.JAVA_BYTE.withBitAlignment(16),new byte[]{1,2,
                      3});
      will result in - java.lang.IllegalArgumentException: Source layout alignment greater than its size

      The spec can be enhanced for this case.

            Unassigned Unassigned
            kganapureddy Krushnareddy Ganapureddy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: