< prev index next > test/jdk/java/foreign/StdLibTest.java
Print this page
}
}
int vprintf(String format, List<PrintfArg> args) throws Throwable {
try (MemorySegment formatStr = toCString(format)) {
- return (int)vprintf.invokeExact(formatStr.baseAddress(),
- VaList.make(b -> args.forEach(a -> a.accept(b))));
+ VaList vaList = VaList.make(b -> args.forEach(a -> a.accept(b)));
+ int result = (int)vprintf.invokeExact(formatStr.baseAddress(), vaList);
+ try {
+ vaList.close();
+ }
+ catch (UnsupportedOperationException e) {
+ assertEquals(e.getMessage(), "Empty VaList");
+ }
+ return result;
}
}
private MethodHandle specializedPrintf(List<PrintfArg> args) {
//method type
< prev index next >