< prev index next >

test/jdk/java/foreign/valist/VaListTest.java

Print this page
@@ -212,10 +212,24 @@
          try (MemorySegment stub = abi.upcallStub(callback, desc)) {
              target.invokeExact(stub.baseAddress());
          }
      }
  
+     @Test(expectedExceptions = UnsupportedOperationException.class,
+           expectedExceptionsMessageRegExp = ".*Empty VaList.*")
+     public void testEmptyNotCloseable() {
+         VaList list = VaList.empty();
+         list.close();
+     }
+ 
+     @Test(expectedExceptions = UnsupportedOperationException.class,
+           expectedExceptionsMessageRegExp = ".*Empty VaList.*")
+     public void testEmptyVaListFromBuilderNotCloseable() {
+         VaList list = VaList.make(b -> {});
+         list.close();
+     }
+ 
      @DataProvider
      public static Object[][] upcalls() {
          return new Object[][]{
              { linkVaListCB("upcallBigStruct"), VaListConsumer.mh(vaList -> {
                  try (MemorySegment struct = vaList.vargAsSegment(BigPoint_LAYOUT)) {
< prev index next >