forked from JavaTX/JavaCompilerCore
Richtiger Import von Generischen Typen aus der JRE
This commit is contained in:
parent
3db9b069c7
commit
81416b8bf4
@ -162,6 +162,26 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt eine Klasse, welche nur für die Assumptions verwendet wird.
|
||||||
|
* Sie enthält keine unnötigen Informationen, wie Offset oder ClassBody.
|
||||||
|
* @param name
|
||||||
|
* @param superClass
|
||||||
|
* @param modifiers
|
||||||
|
* @param supertypeGenPara - Eine Liste von Namen, welche die Generischen Parameter der Klasse darstellen.
|
||||||
|
*/
|
||||||
|
public Class(String name, RefType superClass, Modifiers modifiers,
|
||||||
|
Vector<String> supertypeGenPara) {
|
||||||
|
this(name,superClass,modifiers,0);
|
||||||
|
if(supertypeGenPara == null)return;
|
||||||
|
Vector<GenericTypeVar> gtvs = new Vector<>();
|
||||||
|
for(String gname : supertypeGenPara){
|
||||||
|
GenericTypeVar newGTV=new GenericTypeVar(gname,this,0);
|
||||||
|
gtvs.add(newGTV);
|
||||||
|
}
|
||||||
|
this.genericClassParameters = new GenericDeclarationList(gtvs,0);
|
||||||
|
}
|
||||||
|
|
||||||
public Class(String name, RefType superClass, Modifiers mod, int offset){
|
public Class(String name, RefType superClass, Modifiers mod, int offset){
|
||||||
this(name,mod,offset);
|
this(name,mod,offset);
|
||||||
this.superClass = superClass;
|
this.superClass = superClass;
|
||||||
@ -244,6 +264,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
|
||||||
public Vector<Field> getFields()
|
public Vector<Field> getFields()
|
||||||
{
|
{
|
||||||
return fielddecl;
|
return fielddecl;
|
||||||
|
@ -1267,8 +1267,16 @@ public class SourceFile
|
|||||||
if(s == null){
|
if(s == null){
|
||||||
return new Class("java.lang.Object",new Modifiers(), 0);
|
return new Class("java.lang.Object",new Modifiers(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector<String> supertypeGenPara = new Vector<>();//Die Generischen Parameter für die Superklasse berechnen:
|
||||||
|
java.lang.reflect.TypeVariable[] superclassTVS=s.getTypeParameters();
|
||||||
|
for(int tvi=0;tvi<superclassTVS.length;tvi++){
|
||||||
|
supertypeGenPara.addElement(superclassTVS[tvi].getName());
|
||||||
|
}
|
||||||
|
|
||||||
Class ss = this.getSuperClassOfJREClass(s, ass);
|
Class ss = this.getSuperClassOfJREClass(s, ass);
|
||||||
ret = new Class(s.getName(),ss.getType(),new Modifiers(),0);
|
ret = new Class(s.getName(),ss.getType(),new Modifiers(),supertypeGenPara);
|
||||||
|
|
||||||
|
|
||||||
ass.addClassAssumption(new ClassAssumption(ss)); //Die beiden SuperKlassen den Assumptions anfügen...
|
ass.addClassAssumption(new ClassAssumption(ss)); //Die beiden SuperKlassen den Assumptions anfügen...
|
||||||
ass.addClassAssumption(new ClassAssumption(ret));
|
ass.addClassAssumption(new ClassAssumption(ret));
|
||||||
@ -1311,6 +1319,9 @@ public class SourceFile
|
|||||||
return(new GenericTypeVar(jreSpiderRegistry.get(tvi.getName()).getName().toString(),parentClass,-1));
|
return(new GenericTypeVar(jreSpiderRegistry.get(tvi.getName()).getName().toString(),parentClass,-1));
|
||||||
}else{
|
}else{
|
||||||
*/
|
*/
|
||||||
|
GenericTypeVar gtv = jreSpiderRegistry.get(type.getTypeName());
|
||||||
|
if(gtv != null)return gtv;
|
||||||
|
//new GenericTypeVar(jreSpiderRegistry.get(type.getTypeName()).getName().toString(),parentClass,-1));
|
||||||
//String jccNameForClass=baseTypeTranslationTable.get(cl.getSimpleName());
|
//String jccNameForClass=baseTypeTranslationTable.get(cl.getSimpleName());
|
||||||
String jccNameForClass=baseTypeTranslationTable.get(cl.getName());
|
String jccNameForClass=baseTypeTranslationTable.get(cl.getName());
|
||||||
if(cl.getSimpleName().equalsIgnoreCase("void")){
|
if(cl.getSimpleName().equalsIgnoreCase("void")){
|
||||||
|
@ -37,7 +37,6 @@ import de.dhbwstuttgart.typeinference.SingleConstraint;
|
|||||||
import de.dhbwstuttgart.typeinference.UndConstraint;
|
import de.dhbwstuttgart.typeinference.UndConstraint;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
|||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
|
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
|
||||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||||
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,8 +26,6 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
|||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ package de.dhbwstuttgart.syntaxtree.statement;
|
|||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||||
import de.dhbwstuttgart.bytecode.CodeAttribute;
|
import de.dhbwstuttgart.bytecode.CodeAttribute;
|
||||||
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
|
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
|
||||||
@ -19,8 +19,8 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
|||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
|
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
|
||||||
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,9 +27,8 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
|||||||
import de.dhbwstuttgart.typeinference.Pair;
|
import de.dhbwstuttgart.typeinference.Pair;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
|
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
|
||||||
import de.dhbwstuttgart.typeinference.unify.Unify;
|
import de.dhbwstuttgart.typeinference.unify.Unify;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ import de.dhbwstuttgart.typeinference.Pair;
|
|||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
|
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
|
||||||
import de.dhbwstuttgart.typeinference.unify.MUB;
|
import de.dhbwstuttgart.typeinference.unify.MUB;
|
||||||
import de.dhbwstuttgart.typeinference.unify.Unify;
|
import de.dhbwstuttgart.typeinference.unify.Unify;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
|||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ import de.dhbwstuttgart.typeinference.SingleConstraint;
|
|||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||||
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,8 +25,6 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
|||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ import de.dhbwstuttgart.typeinference.ResultSet;
|
|||||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import de.dhbwstuttgart.typeinference.Pair;
|
|||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.Typeable;
|
import de.dhbwstuttgart.typeinference.Typeable;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,9 +31,9 @@ import de.dhbwstuttgart.typeinference.Pair;
|
|||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
|
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
|
||||||
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet;
|
||||||
import de.dhbwstuttgart.typeinference.unify.Unify;
|
import de.dhbwstuttgart.typeinference.unify.Unify;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package de.dhbwstuttgart.typeinference.exceptions;
|
||||||
|
|
||||||
|
public class NotImplementedException extends RuntimeException {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user