< prev index next >

test/jdk/java/foreign/TestSlices.java

Print this page
@@ -33,11 +33,10 @@
  import org.testng.annotations.*;
  import static org.testng.Assert.*;
  
  /*
   * @test
-  * @enablePreview
   * @run testng/othervm -Xverify:all TestSlices
   */
  public class TestSlices {
  
      static MemoryLayout LAYOUT = MemoryLayout.sequenceLayout(2,

@@ -51,11 +50,11 @@
          try (Arena arena = Arena.ofConfined()) {
              MemorySegment segment = arena.allocate(LAYOUT);;
              //init
              for (long i = 0 ; i < 2 ; i++) {
                  for (long j = 0 ; j < 5 ; j++) {
-                     VH_ALL.set(segment, i, j, (int)j + 1 + ((int)i * 5));
+                     VH_ALL.set(segment, 0L, i, j, (int)j + 1 + ((int)i * 5));
                  }
              }
  
              checkSlice(segment, handle, lo, hi, values);
          }

@@ -63,20 +62,20 @@
  
      @Test(dataProvider = "slices")
      public void testSliceBadIndex(VarHandle handle, int lo, int hi, int[] values) {
          try (Arena arena = Arena.ofConfined()) {
              MemorySegment segment = arena.allocate(LAYOUT);;
-             assertThrows(() -> handle.get(segment, lo, 0));
-             assertThrows(() -> handle.get(segment, 0, hi));
+             assertThrows(() -> handle.get(segment, 0L, lo, 0));
+             assertThrows(() -> handle.get(segment, 0L, 0, hi));
          }
      }
  
      static void checkSlice(MemorySegment segment, VarHandle handle, long i_max, long j_max, int... values) {
          int index = 0;
          for (long i = 0 ; i < i_max ; i++) {
              for (long j = 0 ; j < j_max ; j++) {
-                 int x = (int) handle.get(segment, i, j);
+                 int x = (int) handle.get(segment, 0L, i, j);
                  assertEquals(x, values[index++]);
              }
          }
          assertEquals(index, values.length);
      }
< prev index next >