forked from JavaTX/JavaCompilerCore
Generics einsetzen
This commit is contained in:
parent
3274f12922
commit
1023ed8557
@ -3,6 +3,7 @@ package de.dhbwstuttgart.typedeployment;
|
|||||||
import de.dhbwstuttgart.exceptions.DebugException;
|
import de.dhbwstuttgart.exceptions.DebugException;
|
||||||
import de.dhbwstuttgart.exceptions.NotImplementedException;
|
import de.dhbwstuttgart.exceptions.NotImplementedException;
|
||||||
import de.dhbwstuttgart.syntaxtree.*;
|
import de.dhbwstuttgart.syntaxtree.*;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.factory.ASTFactory;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.*;
|
import de.dhbwstuttgart.syntaxtree.type.*;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import de.dhbwstuttgart.typeinference.constraints.Pair;
|
import de.dhbwstuttgart.typeinference.constraints.Pair;
|
||||||
@ -62,10 +63,12 @@ public class TypeInsertFactory {
|
|||||||
insertPoint = new TypeInsertPoint(offset, ((TypePlaceholder) type).getName());
|
insertPoint = new TypeInsertPoint(offset, ((TypePlaceholder) type).getName());
|
||||||
additionalInserts.add(((TypePlaceholder) type));
|
additionalInserts.add(((TypePlaceholder) type));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Alle Bounds finden:
|
//Alle Bounds finden:
|
||||||
Set<Pair> newGenerics = new HashSet<>();
|
Set<Pair> newGenerics = new HashSet<>();
|
||||||
boolean added = true;
|
boolean added = true;
|
||||||
while(added){
|
while(added){
|
||||||
|
//Fügt alle TPHs an, welche mit den additionalInserts in Verbindung stehen.
|
||||||
added = false;
|
added = false;
|
||||||
for(Pair pair : pairs){
|
for(Pair pair : pairs){
|
||||||
if (additionalInserts.contains(pair.TA1) || additionalInserts.contains(pair.TA2)) {
|
if (additionalInserts.contains(pair.TA1) || additionalInserts.contains(pair.TA2)) {
|
||||||
@ -76,6 +79,19 @@ public class TypeInsertFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Fügt noch die Additional Inserts an, welche mit nichts in Verbindung stehen:
|
||||||
|
for(TypePlaceholder additionalTPH : additionalInserts){
|
||||||
|
boolean inside = false;
|
||||||
|
for(Pair p :newGenerics){
|
||||||
|
if(p.TA2.equals(additionalTPH) || p.TA1.equals(additionalTPH)){
|
||||||
|
inside = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(! inside)newGenerics.add(new Pair(additionalTPH, additionalTPH));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
//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(Pair subtypings : newGenerics){
|
for(Pair subtypings : newGenerics){
|
||||||
@ -86,7 +102,7 @@ public class TypeInsertFactory {
|
|||||||
for(TypePlaceholder tph : additionalInserts){
|
for(TypePlaceholder tph : additionalInserts){
|
||||||
newGenerics.add(new Pair(tph, null));
|
newGenerics.add(new Pair(tph, null));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
ret.add(createGenericInsert(newGenerics, cl, m));
|
ret.add(createGenericInsert(newGenerics, cl, m));
|
||||||
|
|
||||||
//return ret;
|
//return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user