From 1023ed85578cff63a095fc008ebd9a5b49478a10 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Tue, 22 Aug 2017 18:31:07 +0200 Subject: [PATCH] Generics einsetzen --- .../typedeployment/TypeInsertFactory.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java b/src/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java index 7fe7b05de..846134ded 100644 --- a/src/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java +++ b/src/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java @@ -3,6 +3,7 @@ package de.dhbwstuttgart.typedeployment; import de.dhbwstuttgart.exceptions.DebugException; import de.dhbwstuttgart.exceptions.NotImplementedException; import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; import de.dhbwstuttgart.syntaxtree.type.*; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.constraints.Pair; @@ -62,10 +63,12 @@ public class TypeInsertFactory { insertPoint = new TypeInsertPoint(offset, ((TypePlaceholder) type).getName()); additionalInserts.add(((TypePlaceholder) type)); } + //Alle Bounds finden: Set newGenerics = new HashSet<>(); boolean added = true; while(added){ + //Fügt alle TPHs an, welche mit den additionalInserts in Verbindung stehen. added = false; for(Pair pair : pairs){ 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: additionalInserts.clear(); for(Pair subtypings : newGenerics){ @@ -86,7 +102,7 @@ public class TypeInsertFactory { for(TypePlaceholder tph : additionalInserts){ newGenerics.add(new Pair(tph, null)); } - + */ ret.add(createGenericInsert(newGenerics, cl, m)); //return ret;