< prev index next >

test/jdk/java/foreign/TestUpcallException.java

Print this page
@@ -31,13 +31,10 @@
   * @run testng/othervm/native
   *   --enable-native-access=ALL-UNNAMED
   *   TestUpcallException
   */
  
- import jdk.incubator.foreign.CLinker;
- import jdk.incubator.foreign.FunctionDescriptor;
- import jdk.incubator.foreign.ResourceScope;
  import jdk.test.lib.Utils;
  import org.testng.annotations.Test;
  
  import java.io.BufferedReader;
  import java.io.IOException;

@@ -52,21 +49,21 @@
  
  public class TestUpcallException {
  
      @Test
      public void testExceptionInterpreted() throws InterruptedException, IOException {
-         boolean useSpec = false;
-         run(useSpec);
+         run(/* useSpec = */ false, /* isVoid = */ true);
+         run(/* useSpec = */ false, /* isVoid = */ false);
      }
  
      @Test
      public void testExceptionSpecialized() throws IOException, InterruptedException {
-         boolean useSpec = true;
-         run(useSpec);
+         run(/* useSpec = */ true, /* isVoid = */ true);
+         run(/* useSpec = */ true, /* isVoid = */ false);
      }
  
-     private void run(boolean useSpec) throws IOException, InterruptedException {
+     private void run(boolean useSpec, boolean isVoid) throws IOException, InterruptedException {
          Process process = new ProcessBuilder()
              .command(
                  Paths.get(Utils.TEST_JDK)
                       .resolve("bin")
                       .resolve("java")

@@ -75,11 +72,12 @@
                  "--add-modules", "jdk.incubator.foreign",
                  "--enable-native-access=ALL-UNNAMED",
                  "-Djava.library.path=" + System.getProperty("java.library.path"),
                  "-Djdk.internal.foreign.ProgrammableUpcallHandler.USE_SPEC=" + useSpec,
                  "-cp", Utils.TEST_CLASS_PATH,
-                 "ThrowingUpcall")
+                 "ThrowingUpcall",
+                 isVoid ? "void" : "non-void")
              .start();
  
          int result = process.waitFor();
          assertNotEquals(result, 0);
  
< prev index next >