01: // Copyright (c) 2001 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.expr;
05:
06: import gnu.bytecode.*;
07:
08: // Should be moved to some other package? FIXME
09:
10: /** A class type implemented as a pair of an interface and a class.
11: * This is how true multiple inheritance can be implemented.
12: */
13:
14: public class PairClassType extends ClassType {
15: // FIXME should probably inherit from ObjectType or even Type
16: // rather than ClassType, and have an interfaceType field,
17: // which getImplementationType would return
18: /*
19: public ClassType interfaceType;
20: public Type getImplementationType()
21: {
22: return interfaceType;
23: }
24: String name;
25: */
26:
27: Object staticLink;
28:
29: public ClassType instanceType;
30:
31: public PairClassType() {
32: }
33:
34: PairClassType(Class reflectInterface, Class reflectInstanceClass) {
35: super (reflectInterface.getName());
36: setExisting(true);
37: access_flags |= Access.INTERFACE;
38: reflectClass = reflectInterface;
39: registerTypeForClass(reflectInterface, this );
40: this .instanceType = (ClassType) Type.make(reflectInstanceClass);
41: }
42:
43: public static PairClassType make(Class reflectInterface,
44: Class reflectInstanceClass) {
45: return new PairClassType(reflectInterface, reflectInstanceClass);
46: }
47:
48: public static PairClassType make(Class reflectInterface,
49: Class reflectInstanceClass, Object staticLink) {
50: PairClassType type = new PairClassType(reflectInterface,
51: reflectInstanceClass);
52: type.staticLink = staticLink;
53: return type;
54: }
55:
56: public Object getStaticLink() {
57: return staticLink;
58: }
59: }
|