From: jzhou Date: Thu, 24 Nov 2011 00:44:20 +0000 (+0000) Subject: changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=753417dd8425e18f1fe1a09dcee33b1aaf8bf385;p=IRC.git changes --- diff --git a/Robust/src/ClassLibrary/MGC/gnu/ArrayDeque.java b/Robust/src/ClassLibrary/MGC/gnu/ArrayDeque.java index ae09dc92..667a4f15 100644 --- a/Robust/src/ClassLibrary/MGC/gnu/ArrayDeque.java +++ b/Robust/src/ClassLibrary/MGC/gnu/ArrayDeque.java @@ -770,8 +770,8 @@ public class ArrayDeque extends AbstractCollection public /* T*/Object[] toArray(Object/*T*/[] a) { int size = size(); if (a.length < size) - a = /*(T[])java.lang.reflect.*/Array.newInstance( - a.getClass().getComponentType(), size); + a = new Object[size]/*(T[])java.lang.reflect.Array.newInstance( + a.getClass().getComponentType(), size)*/; copyElements(a); if (a.length > size) a[size] = null; diff --git a/Robust/src/IR/Tree/SemanticCheck.java b/Robust/src/IR/Tree/SemanticCheck.java index edc4ce99..7604773c 100644 --- a/Robust/src/IR/Tree/SemanticCheck.java +++ b/Robust/src/IR/Tree/SemanticCheck.java @@ -334,7 +334,8 @@ public class SemanticCheck { public void checkMethodBody(ClassDescriptor cd, MethodDescriptor md) { ClassDescriptor superdesc=cd.getSuperDesc(); - if (superdesc!=null) { + // for inline classes, it has done this during trial check + if ((!cd.getInline() || this.trialcheck) && (superdesc!=null)) { Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol()); for(Iterator methodit=possiblematches.iterator(); methodit.hasNext(); ) { MethodDescriptor matchmd=(MethodDescriptor)methodit.next(); @@ -429,6 +430,8 @@ public class SemanticCheck { if ((d==null)|| (d instanceof FieldDescriptor)) { nametable.add(vd); + } else if((md instanceof MethodDescriptor) && (((MethodDescriptor)md).getClassDesc().getInline()) && !this.trialcheck) { + // for inline classes, the var has been checked during trial check and added into the nametable } else throw new Error(vd.getSymbol()+" in "+md+" defined a second time"); if (dn.getExpression()!=null) @@ -441,6 +444,8 @@ public class SemanticCheck { if ((d==null)|| (d instanceof FieldDescriptor)) { nametable.add(vd); + } else if((md instanceof MethodDescriptor) && (((MethodDescriptor)md).getClassDesc().getInline()) && !this.trialcheck) { + // for inline classes, the var has been checked during trial check and added into the nametable } else throw new Error(vd.getSymbol()+" defined a second time"); } @@ -911,15 +916,17 @@ public class SemanticCheck { nn.setExpression(( ExpressionNode )theFieldNode); checkExpressionNode(md,nametable,( ExpressionNode )theFieldNode,td); return; - } else if(cd.getInline() && this.trialcheck) { + } else if(cd.getInline() && (this.trialcheck)) { // for the trial check of an inline class, cache the unknown var d = cd.getSurroundingNameTable().get(varname); - if(!this.inlineClass2LiveVars.containsKey(cd)) { + if(null!=d) { + if(!this.inlineClass2LiveVars.containsKey(cd)) { this.inlineClass2LiveVars.put(cd, new Vector()); - } - Vector vars = this.inlineClass2LiveVars.get(cd); - if(!vars.contains((VarDescriptor)d)) { - vars.add((VarDescriptor)d); + } + Vector vars = this.inlineClass2LiveVars.get(cd); + if(!vars.contains((VarDescriptor)d)) { + vars.add((VarDescriptor)d); + } } } }