source: trunk/gcc/libjava/testsuite/libjava.lang/pr179.java

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.1 KB
Line 
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//
8// Bryce McKinlay <bryce@albatross.co.nz>
9
10class A
11{
12 static
13 {
14 System.out.println("A initialized");
15 }
16}
17
18interface IA {}
19
20class B implements IA
21{
22 static
23 {
24 System.out.println("B initialized");
25 }
26}
27
28class C
29{
30 static
31 {
32 System.out.println("C initialized");
33 }
34}
35
36interface IB {}
37
38public class pr179
39{
40 public static void main(String[] args)
41 {
42 System.out.println (A.class.isAssignableFrom (Object.class));
43 System.out.println (IB.class.isAssignableFrom (B.class));
44 System.out.println (IA.class.isAssignableFrom (B.class));
45 A a = new A();
46 System.out.println (C.class.isInstance (a));
47 C c = new C();
48 System.out.println (C.class.isInstance (c));
49 }
50}
51
52/* Expected Output:
53A initialized
54false
55B initialized
56false
57true
58C initialized
59false
60true
61*/
Note: See TracBrowser for help on using the repository browser.