langtools/test/tools/javac/lib/ToolBox.java
changeset 22149 c7e024d637bf
parent 16549 1bdeedb5446c
child 23810 b92eb80925f0
--- a/langtools/test/tools/javac/lib/ToolBox.java	Mon Dec 16 14:32:12 2013 +0000
+++ b/langtools/test/tools/javac/lib/ToolBox.java	Mon Dec 16 15:07:13 2013 +0000
@@ -69,27 +69,17 @@
     public static final Path javaBinary = Paths.get(jdkUnderTest, "bin", "java");
     public static final Path javacBinary = Paths.get(jdkUnderTest, "bin", "javac");
 
-    public static final List<String> testToolVMOpts;
-    public static final List<String> testVMOpts;
+    public static final List<String> testVMOpts = readOptions("test.vm.opts");
+    public static final List<String> testToolVMOpts = readOptions("test.tool.vm.opts");
+    public static final List<String> testJavaOpts = readOptions("test.java.opts");
 
     private static final Charset defaultCharset = Charset.defaultCharset();
 
     static final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
 
-    static {
-        String sysProp = System.getProperty("test.tool.vm.opts");
-        if (sysProp != null && sysProp.length() > 0) {
-            testToolVMOpts = Arrays.asList(sysProp.split("\\s+"));
-        } else {
-            testToolVMOpts = Collections.<String>emptyList();
-        }
-
-        sysProp = System.getProperty("test.vm.opts");
-        if (sysProp != null && sysProp.length() > 0) {
-            testVMOpts = Arrays.asList(sysProp.split("\\s+"));
-        } else {
-            testVMOpts = Collections.<String>emptyList();
-        }
+    private static List<String> readOptions(String property) {
+        String options = System.getProperty(property, "");
+        return options.length() > 0 ? Arrays.asList(options.split("\\s+")) : Collections.<String>emptyList();
     }
 
     /**