rest of new build strategrest of new build strategyy
[IRC.git] / Robust / src / IR / ClassDescriptor.java
index d9d611d5d1f9e16b2867b759884d969650406998..46d73e764737fff8d69eee7940bc23cf33be8118 100644 (file)
@@ -18,6 +18,9 @@ public class ClassDescriptor extends Descriptor {
   SymbolTable flags;
   SymbolTable methods;
   
+  Hashtable singleImports;
+  Vector multiImports;
+  
   int numstaticblocks = 0;
   int numstaticfields = 0;
   
@@ -42,11 +45,14 @@ public class ClassDescriptor extends Descriptor {
   
   boolean isClassLibrary=false;
   
+  String sourceFileName;
+  
   public ClassDescriptor(String classname, boolean isInterface) {
     this("", classname, isInterface);
   }
 
   public ClassDescriptor(String packagename, String classname, boolean isInterface) {
+    //make the name canonical by class file path (i.e. package)
     super(classname);
     superclass=null;
     flags=new SymbolTable();
@@ -97,6 +103,10 @@ public class ClassDescriptor extends Descriptor {
     return fieldvec;
   }
 
+  public String getPackage() {
+    return packagename;
+  }
+
   public SymbolTable getFlagTable() {
     return flags;
   }
@@ -195,12 +205,18 @@ public class ClassDescriptor extends Descriptor {
     ClassDescriptor cn=this;
     while(true) {
       if (cn==null) {
+        // TODO: the original code returned "null" if no super class
+        // ever defines the method.  Is there a situation where this is
+        // fine and the client should take other actions?  If not, we should
+        // change this warning to an error.
+        System.out.println( "ClassDescriptor.java: WARNING "+md+
+                            " did not resolve to an actual method." );
        return null;
       }
-      Set possiblematches=cn.getMethodTable().getSet(md.getSymbol());
-      boolean foundmatch=false;
+      Set possiblematches=cn.getMethodTable().getSetFromSameScope(md.getSymbol());
       for(Iterator matchit=possiblematches.iterator(); matchit.hasNext();) {
        MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
+       
        if (md.matches(matchmd)) {
          return matchmd;
        }
@@ -393,4 +409,21 @@ public class ClassDescriptor extends Descriptor {
     return isClassLibrary;
   }
   
+  public void setSourceFileName(String sourceFileName){
+    this.sourceFileName=sourceFileName;
+  }
+  
+  public void setImports(Hashtable singleImports, Vector multiImports) {
+    this.singleImports = singleImports;
+    this.multiImports  = multiImports;
+  }
+  
+  public String getSourceFileName(){
+    return this.sourceFileName;
+  }
+  
+  public Hashtable getSingleImportMappings() {
+    return this.singleImports;
+  }
+  
 }