vm/src/test/java/org/apidesign/vm4brwsr/Classes.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 29 Nov 2012 21:42:25 +0100
branchreflection
changeset 222 1f4a029d2826
child 223 860933a7787f
permissions -rw-r--r--
Basic tests for reflection on classes
jaroslav@222
     1
/**
jaroslav@222
     2
 * Back 2 Browser Bytecode Translator
jaroslav@222
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@222
     4
 *
jaroslav@222
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@222
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@222
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@222
     8
 *
jaroslav@222
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@222
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@222
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@222
    12
 * GNU General Public License for more details.
jaroslav@222
    13
 *
jaroslav@222
    14
 * You should have received a copy of the GNU General Public License
jaroslav@222
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@222
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@222
    17
 */
jaroslav@222
    18
package org.apidesign.vm4brwsr;
jaroslav@222
    19
jaroslav@222
    20
import java.io.IOException;
jaroslav@222
    21
import java.net.MalformedURLException;
jaroslav@222
    22
jaroslav@222
    23
/**
jaroslav@222
    24
 *
jaroslav@222
    25
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@222
    26
 */
jaroslav@222
    27
public class Classes {
jaroslav@222
    28
    public static boolean equalsClassesOfExceptions() {
jaroslav@222
    29
        return MalformedURLException.class.getSuperclass() == IOException.class;
jaroslav@222
    30
    }
jaroslav@222
    31
    public static boolean differenceInClasses() {
jaroslav@222
    32
        Class<?> c1 = MalformedURLException.class;
jaroslav@222
    33
        Class<?> c2 = IOException.class;
jaroslav@222
    34
        return c1 != c2;
jaroslav@222
    35
    }
jaroslav@222
    36
    
jaroslav@222
    37
    public static String name() {
jaroslav@222
    38
        return IOException.class.getName();
jaroslav@222
    39
    }
jaroslav@222
    40
    public static String simpleName() {
jaroslav@222
    41
        return IOException.class.getSimpleName();
jaroslav@222
    42
    }
jaroslav@222
    43
    public static String canonicalName() {
jaroslav@222
    44
        return IOException.class.getCanonicalName();
jaroslav@222
    45
    }
jaroslav@222
    46
    public static IOException newInstance() throws InstantiationException, IllegalAccessException {
jaroslav@222
    47
        return IOException.class.newInstance();
jaroslav@222
    48
    }
jaroslav@222
    49
}