01: /*
02: * MethodInvoker6.java --
03: *
04: * tcljava/tests/signature/MethodInvoker6.java
05: *
06: * Copyright (c) 1998 by Moses DeJong
07: *
08: * See the file "license.terms" for information on usage and redistribution
09: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10: *
11: * RCS: @(#) $Id: MethodInvoker6.java,v 1.2 2002/12/27 14:33:20 mdejong Exp $
12: *
13: */
14:
15: package tests.signature;
16:
17: public class MethodInvoker6 {
18:
19: private static interface I {
20: }
21:
22: public static class A extends Object implements I {
23: }
24:
25: public static String call(Object obj) {
26: return "O";
27: }
28:
29: public static String call(I obj) {
30: return "I";
31: }
32:
33: public static Object getO() {
34: return new A();
35: }
36:
37: public static A getA() {
38: return new A();
39: }
40:
41: //this test is used to check the exceptions to the
42: //method resolver rules when the class Object is
43: //involved. When resolving we consider a signature
44: //with the Object class as less important then
45: //an interface that matches the signature
46:
47: public static void main(String[] argv) {
48:
49: Object o = getO();
50: A a = getA();
51:
52: String s;
53:
54: s = call(o); //should return "O"
55: p(s);
56:
57: s = call(a); //should return "I"
58: p(s);
59:
60: }
61:
62: public static void p(String arg) {
63: System.out.println(arg);
64: }
65:
66: }
|