forked from JavaTX/JavaCompilerCore
Fehler beim Ausrechnen zusammenhängender Constraints beheben
This commit is contained in:
parent
cf6d9880e3
commit
c272688b2d
@ -73,40 +73,31 @@ public class TypeInsertFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Alle Bounds finden:
|
//Alle Bounds finden:
|
||||||
Map<TypePlaceholder, TypePlaceholder> newGenerics = new HashMap<>();
|
Set<Pair> newGenerics = new HashSet<>();
|
||||||
Set<TypePlaceholder> additionalBoundInserts = new HashSet<>();
|
|
||||||
boolean added = true;
|
boolean added = true;
|
||||||
while(added){
|
while(added){
|
||||||
added = false;
|
added = false;
|
||||||
additionalInserts.addAll(additionalBoundInserts);
|
for(Pair pair : pairs){
|
||||||
for(TypePlaceholder tph : additionalInserts){
|
if (additionalInserts.contains(pair.TA1) || additionalInserts.contains(pair.TA2)) {
|
||||||
boolean foundPair = false;
|
newGenerics.add(pair);
|
||||||
for(Pair pair : pairs){
|
added |= additionalInserts.add((TypePlaceholder) pair.TA1);
|
||||||
if (pair.TA1.equals(tph) || pair.TA2.equals(tph)) {
|
added |= additionalInserts.add((TypePlaceholder) pair.TA2);
|
||||||
newGenerics.put((TypePlaceholder) pair.TA1, (TypePlaceholder) pair.TA2);
|
|
||||||
foundPair = true;
|
|
||||||
added |= additionalBoundInserts.add((TypePlaceholder) pair.TA1);
|
|
||||||
added |= additionalBoundInserts.add((TypePlaceholder) pair.TA2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(foundPair == false){
|
|
||||||
newGenerics.put(tph, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Alle TPHs die man noch als Generics anfügen muss einsetzen:
|
//Alle TPHs die man noch als Generics anfügen muss einsetzen:
|
||||||
additionalInserts.clear();
|
additionalInserts.clear();
|
||||||
for(TypePlaceholder tph : newGenerics.values()){
|
for(Pair subtypings : newGenerics){
|
||||||
if(! newGenerics.containsKey(tph)){
|
if(additionalInserts.contains(subtypings.TA1)){
|
||||||
additionalInserts.add(tph);
|
additionalInserts.remove(subtypings.TA1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(TypePlaceholder tph : additionalInserts){
|
for(TypePlaceholder tph : additionalInserts){
|
||||||
newGenerics.put(tph, null);
|
newGenerics.add(new Pair(tph, null));
|
||||||
}
|
}
|
||||||
for(TypePlaceholder tph : newGenerics.keySet()){
|
for(Pair subtyping : newGenerics){
|
||||||
ret.add(createGenericInsert(tph, newGenerics.get(tph), cl, m));
|
ret.add(createGenericInsert((TypePlaceholder)subtyping.TA1, (TypePlaceholder)subtyping.TA2, cl, m));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user