56 throw new Error("unexpected exit code: " + rc |
57 throw new Error("unexpected exit code: " + rc |
57 + ", expected: " + expected_rc); |
58 + ", expected: " + expected_rc); |
58 } |
59 } |
59 |
60 |
60 static int getReturnCode(String name) { |
61 static int getReturnCode(String name) { |
61 switch (name) { |
62 return Main.Result.valueOf(name).exitCode; |
62 case "OK": |
|
63 return EXIT_OK; |
|
64 |
|
65 case "ERROR": |
|
66 return EXIT_ERROR; |
|
67 |
|
68 case "CMDERR": |
|
69 return EXIT_CMDERR; |
|
70 |
|
71 case "SYSERR": |
|
72 return EXIT_SYSERR; |
|
73 |
|
74 case "ABNORMAL": |
|
75 return EXIT_ABNORMAL; |
|
76 |
|
77 default: |
|
78 throw new IllegalArgumentException(name); |
|
79 } |
|
80 } |
63 } |
81 |
64 |
82 // The following is cut-n-paste from com.sun.tools.javac.main.Main |
|
83 static final int |
|
84 EXIT_OK = 0, // Compilation completed with no errors. |
|
85 EXIT_ERROR = 1, // Completed but reported errors. |
|
86 EXIT_CMDERR = 2, // Bad command-line arguments |
|
87 EXIT_SYSERR = 3, // System error or resource exhaustion. |
|
88 EXIT_ABNORMAL = 4; // Compiler terminated abnormally |
|
89 } |
65 } |