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

JEP442 - SegmentAllocator:allocateUtf8String(String str) spec mismatches to behavior

    XMLWordPrintable

Details

    Description

      https://download.java.net/java/early_access/jdk21/docs/api/java.base/java/lang/foreign/SegmentAllocator.html#allocateUtf8String(java.lang.String)

      Spec mentions that - "Returns:
      a new native segment containing the converted C string."

      But this looks not true for all types of SegmentAlloctor's.

      For example :

      ===
      SegmentAllocator segmentAllocator1 = SegmentAllocator.prefixAllocator(MemorySegment.ofArray(new int[16]));
              MemorySegment memorySegment = segmentAllocator1.allocateUtf8String(strVal);
              System.out.println(memorySegment.isNative());
      ===

      The spec needs to be updated to align with the behavior.

      Attachments

        Issue Links

          Activity

            People

              pminborg Per-Ake Minborg
              kganapureddy Krushnareddy Ganapureddy
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: