jaroslav@222: /** jaroslav@222: * Back 2 Browser Bytecode Translator jaroslav@222: * Copyright (C) 2012 Jaroslav Tulach jaroslav@222: * jaroslav@222: * This program is free software: you can redistribute it and/or modify jaroslav@222: * it under the terms of the GNU General Public License as published by jaroslav@222: * the Free Software Foundation, version 2 of the License. jaroslav@222: * jaroslav@222: * This program is distributed in the hope that it will be useful, jaroslav@222: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@222: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@222: * GNU General Public License for more details. jaroslav@222: * jaroslav@222: * You should have received a copy of the GNU General Public License jaroslav@222: * along with this program. Look for COPYING file in the top folder. jaroslav@222: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@222: */ jaroslav@222: package org.apidesign.vm4brwsr; jaroslav@222: jaroslav@222: import java.io.IOException; jaroslav@222: import java.net.MalformedURLException; jaroslav@222: jaroslav@222: /** jaroslav@222: * jaroslav@222: * @author Jaroslav Tulach jaroslav@222: */ jaroslav@235: @ClassesMarker(number = 10) jaroslav@222: public class Classes { jaroslav@222: public static boolean equalsClassesOfExceptions() { jaroslav@222: return MalformedURLException.class.getSuperclass() == IOException.class; jaroslav@222: } jaroslav@222: public static boolean differenceInClasses() { jaroslav@222: Class c1 = MalformedURLException.class; jaroslav@222: Class c2 = IOException.class; jaroslav@222: return c1 != c2; jaroslav@222: } jaroslav@222: jaroslav@225: public static String classForInstance() { jaroslav@225: return new IOException().getClass().getName().toString(); jaroslav@225: } jaroslav@225: jaroslav@222: public static String name() { jaroslav@223: return IOException.class.getName().toString(); jaroslav@222: } jaroslav@222: public static String simpleName() { jaroslav@222: return IOException.class.getSimpleName(); jaroslav@222: } jaroslav@222: public static String canonicalName() { jaroslav@222: return IOException.class.getCanonicalName(); jaroslav@222: } jaroslav@231: public static boolean newInstance() throws Exception { jaroslav@231: IOException ioe = IOException.class.newInstance(); jaroslav@231: if (ioe instanceof IOException) { jaroslav@231: return ioe.getClass() == IOException.class; jaroslav@231: } jaroslav@231: throw new IllegalStateException("Not a subtype: " + ioe); jaroslav@222: } jaroslav@235: public static int getMarker() { jaroslav@235: if (!Classes.class.isAnnotationPresent(ClassesMarker.class)) { jaroslav@235: return -2; jaroslav@235: } jaroslav@235: ClassesMarker cm = Classes.class.getAnnotation(ClassesMarker.class); jaroslav@235: return cm == null ? -1 : cm.number(); jaroslav@235: } jaroslav@222: }