fixes on analyses to compile the eyetracking benchmark
[IRC.git] / Robust / src / IR / TypeDescriptor.java
index 1763617954e7c0ae5c095842e92e5aaa06127e5d..dfaf3550e600cad9dc908bf117b5426e09883713 100644 (file)
@@ -30,18 +30,19 @@ public class TypeDescriptor extends Descriptor {
   private int type;
   ClassDescriptor class_desc;
   boolean isClassNameRef = false;
-  
+
   private Vector<AnnotationDescriptor> annotationSet;
+  private TypeExtension typeExtension;
 
   public boolean equals(Object o) {
     if (o instanceof TypeDescriptor) {
       TypeDescriptor t=(TypeDescriptor)o;
       if (t.type!=type)
-       return false;
+        return false;
       if ((type==CLASS)&&(!t.getSymbol().equals(getSymbol())))
-       return false;
+        return false;
       if (t.arraycount!=arraycount)
-       return false;
+        return false;
       if (t.isClassNameRef != this.isClassNameRef)
         return false;
       return true;
@@ -58,18 +59,17 @@ public class TypeDescriptor extends Descriptor {
       return false;
     return true;
   }
-  
+
   public boolean isClassNameRef() {
     return this.isClassNameRef;
   }
-  
+
   public void setClassNameRef() {
     this.isClassNameRef = true;
   }
 
   public int hashCode() {
     int hashcode=type^arraycount;
-    hashcode+=annotationSet.hashCode();
     if (type==CLASS)
       hashcode^=getSymbol().hashCode();
     return hashcode;
@@ -79,14 +79,14 @@ public class TypeDescriptor extends Descriptor {
     if (arraycount!=0||!isClass())
       return false;
     return (name.equals("bytewrapper")||
-           name.equals("booleanwrapper")||
-           name.equals("shortwrapper")||
-           name.equals("intwrapper")||
-           name.equals("longwrapper")||
-           name.equals("charwrapper")||
-           name.equals("floatwrapper")||
-           name.equals("doublewrapper")||
-           name.equals("Objectwrapper"));
+            name.equals("booleanwrapper")||
+            name.equals("shortwrapper")||
+            name.equals("intwrapper")||
+            name.equals("longwrapper")||
+            name.equals("charwrapper")||
+            name.equals("floatwrapper")||
+            name.equals("doublewrapper")||
+            name.equals("Objectwrapper"));
   }
 
   public TypeDescriptor makeArray(State state) {
@@ -150,7 +150,7 @@ public class TypeDescriptor extends Descriptor {
       return "float";
     else if (isOffset())
       return "short";
-    else 
+    else
       throw new Error("Error Type: "+type);
   }
 
@@ -186,7 +186,7 @@ public class TypeDescriptor extends Descriptor {
     //Can't safely use [ in C
     if (isArray())
       return "_AR_"+this.dereference().getSafeDescriptor();
-    else if (isClass())
+    else if (isClass()||isEnum())
       return class_desc.getSafeDescriptor();
     else if (isByte())
       return "B";
@@ -206,7 +206,7 @@ public class TypeDescriptor extends Descriptor {
       return "F";
     else if (isTag())
       return "T";
-    else throw new Error();
+    else throw new Error(toString());
   }
 
   public boolean isNumber() {
@@ -267,12 +267,12 @@ public class TypeDescriptor extends Descriptor {
   public boolean isEnum() {
     if(this.type != CLASS) {
       return false;
-    } else if(this.class_desc != null){
+    } else if(this.class_desc != null) {
       return this.class_desc.isEnum();
     }
     return false;
   }
-  
+
   public boolean isClass() {
     return (type==CLASS && !isEnum());
   }
@@ -282,7 +282,7 @@ public class TypeDescriptor extends Descriptor {
   }
 
   public boolean isImmutable() {
-    return isPrimitive() || isString();
+    return isPrimitive();
   }
 
   public TypeDescriptor(NameDescriptor name) {
@@ -338,7 +338,7 @@ public class TypeDescriptor extends Descriptor {
     }
     for(int i=0; i<arraycount; i++)
       str+="[]";
-    return str;    
+    return str;
   }
 
   private static String decodeInt(int type) {
@@ -368,13 +368,21 @@ public class TypeDescriptor extends Descriptor {
       return "offset";
     else throw new Error();
   }
-  
-  public void addAnnotationMarker(AnnotationDescriptor an){
+
+  public void addAnnotationMarker(AnnotationDescriptor an) {
     annotationSet.add(an);
   }
-  
-  public Vector<AnnotationDescriptor> getAnnotationMarkers(){
+
+  public Vector<AnnotationDescriptor> getAnnotationMarkers() {
     return annotationSet;
   }
-  
+
+  public void setExtension(TypeExtension te) {
+    typeExtension=te;
+  }
+
+  public TypeExtension getExtension() {
+    return typeExtension;
+  }
+
 }