⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utils.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
字号:
package antlr;

public class Utils {
	private static boolean useSystemExit = true;
	private static boolean useDirectClassLoading = false;
	static {
		if ("true".equalsIgnoreCase(System.getProperty("ANTLR_DO_NOT_EXIT", "false")))
			useSystemExit = false;
		if ("true".equalsIgnoreCase(System.getProperty("ANTLR_USE_DIRECT_CLASS_LOADING", "false")))
			useDirectClassLoading = true;
	}

	/** Thanks to Max Andersen at JBOSS and Scott Stanchfield */
	public static Class loadClass(String name) throws ClassNotFoundException {
		try {
			ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
			if (!useDirectClassLoading && contextClassLoader!=null ) {
				return contextClassLoader.loadClass(name);
			}
			return Class.forName(name);
		}
		catch (Exception e) {
			return Class.forName(name);
		}
	}

	public static Object createInstanceOf(String name) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
		return loadClass(name).newInstance();
	}

	public static void error(String message) {
		if (useSystemExit)
			System.exit(1);
		throw new RuntimeException("ANTLR Panic: " + message);
	}

	public static void error(String message, Throwable t) {
		if (useSystemExit)
			System.exit(1);
		throw new RuntimeException("ANTLR Panic", t);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -