forked from JavaTX/JavaCompilerCore
makeBasicAssumptions verbessert. Nimmt auch nun die Superklassen der BasicAssumptions auf
This commit is contained in:
parent
37923779b1
commit
3db9b069c7
@ -311,9 +311,14 @@ public class SourceFile
|
|||||||
|
|
||||||
for(ClassAssumption cAss : ass.getClassAssumptions()){
|
for(ClassAssumption cAss : ass.getClassAssumptions()){
|
||||||
Type t1 = cAss.getAssumedClass().getType();
|
Type t1 = cAss.getAssumedClass().getType();
|
||||||
Type t2 = cAss.getAssumedClass().getType();
|
Type t2 = cAss.getAssumedClass().getSuperClass();
|
||||||
Pair p = new Pair(t1, t2);
|
Pair p = new Pair(t1, t2);
|
||||||
if(! t1.equals(t2))vFC.add(p); //Um FC_TTO darf kein T <. T stehen.
|
System.out.println("FCPair: "+p);
|
||||||
|
if(! t1.equals(t2)){
|
||||||
|
vFC.add(p); //Um FC_TTO darf kein T <. T stehen.
|
||||||
|
}else{
|
||||||
|
System.out.println("Wurde nicht aufgenommen");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i = 0; i < KlassenVektor.size(); i++ )
|
for( int i = 0; i < KlassenVektor.size(); i++ )
|
||||||
@ -668,7 +673,7 @@ public class SourceFile
|
|||||||
//FiniteClosure generieren:
|
//FiniteClosure generieren:
|
||||||
FC_TTO finiteClosure = this.makeFC(globalAssumptions);
|
FC_TTO finiteClosure = this.makeFC(globalAssumptions);
|
||||||
|
|
||||||
System.out.println("FiniteClosure: \n"+finiteClosure);
|
typinferenzLog.debug("FiniteClosure: \n"+finiteClosure);
|
||||||
|
|
||||||
ConstraintsSet oderConstraints = new ConstraintsSet();
|
ConstraintsSet oderConstraints = new ConstraintsSet();
|
||||||
//Alle Constraints der in dieser SourceFile enthaltenen Klassen sammeln:
|
//Alle Constraints der in dieser SourceFile enthaltenen Klassen sammeln:
|
||||||
@ -682,6 +687,7 @@ public class SourceFile
|
|||||||
|
|
||||||
//Unmögliche ConstraintsSets aussortieren durch Unifizierung
|
//Unmögliche ConstraintsSets aussortieren durch Unifizierung
|
||||||
oderConstraints.filterWrongConstraints((pairs)->{return Unify.unify(pairs,finiteClosure);});
|
oderConstraints.filterWrongConstraints((pairs)->{return Unify.unify(pairs,finiteClosure);});
|
||||||
|
typinferenzLog.debug("Übriggebliebene Konstraints:\n"+oderConstraints+"\n");
|
||||||
//Die Constraints in Pair's umwandeln (Karthesisches Produkt bilden):
|
//Die Constraints in Pair's umwandeln (Karthesisches Produkt bilden):
|
||||||
Vector<Vector<Pair>> xConstraints = new Vector<Vector<Pair>>();// = oderConstraints.getConstraints();
|
Vector<Vector<Pair>> xConstraints = new Vector<Vector<Pair>>();// = oderConstraints.getConstraints();
|
||||||
for(Vector<UndConstraint> uC:oderConstraints.getConstraints()){ //mit dem getConstraints-Aufruf wird das Karthesische Produkt erzeugt.
|
for(Vector<UndConstraint> uC:oderConstraints.getConstraints()){ //mit dem getConstraints-Aufruf wird das Karthesische Produkt erzeugt.
|
||||||
@ -1258,9 +1264,15 @@ public class SourceFile
|
|||||||
private Class getSuperClassOfJREClass(java.lang.Class<?> x, TypeAssumptions ass) {
|
private Class getSuperClassOfJREClass(java.lang.Class<?> x, TypeAssumptions ass) {
|
||||||
Class ret;
|
Class ret;
|
||||||
java.lang.Class s = x.getSuperclass();
|
java.lang.Class s = x.getSuperclass();
|
||||||
if(s == null)return new Class("java.lang.Object",new Modifiers(), 0);
|
if(s == null){
|
||||||
|
return new Class("java.lang.Object",new Modifiers(), 0);
|
||||||
|
}
|
||||||
Class ss = this.getSuperClassOfJREClass(s, ass);
|
Class ss = this.getSuperClassOfJREClass(s, ass);
|
||||||
ret = new Class(x.getName(),ss.getType(),new Modifiers(),0);
|
ret = new Class(s.getName(),ss.getType(),new Modifiers(),0);
|
||||||
|
|
||||||
|
ass.addClassAssumption(new ClassAssumption(ss)); //Die beiden SuperKlassen den Assumptions anfügen...
|
||||||
|
ass.addClassAssumption(new ClassAssumption(ret));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user