forked from JavaTX/JavaCompilerCore
Bei der Generierung der FiniteClosure werden nun Beziehungen zu Superklassen, welche Importiert wurden, korrekt angefügt
This commit is contained in:
parent
c080f452ae
commit
144c31a4cb
@ -185,6 +185,7 @@ public class Class extends GTVDeclarationContext implements AClassOrInterface, I
|
|||||||
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);
|
||||||
if(superClass == null)this.superClass = new Class("Object",-1).getType();
|
if(superClass == null)this.superClass = new Class("Object",-1).getType();
|
||||||
|
else this.superClass = superClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ino.method.Class.23044.definition
|
// ino.method.Class.23044.definition
|
||||||
|
@ -310,15 +310,26 @@ public class SourceFile
|
|||||||
TypeAssumptions globalAssumptions = this.makeBasicAssumptionsFromJRE(imports, false);
|
TypeAssumptions globalAssumptions = this.makeBasicAssumptionsFromJRE(imports, false);
|
||||||
globalAssumptions.add(this.getPublicFieldAssumptions());
|
globalAssumptions.add(this.getPublicFieldAssumptions());
|
||||||
// 1. Menge <= in FC aufnehmen --> Iteration ueber alle Klassen
|
// 1. Menge <= in FC aufnehmen --> Iteration ueber alle Klassen
|
||||||
|
|
||||||
Vector<Class> basicAssumptionsClassVector = new Vector<>(); //die Klassen aus den BasicAssumptions
|
Vector<Type> ignoreTypes = new Vector<>(); //Enthält die Typen, welche nicht in der FC als Supertypen enthalten sein sollen.
|
||||||
|
ignoreTypes.add(new RefType("Long",null,-1).TYPE(globalAssumptions, parent).getType());
|
||||||
|
ignoreTypes.add(new RefType("Float",null,-1).TYPE(globalAssumptions, parent).getType());
|
||||||
|
ignoreTypes.add(new RefType("Double",null,-1).TYPE(globalAssumptions, parent).getType());
|
||||||
|
ignoreTypes.add(new RefType("String",null,-1).TYPE(globalAssumptions, parent).getType());
|
||||||
|
ignoreTypes.add(new RefType("Integer",null,-1).TYPE(globalAssumptions, parent).getType());
|
||||||
|
ignoreTypes.add(new RefType("Object",null,-1).TYPE(globalAssumptions, parent).getType());
|
||||||
|
|
||||||
|
Vector<Class> basicAssumptionsClassVector = new Vector<>(); //die Klassen aus den BasicAssumptions und den Importierten Klassen
|
||||||
for(ClassAssumption cAss : ass.getClassAssumptions()){
|
for(ClassAssumption cAss : ass.getClassAssumptions()){
|
||||||
Type t1 = cAss.getAssumedClass().getType();
|
Type t1 = cAss.getAssumedClass().getType();
|
||||||
Type t2 = cAss.getAssumedClass().getSuperClass();
|
Type t2 = cAss.getAssumedClass().getSuperClass();
|
||||||
Pair p = new Pair(t1, t2);
|
Pair p = new Pair(t1, t2);
|
||||||
//System.out.println("FCPair: "+p);
|
//System.out.println("FCPair: "+p);
|
||||||
if(! t1.equals(t2)){//Um FC_TTO darf kein T <. T stehen.
|
if(! t1.equals(t2)){//Um FC_TTO darf kein T <. T stehen.
|
||||||
//vFC.add(p); //Wird momentan nicht hinzugefügt
|
Type superTypeFromAssumptions = ass.getTypeFor(t2, t2).getType(); //In den Assumptions den SuperTyp nachschlagen
|
||||||
|
if(superTypeFromAssumptions != null && ! ignoreTypes.contains(superTypeFromAssumptions)){//Die Superklasse eines Typs nur anfügen, wenn er auch in den Assumptions vorkommt.
|
||||||
|
vFC.add(p);
|
||||||
|
}
|
||||||
basicAssumptionsClassVector.add(cAss.getAssumedClass());//Klasse ohne die Superklasse anfügen
|
basicAssumptionsClassVector.add(cAss.getAssumedClass());//Klasse ohne die Superklasse anfügen
|
||||||
}else{
|
}else{
|
||||||
//System.out.println("Wurde nicht aufgenommen");
|
//System.out.println("Wurde nicht aufgenommen");
|
||||||
|
@ -620,6 +620,7 @@ public class Unify
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Schritt 4, Teil 2: Kartesisches Produkt bilden.
|
//Schritt 4, Teil 2: Kartesisches Produkt bilden.
|
||||||
|
//TODO: Vor der Bildung des Karthesischen Produkts unmögliche Kombinationen ausfiltern
|
||||||
//Hier wird aus den in Schritt 4, Teil 1 erzeugten Vektoren das Kartesische Produkt gebilden.
|
//Hier wird aus den in Schritt 4, Teil 1 erzeugten Vektoren das Kartesische Produkt gebilden.
|
||||||
Vector<Pair> helpvp;
|
Vector<Pair> helpvp;
|
||||||
Vector<Vector<Pair>> bigCartProductErg = new Vector<Vector<Pair>>();
|
Vector<Vector<Pair>> bigCartProductErg = new Vector<Vector<Pair>>();
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package plugindevelopment.TypeInsertTests;
|
package plugindevelopment.TypeInsertTests;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -12,5 +14,6 @@ public class Add {
|
|||||||
Vector<String> mustContain = new Vector<String>();
|
Vector<String> mustContain = new Vector<String>();
|
||||||
//mustContain.add("TestIfStmt var");
|
//mustContain.add("TestIfStmt var");
|
||||||
MultipleTypesInsertTester.testSingleInsert(this.TEST_FILE, mustContain);
|
MultipleTypesInsertTester.testSingleInsert(this.TEST_FILE, mustContain);
|
||||||
|
ArrayList l = new ArrayList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
class LambdaTest<A>{
|
class LambdaTest<A>{
|
||||||
|
|
||||||
Fun1<Integer, Integer> op = (var) -> {return var;};
|
Fun1<? extends Integer, ? super Integer> op = (var) -> {return var;};
|
||||||
|
|
||||||
}
|
}
|
@ -13,6 +13,7 @@ public class OverloadingRecursive {
|
|||||||
Vector<String> mustContain = new Vector<String>();
|
Vector<String> mustContain = new Vector<String>();
|
||||||
|
|
||||||
//mustContain.add("Fun0<Fun1<java.lang.String, Fun2<AH, LambdaTest, java.lang.String>>> op");
|
//mustContain.add("Fun0<Fun1<java.lang.String, Fun2<AH, LambdaTest, java.lang.String>>> op");
|
||||||
MultipleTypesInsertTester.test(this.TEST_FILE, mustContain);
|
//Untypisierbar
|
||||||
|
//MultipleTypesInsertTester.test(this.TEST_FILE, mustContain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user