1.1 --- a/test/tools/javac/lib/CompileFail.java Wed Sep 21 21:56:53 2011 -0700 1.2 +++ b/test/tools/javac/lib/CompileFail.java Thu Sep 22 09:24:01 2011 -0700 1.3 @@ -23,6 +23,7 @@ 1.4 1.5 import java.io.*; 1.6 import java.util.*; 1.7 +import com.sun.tools.javac.main.Main; 1.8 1.9 /* 1.10 * Utility class to emulate jtreg @compile/fail, but also checking the specific 1.11 @@ -58,32 +59,7 @@ 1.12 } 1.13 1.14 static int getReturnCode(String name) { 1.15 - switch (name) { 1.16 - case "OK": 1.17 - return EXIT_OK; 1.18 - 1.19 - case "ERROR": 1.20 - return EXIT_ERROR; 1.21 - 1.22 - case "CMDERR": 1.23 - return EXIT_CMDERR; 1.24 - 1.25 - case "SYSERR": 1.26 - return EXIT_SYSERR; 1.27 - 1.28 - case "ABNORMAL": 1.29 - return EXIT_ABNORMAL; 1.30 - 1.31 - default: 1.32 - throw new IllegalArgumentException(name); 1.33 - } 1.34 + return Main.Result.valueOf(name).exitCode; 1.35 } 1.36 1.37 - // The following is cut-n-paste from com.sun.tools.javac.main.Main 1.38 - static final int 1.39 - EXIT_OK = 0, // Compilation completed with no errors. 1.40 - EXIT_ERROR = 1, // Completed but reported errors. 1.41 - EXIT_CMDERR = 2, // Bad command-line arguments 1.42 - EXIT_SYSERR = 3, // System error or resource exhaustion. 1.43 - EXIT_ABNORMAL = 4; // Compiler terminated abnormally 1.44 }