OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [Class_1.java] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
class C {}
2
class D extends C implements I {}
3
interface I {}
4
interface J extends I {}
5
 
6
public class Class_1
7
{
8
  static void printIsAssignableFrom(Class a, Class b, boolean c)
9
    {
10
      // The field 'c' can be viewed to see the expected value.
11
      System.out.println(a.isAssignableFrom(b));
12
    }
13
 
14
  public static void main (String arg[])
15
  {
16
    System.out.println("Testing class `Class_1'...");
17
    printIsAssignableFrom(C.class, Object.class, false);
18
    printIsAssignableFrom(C.class, C.class, true);
19
    printIsAssignableFrom(C.class, D.class, true);
20
    printIsAssignableFrom(D.class, C.class, false);
21
 
22
    printIsAssignableFrom(Object.class, int[].class, true);
23
    printIsAssignableFrom(int[].class, int[].class, true);
24
    printIsAssignableFrom(C[].class, D.class, false);
25
    printIsAssignableFrom(C[].class, D[].class, true);
26
    printIsAssignableFrom(C[].class, C[][].class, false);
27
 
28
    printIsAssignableFrom(Object.class, I.class, true);
29
    printIsAssignableFrom(I.class, I.class, true);
30
    printIsAssignableFrom(D.class, I.class, false);
31
    printIsAssignableFrom(I.class, D.class, true);
32
 
33
    printIsAssignableFrom(D.class, J.class, false);
34
    printIsAssignableFrom(J.class, D.class, false);
35
 
36
    printIsAssignableFrom(I.class, J.class, true);
37
    printIsAssignableFrom(J.class, J.class, true);
38
    printIsAssignableFrom(J.class, I.class, false);
39
 
40
    // Returns true iff both Class objects are equal.
41
    printIsAssignableFrom(long.class, long.class, true);
42
 
43
    // Does not work for primitive types in general.
44
    printIsAssignableFrom(long.class, int.class, false);
45
  }
46
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.