diff --git a/src/de/dhbwstuttgart/syntaxtree/SourceFile.java b/src/de/dhbwstuttgart/syntaxtree/SourceFile.java index 46ab32207..f8a820f5d 100755 --- a/src/de/dhbwstuttgart/syntaxtree/SourceFile.java +++ b/src/de/dhbwstuttgart/syntaxtree/SourceFile.java @@ -804,7 +804,14 @@ public class SourceFile //Schritt 4: Unifikation Vector>> vecunifyResult = - streamconstraintsclone.map(x -> Unify.unify(x, finiteClosure)).collect(Vector::new, Vector::add, Vector::addAll); + //streamconstraintsclone.map(x -> Unify.unify(x, finiteClosure)).collect(Vector::new, Vector::add, Vector::addAll); + //DEBUG-Variante + streamconstraintsclone.map(x -> + { Vector> z = Unify.unify(x, finiteClosure); + return z; + } + ).collect(Vector::new, Vector::add, Vector::addAll); + //card gibt die Cardinalitaet der unifizierten Mengen an Vector card = vecunifyResult.stream().map(x -> x.size()).collect(Vector::new, Vector::add, Vector::addAll); diff --git a/src/de/dhbwstuttgart/typeinference/unify/Unify.java b/src/de/dhbwstuttgart/typeinference/unify/Unify.java index 3ac543086..e6f7b563d 100755 --- a/src/de/dhbwstuttgart/typeinference/unify/Unify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/Unify.java @@ -7,6 +7,7 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; +import java.util.stream.Stream; import de.dhbwstuttgart.logger.Logger; import de.dhbwstuttgart.logger.Section; @@ -443,7 +444,25 @@ public class Unify } } } + + //aus {ty <. ty'} {? extends ty <. ty'} erzeugen //angefuegt PL 15-03-03 + Stream> extergMenge1 = + ergMenge1.stream().map(v -> + v.stream().map(pa -> + new Pair(new ExtendsWildcardType(pa.getTA1Copy().getOffset(), pa.getTA1Copy()), pa.getTA2Copy(), pa.GetOperator(), pa.bSubst) + ).collect(Vector::new, Vector::add, Vector::addAll)); + cartProduktSets.add(ergMenge1); + cartProduktSets.add(extergMenge1.collect(Vector::new, Vector::add, Vector::addAll)); + } + else if(p.OperatorSmaller() && p.TA2 instanceof GenericTypeVar) + { + //Paar unverändert lassen, wenn eine GenericTypeVar ist + Vector> setofsetofpairs = new Vector>(); + Vector vTmp = new Vector(); + vTmp.add(p); + setofsetofpairs.add(vTmp); + cartProduktSets.add(setofsetofpairs); } else if(p.OperatorSmallerExtends()) { @@ -582,6 +601,10 @@ public class Unify cartProduktSets.add(setofsetofpairs); } } + else { + //kein programmierter Fall konnte angewandt werden. PL 15-03-05 + return new Vector>(); + } } else if (p.TA2 instanceof TypePlaceholder) { @@ -725,6 +748,10 @@ public class Unify cartProduktSets.add(generateSetOfSetOfPair(p.TA2,grErg)); } } + else { + //kein programmierter Fall konnte angewandt werden. PL 15-03-05 + return new Vector>(); + } } } //Schritt 4, Teil 2: Kartesisches Produkt bilden. diff --git a/test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.jav b/test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.jav index e3c98b2b3..ed362c9d4 100644 --- a/test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.jav +++ b/test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.jav @@ -1,3 +1,3 @@ class GenericParaListInsertTest{ -methode(a){return a;} + A methode(a){return a;} } \ No newline at end of file