< prev index next >

test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java

Print this page

        

@@ -44,10 +44,27 @@
     private static final String PRINT_FLAGS_RANGES = "-XX:+PrintFlagsRanges";
 
     /* StringBuilder to accumulate failed message */
     private static final StringBuilder finalFailedMessage = new StringBuilder();
 
+    /* Used to start the JVM with the same type as current */
+    static String VMType;
+
+    static {
+        if (Platform.isServer()) {
+            VMType = "-server";
+        } else if (Platform.isClient()) {
+            VMType = "-client";
+        } else if (Platform.isMinimal()) {
+            VMType = "-minimal";
+        } else if (Platform.isGraal()) {
+            VMType = "-graal";
+        } else {
+            VMType = null;
+        }
+    }
+
     /**
      * Add dependency for option depending on it's name. E.g. enable G1 GC for
      * G1 options or add prepend options to not hit constraints.
      *
      * @param option option

@@ -329,14 +346,13 @@
 
         if (additionalArgs.length > 0) {
             runJava.addAll(Arrays.asList(additionalArgs));
         }
         
-        if (Platform.isClient()) {
-            runJava.add("-client");
+        if (VMType != null) {
+            runJava.add(VMType);
         }
-        
         runJava.add(PRINT_FLAGS_RANGES);
         runJava.add("-version");
 
         p = ProcessTools.createJavaProcessBuilder(runJava.toArray(new String[0])).start();
 
< prev index next >