MakeBasicAssumptionsFromJRE geändert

This commit is contained in:
JanUlrich 2014-04-01 21:38:53 +02:00
parent 8e7776dc4c
commit 38f4a1351f

View File

@ -13,6 +13,9 @@ import java.util.Vector;
import mycompiler.mybytecode.ClassFile; import mycompiler.mybytecode.ClassFile;
import mycompiler.myclass.BasicAssumptionClass; import mycompiler.myclass.BasicAssumptionClass;
import mycompiler.myclass.Class; import mycompiler.myclass.Class;
import mycompiler.myclass.Constructor;
import mycompiler.myclass.Field;
import mycompiler.myclass.FieldDeclaration;
import mycompiler.myclass.ImportDeclarations; import mycompiler.myclass.ImportDeclarations;
import mycompiler.myclass.UsedId; import mycompiler.myclass.UsedId;
import mycompiler.myexception.CTypeReconstructionException; import mycompiler.myexception.CTypeReconstructionException;
@ -41,6 +44,9 @@ import mycompiler.mytypereconstruction.unify.Unify;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import mycompiler.myclass.*;
import mycompiler.*;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import sun.reflect.generics.reflectiveObjects.TypeVariableImpl; import sun.reflect.generics.reflectiveObjects.TypeVariableImpl;
import typinferenz.ConstraintsSet; import typinferenz.ConstraintsSet;
@ -1043,16 +1049,17 @@ public class SourceFile
// ino.method.makeBasicAssumptionsFromJRE.21409.definition // ino.method.makeBasicAssumptionsFromJRE.21409.definition
@Deprecated //angefügt von Andreas Stadelmeier. Grund: Die Funktion wurde neu als getBasicAssumptions angelegt @Deprecated //angefügt von Andreas Stadelmeier. Grund: Die Funktion wurde neu als getBasicAssumptions angelegt
private TypeinferenceResultSet makeBasicAssumptionsFromJRE(Vector<UsedId> imports) private TypeAssumptions makeBasicAssumptionsFromJRE(Vector<UsedId> imports)
// ino.end // ino.end
// ino.method.makeBasicAssumptionsFromJRE.21409.body // ino.method.makeBasicAssumptionsFromJRE.21409.body
{ {
return null; //return null;
/* ///*
Vector<UsedId> doneImports=new Vector<UsedId>(); Vector<UsedId> doneImports=new Vector<UsedId>();
TypeinferenceResultSet basicAssumptions = new TypeinferenceResultSet(null); //TypeinferenceResultSet basicAssumptions = new TypeinferenceResultSet(null);
TypeAssumptions basicAssumptions = new TypeAssumptions();
Modifiers mod = new Modifiers(); Modifiers mod = new Modifiers();
mod.addModifier(new Public()); mod.addModifier(new Public());
@ -1087,11 +1094,13 @@ public class SourceFile
jreSpiderRegistry.put(tvs[j].getName(),gtv); jreSpiderRegistry.put(tvs[j].getName(),gtv);
} }
BasicAssumptionClass myCl = new BasicAssumptionClass(className, mod); //BasicAssumptionClass myCl = new BasicAssumptionClass(className, mod);
Class parentClass = new Class(className, mod);
if(typeGenPara.size()>0){ if(typeGenPara.size()>0){
basicAssumptions.addGenericTypeVars(className, typeGenPara); //auskommentiert von Andreas Stadelmeier:
myCl.set_ParaList((Vector)typeGenPara); //basicAssumptions.addGenericTypeVars(className, typeGenPara);
parentClass.set_ParaList((Vector)typeGenPara);//myCl.set_ParaList((Vector)typeGenPara);
} }
@ -1125,19 +1134,20 @@ public class SourceFile
} }
ui.set_ParaList(supertypeGenPara); ui.set_ParaList(supertypeGenPara);
ui.vParaOrg=supertypeGenPara; ui.vParaOrg=supertypeGenPara;
myCl.set_UsedId(ui); parentClass.set_UsedId(ui);
} }
} }
this.addElement(myCl); //auskommentiert von Andreas Stadelmeier
//this.addElement(myCl);
basicAssumptions.addClassName(className); //basicAssumptions.addClassName(className);
for(int j=0;j<fields.length;j++){ for(int j=0;j<fields.length;j++){
if(java.lang.reflect.Modifier.isPublic(fields[j].getModifiers())){ if(java.lang.reflect.Modifier.isPublic(fields[j].getModifiers())){
//CInstVarTypeAssumption instVar = new CInstVarTypeAssumption(className, fields[j].getName(), new RefType(fields[j].getType().getSimpleName()), MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>()); //CInstVarTypeAssumption instVar = new CInstVarTypeAssumption(className, fields[j].getName(), new RefType(fields[j].getType().getSimpleName()), MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>());
CInstVarTypeAssumption instVar = new CInstVarTypeAssumption(className, fields[j].getName(), new RefType(fields[j].getType().getName(),-1), MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>()); CInstVarTypeAssumption instVar = new CInstVarTypeAssumption(className, fields[j].getName(), new RefType(fields[j].getType().getName(),-1), MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>());
basicAssumptions.addFieldOrLocalVarAssumption(instVar); //basicAssumptions.addFieldOrLocalVarAssumption(instVar);
parentClass.addField(new FieldDeclaration(0));
} }
} }
for(int j=0;j<methods.length;j++){ for(int j=0;j<methods.length;j++){
@ -1157,7 +1167,8 @@ public class SourceFile
// Fixme HOTI beachte overloaded id // Fixme HOTI beachte overloaded id
method.addParaAssumption(new CParaTypeAssumption(className, methodName, pt.length,0,type.getName(), type, MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>())); method.addParaAssumption(new CParaTypeAssumption(className, methodName, pt.length,0,type.getName(), type, MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>()));
} }
basicAssumptions.addMethodIntersectionType(new CIntersectionType(method)); //basicAssumptions.addMethodIntersectionType(new CIntersectionType(method));
parentClass.addField(mycompiler.myclass.Method.createEmptyMethod(methodName, parentClass));
} }
} }
@ -1171,7 +1182,9 @@ public class SourceFile
// Fixme HOTI beachte overloaded id // Fixme HOTI beachte overloaded id
constructor.addParaAssumption(new CParaTypeAssumption(className, methodName, constructors[j].getParameterTypes().length,0,paraType, new RefType(paraType,-1), MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>())); constructor.addParaAssumption(new CParaTypeAssumption(className, methodName, constructors[j].getParameterTypes().length,0,paraType, new RefType(paraType,-1), MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>()));
} }
basicAssumptions.addMethodIntersectionType(new CIntersectionType(constructor)); //basicAssumptions.addMethodIntersectionType(new CIntersectionType(constructor));
Method constructorMethod = mycompiler.myclass.Method.createEmptyMethod(methodName, parentClass);
parentClass.addField(new Constructor(constructorMethod));
} }
} }
@ -1182,7 +1195,7 @@ public class SourceFile
imports.addAll(doneImports); imports.addAll(doneImports);
return basicAssumptions; return basicAssumptions;
*/ //*/
} }
// ino.end // ino.end