From: jzhou Date: Thu, 3 Mar 2011 02:07:49 +0000 (+0000) Subject: Fix bugs for interfaces and a bug in the Class library X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9ebc4ef8bf5263bfdde21269375e79d9e083a04d;p=IRC.git Fix bugs for interfaces and a bug in the Class library --- diff --git a/Robust/src/ClassLibrary/MGC/gnu/Calendar.java b/Robust/src/ClassLibrary/MGC/gnu/Calendar.java index 46d17b59..99160d0f 100644 --- a/Robust/src/ClassLibrary/MGC/gnu/Calendar.java +++ b/Robust/src/ClassLibrary/MGC/gnu/Calendar.java @@ -545,7 +545,6 @@ public /*abstract*/ class Calendar { minimalDaysInFirstWeek = 1; } - firstDayOfWeek = 1; if (first != null) for (int i = 0; i < 8; i++) diff --git a/Robust/src/ClassLibrary/MGC/gnu/TimeZone.java b/Robust/src/ClassLibrary/MGC/gnu/TimeZone.java index 78a3a32a..55b0942f 100644 --- a/Robust/src/ClassLibrary/MGC/gnu/TimeZone.java +++ b/Robust/src/ClassLibrary/MGC/gnu/TimeZone.java @@ -1772,6 +1772,7 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable //return super.clone(); TimeZone tz = new TimeZone(); tz.ID = this.ID; + return tz; } catch (/*CloneNotSupported*/Exception ex) { diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 9e99824d..d48c0f49 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -1155,7 +1155,7 @@ public class BuildCode { allit=cn.getFieldTable().getAllDescriptorsIterator(); while(allit.hasNext()) { FieldDescriptor fd=(FieldDescriptor)allit.next(); - if(fd.isStatic() || fd.isVolatile()) { + if(fd.isStatic() /*|| fd.isVolatile()*/) { continue; } TypeDescriptor type=fd.getType(); @@ -2176,7 +2176,7 @@ public class BuildCode { public void generateFlatOffsetNode(FlatMethod fm, FlatOffsetNode fofn, PrintWriter output) { output.println("/* FlatOffsetNode */"); FieldDescriptor fd=fofn.getField(); - if(!fd.isStatic() && !fd.isVolatile()) { + if(!fd.isStatic() /*&& !fd.isVolatile()*/) { output.println(generateTemp(fm, fofn.getDst())+ " = (short)(int) (&((struct "+fofn.getClassType().getSafeSymbol() +" *)0)->"+ fd.getSafeSymbol()+");"); } @@ -2442,7 +2442,7 @@ public class BuildCode { } protected void generateFlatFieldNode(FlatMethod fm, FlatFieldNode ffn, PrintWriter output) { - if(ffn.getField().isStatic() || ffn.getField().isVolatile()) { + if(ffn.getField().isStatic()/* || ffn.getField().isVolatile()*/) { // static field if((fm.getMethod().isStaticBlock()) || (fm.getMethod().isInvokedByStatic()/* && mgcstaticinit*/)) { // is a static block or is invoked in some static block @@ -2467,7 +2467,7 @@ public class BuildCode { } } // redirect to the global_defs_p structure - if((ffn.getField().isStatic()) || (ffn.getField().isVolatile()) || (ffn.getSrc().getType().isClassNameRef())) { + if((ffn.getField().isStatic()) || (ffn.getSrc().getType().isClassNameRef())) { // reference to the static field with Class name if (ffn.getField().getType().isPtr()) output.println(generateTemp(fm, ffn.getDst())+"=global_defs_p->"+ffn.getField().getSafeSymbol()+";"); @@ -2526,7 +2526,7 @@ public class BuildCode { } } // redirect to the global_defs_p structure - if((fsfn.getDst().getType().isClassNameRef()) || (fsfn.getField().isStatic()) || (fsfn.getField().isVolatile())) { + if((fsfn.getDst().getType().isClassNameRef()) || (fsfn.getField().isStatic()) /*|| (fsfn.getField().isVolatile())*/) { // reference to the static field with Class name if (fsfn.getField().getType().isPtr()) output.println("global_defs_p->" + diff --git a/Robust/src/IR/TypeUtil.java b/Robust/src/IR/TypeUtil.java index c55768f0..a704929c 100644 --- a/Robust/src/IR/TypeUtil.java +++ b/Robust/src/IR/TypeUtil.java @@ -205,16 +205,17 @@ NextMethod: public void createFullTable() { subclasstable=new Hashtable(); - //subIFclasstable = new Hashtable(); HashSet tovisit=new HashSet(); HashSet visited=new HashSet(); Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); while(classit.hasNext()) { + tovisit.clear(); + visited.clear(); ClassDescriptor cd=(ClassDescriptor)classit.next(); ClassDescriptor tmp=cd.getSuperDesc(); - // check tmp's interface ancestors + // check cd's interface ancestors { Iterator it_sifs = cd.getSuperInterfaces(); while(it_sifs.hasNext()) { @@ -250,7 +251,7 @@ NextMethod: if(!this.subclasstable.containsKey(sif)) { this.subclasstable.put(sif, new HashSet()); } - HashSet hs = (HashSet)this.subclasstable/*subIFclasstable*/.get(sif); + HashSet hs = (HashSet)this.subclasstable.get(sif); hs.add(cd); Iterator it_sifs = sif.getSuperInterfaces(); diff --git a/Robust/src/Tests/InterfaceTest.java b/Robust/src/Tests/InterfaceTest.java index d1a93f55..89237990 100644 --- a/Robust/src/Tests/InterfaceTest.java +++ b/Robust/src/Tests/InterfaceTest.java @@ -1,6 +1,6 @@ public interface Instrument { // Compile-time constant: - int VALUE;// = 5; // static & final + int VALUE = 5; // static & final // Cannot have method definitions: void play(int n); // Automatically public void adjust(); @@ -75,7 +75,6 @@ public class InterfaceTest { } public static void main(String[] args) { // Upcasting during addition to the array: - Instrument.VALUE=5; Instrument[] orchestra = new Instrument[5]; orchestra[0] = new Wind(); orchestra[1] = new Percussion(); diff --git a/Robust/src/Tests/StaticInnerClassTest.java b/Robust/src/Tests/StaticInnerClassTest.java index a7c555b0..042d5f2a 100644 --- a/Robust/src/Tests/StaticInnerClassTest.java +++ b/Robust/src/Tests/StaticInnerClassTest.java @@ -1,4 +1,4 @@ -class Contents { +interface Contents { int value(); }