X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FIR%2FTypeUtil.java;h=8170472080016cfa6f5cdcccaffb6399cfee04ef;hb=5ece740dddfbc9823184d9d5a5818bac06341412;hp=9467e09cc93d50ff92e72b6fd91bcde5ba8534f6;hpb=80cbea4f920600908b2c6b84ce8190bd3ef4d9d3;p=IRC.git diff --git a/Robust/src/IR/TypeUtil.java b/Robust/src/IR/TypeUtil.java index 9467e09c..81704720 100644 --- a/Robust/src/IR/TypeUtil.java +++ b/Robust/src/IR/TypeUtil.java @@ -44,6 +44,10 @@ public class TypeUtil { public void addNewClass(String cl, Set todo) { //search through the default locations for the file. + if(state.MGC) { + // do not consider package or import when compiling MGC version + cl = (cl.lastIndexOf('.')==-1)?cl:cl.substring(cl.lastIndexOf('.')+1); + } for (int i = 0; i < state.classpath.size(); i++) { String path = (String) state.classpath.get(i); File f = new File(path, cl.replace('.', '/') + ".java"); @@ -63,16 +67,26 @@ public class TypeUtil { public ClassDescriptor getClass(String classname) { - ClassDescriptor cd=(ClassDescriptor)state.getClassSymbolTable().get(classname); + String cl = classname; + if(state.MGC) { + // do not consider package or import when compiling MGC version + cl = (cl.lastIndexOf('.')==-1)?cl:cl.substring(cl.lastIndexOf('.')+1); + } + ClassDescriptor cd=(ClassDescriptor)state.getClassSymbolTable().get(cl); return cd; } public ClassDescriptor getClass(String classname, HashSet todo) { - ClassDescriptor cd=(ClassDescriptor)state.getClassSymbolTable().get(classname); + String cl = classname; + if(state.MGC) { + // do not consider package or import when compiling MGC version + cl = (cl.lastIndexOf('.')==-1)?cl:cl.substring(cl.lastIndexOf('.')+1); + } + ClassDescriptor cd=(ClassDescriptor)state.getClassSymbolTable().get(cl); if (cd==null) { //have to find class - addNewClass(classname, todo); - cd=(ClassDescriptor)state.getClassSymbolTable().get(classname); + addNewClass(cl, todo); + cd=(ClassDescriptor)state.getClassSymbolTable().get(cl); System.out.println("Build class:"+cd); todo.add(cd);