Support für eindimensionale Arrays von RefTypes angefügt

This commit is contained in:
JanUlrich 2015-10-22 16:46:06 +02:00
parent 88b1c3e57c
commit 66b37482db
2 changed files with 10 additions and 3 deletions

View File

@ -602,12 +602,13 @@ public class RefType extends ObjectType implements IMatchable
}
RefType newRefType=new RefType(this.getTypeName(), clonepara,this.getParent(),getOffset());
newRefType.setPrimitiveFlag(this.getPrimitiveFlag());
newRefType.IsArray = this.IsArray;
return newRefType;
}
else {
RefType newRefType = new RefType(this.getTypeName(), null,getOffset());
newRefType.setPrimitiveFlag(this.getPrimitiveFlag());
newRefType.IsArray = this.IsArray;
return newRefType;
}
}
@ -814,7 +815,13 @@ public class RefType extends ObjectType implements IMatchable
}
public org.apache.commons.bcel6.generic.Type getBytecodeType(ClassGenerator cg) {
return new org.apache.commons.bcel6.generic.ObjectType(this.getTypeName());
org.apache.commons.bcel6.generic.ObjectType ret = new org.apache.commons.bcel6.generic.ObjectType(this.getTypeName());
if(this.IsArray()){
//Hier wird einfachhalber von einer Dimension ausgegangen. Arrays sind im Bytecode nur für main-Methode relevant
return new org.apache.commons.bcel6.generic.ArrayType(ret, 1);
}else{
return ret;
}
}
@Override

View File

@ -305,7 +305,7 @@ public class TypeAssumptions {
if(match && t instanceof RefType){
RefType tr = (RefType)t;
RefType ret = ass.getAssumedClass().getType(); //Dadurch erhält der RefType den vollen Namen (bsp. java.lang.Integer)
ret.setArray(((RefType) t).IsArray());
//Falls der RefType mit Parametern angegeben wurde, so ¼ssen diese erhalten bleiben:
if(tr.get_ParaList()!=null && tr.getParaList().size()>0){
ret.set_ParaList(tr.getParaList());