blob: b7a3e190ff36d11f913c515aa782fc15843f0de2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/* ____ ____ ____ ____ ______ *\
** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
** /_____/\____/\___/\____/____/ **
\* */
// $Id$
package meta.util;
/** A base class for Java programs. */
public abstract class AbstractMain {
//########################################################################
// Public Functions
public static String script() {
StackTraceElement[] stack = new Throwable().getStackTrace();
return stack[stack.length - 1].getClassName();
}
public static Error abort() {
System.exit(1);
throw new Error("abort");
}
public static Error abort(String error) {
System.err.println(script() + ": " + error);
System.exit(1);
throw new Error();
}
public static Error abort(Exception exception) {
return abort("caught exception " + exception.toString());
}
//########################################################################
}
|