OSDN Git Service

Merged gcj-eclipse branch to trunk.
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / libjava.lang / pr179.java
1 // Extended regression test for the PR 179.
2 //
3 // This tests the ".class" language syntax, initialization behaviour for 
4 // Class.isInstance() and Class.isAssignableFrom(), and isAssignableFrom()
5 // functionality in the event that an interface argument that is not 
6 // implemented by any loaded class is given.
7 // Note that the desired output changed from 1.4 to 1.5.
8
9 class A
10 {
11   static 
12   {
13     System.out.println("A initialized");
14   }
15 }
16
17 interface IA {}
18
19 class B implements IA
20 {
21   static 
22   {
23     System.out.println("B initialized");
24   }
25 }
26
27 class C
28 {
29   static 
30   {
31     System.out.println("C initialized");
32   }
33 }
34
35 interface IB {}
36
37 public class pr179
38 {
39   public static void main(String[] args)
40   {
41     System.out.println (A.class.isAssignableFrom (Object.class));
42     System.out.println (IB.class.isAssignableFrom (B.class));
43     System.out.println (IA.class.isAssignableFrom (B.class));
44     A a = new A();
45     System.out.println (C.class.isInstance (a));
46     C c = new C();
47     System.out.println (C.class.isInstance (c));
48   }
49 }