checking outstanding changes in my CVS
[IRC.git] / Robust / src / IR / TypeUtil.java
index ce0ead6fe2060017d3627412b23612b1b7a99166..d289a9535e8d20ba2956d174d2826fbc65460b41 100644 (file)
@@ -52,6 +52,7 @@ public class TypeUtil {
       //have to find class
       addNewClass(classname, todo);
       cd=(ClassDescriptor)state.getClassSymbolTable().get(classname);
+
       System.out.println("Build class:"+cd);
       todo.add(cd);
     }
@@ -86,6 +87,10 @@ public class TypeUtil {
   
   public MethodDescriptor getExecute() {
     ClassDescriptor cd = getClass(TypeUtil.TaskClass);
+
+    if(cd == null && state.DSMTASK)
+      throw new Error("Task.java is not included");
+
     for(Iterator methodit = cd.getMethodTable().getSet("execute").iterator(); methodit.hasNext();) {
       MethodDescriptor md = (MethodDescriptor) methodit.next();
       if (md.numParameters()!=0 || md.getModifiers().isStatic())
@@ -300,6 +305,19 @@ NextMethod:
       throw new Error("Case not handled:"+possiblesuper+" "+cd2);
   }
 
+  public TypeDescriptor mostSpecific(TypeDescriptor td1, TypeDescriptor td2) {
+    if( isSuperorType( td1, td2 ) ) {
+      return td2;
+    }
+    if( isSuperorType( td2, td1 ) ) {
+      return td1;
+    }
+    throw new Error( td1+" and "+td2+" have no superclass relationship" );
+  }
+
+  public TypeDescriptor mostSpecific(TypeDescriptor td1, TypeDescriptor td2, TypeDescriptor td3) {
+    return mostSpecific( td1, mostSpecific( td2, td3 ) );
+  }
 
   public boolean isSuperorType(ClassDescriptor possiblesuper, ClassDescriptor cd2) {
     if (possiblesuper==cd2)