< prev index next >

test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/HumongousTemplateClassGen.java

Print this page
rev 59093 : imported patch randomness-code_vmTestbase_unloading

@@ -27,10 +27,12 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Random;
+import jdk.test.lib.Utils;
 
 /*
  *  This class is compiled and invoke due the build to produce
  *  HumongousTemplateClass.java. The size of generated file is
  *  too large to store it in the repository.

@@ -57,20 +59,21 @@
     records.add("    }");
     records.add("\n");
 }
 
 public static void addIteration(int itNum, List<String> records) {
+    Random rng = Utils.getRandomInstance();
     records.add("    public static Object public_static_object_" + itNum
             + " = new Object();\n");
     records.add("    protected static Object protected_static_object_" + itNum
             + " = new Object();\n");
     records.add("    private static Object private_static_Object_" + itNum
             + " = new Object();\n");
     records.add("\n");
     records.add("    public static long public_static_long_" + itNum + ";\n");
     records.add("    protected static long protected_static_long_" + itNum
-            + " = new Random().nextLong();\n");
+            + " = " + rng.nextLong() + "L;\n");
     records.add("    private static long private_static_long_" + itNum
             + " = 42;\n");
     records.add("\n");
     records.add("    public Object public_object_" + itNum
             + " = new Object();\n");

@@ -80,11 +83,11 @@
             + " = new Object();\n");
     records.add("\n");
     records.add("    public long public_long_" + itNum + " = 43;\n");
     records.add("    protected long protected_long_" + itNum + " = 44;\n");
     records.add("    private long private_long_" + itNum
-            + " = new Random().nextLong();\n");
+            + " = " + rng.nextLong() + "L;\n");
 }
 public static void main(String[] args) throws Exception {
     if (args.length < 1) {
         System.out.println("Usage: HumongousTemplateClassGen "
                         + "<vm-testbase_src_folder>");
< prev index next >