1 package polyglot.ext.jl.types; 2 3 import polyglot.types.*; 4 import polyglot.util.*; 5 import java.io.*; 6 7 11 public abstract class TypeObject_c implements TypeObject 12 { 13 protected transient TypeSystem ts; 14 protected Position position; 15 16 17 protected TypeObject_c() { 18 } 19 20 21 public TypeObject_c(TypeSystem ts) { 22 this(ts, null); 23 } 24 25 public TypeObject_c(TypeSystem ts, Position pos) { 26 this.ts = ts; 27 this.position = pos; 28 } 29 30 public Object copy() { 31 try { 32 return (TypeObject_c) super.clone(); 33 } 34 catch (CloneNotSupportedException e) { 35 throw new InternalCompilerError("Java clone() weirdness."); 36 } 37 } 38 39 public TypeSystem typeSystem() { 40 return ts; 41 } 42 43 public Position position() { 44 return position; 45 } 46 47 private void writeObject(ObjectOutputStream out) throws IOException { 48 out.defaultWriteObject(); 49 } 50 51 private void readObject(ObjectInputStream in) throws IOException, 52 ClassNotFoundException { 53 if (in instanceof TypeInputStream) { 54 ts = ((TypeInputStream) in).getTypeSystem(); 55 } 56 57 in.defaultReadObject(); 58 } 59 60 64 public final boolean equals(Object o) { 65 return o instanceof TypeObject && ts.equals(this, (TypeObject) o); 66 } 67 68 public int hashCode() { 69 return super.hashCode(); 70 } 71 72 75 public boolean equalsImpl(TypeObject t) { 76 return t == this; 77 } 78 79 83 void equalsImpl(Object o) { } 84 } 85 | Popular Tags |