This commit is contained in:
Florian Steurer 2016-03-28 11:40:21 +02:00
parent 67e1c5c736
commit ac3ce7d214
2 changed files with 19 additions and 14 deletions

View File

@ -122,8 +122,13 @@ public class FiniteClosure implements IFiniteClosure {
Set<TypeParams> permResult = new HashSet<>();
permuteParams(paramCandidates, 0, permResult, new Type[paramCandidates.size()]);
for (TypeParams newParams : permResult)
result3.add(t.setTypeParams(newParams));
for (TypeParams newParams : permResult) {
Type tPrime = t.setTypeParams(newParams);
if(tPrime.equals(t))
result3.add(t);
else
result3.addAll(smaller(tPrime));
}
}

View File

@ -375,22 +375,22 @@ public class FiniteClosureTest {
/*
* Test Case 15:
*
* MyMap<K> <* HashMap<K, List<K>>
* MyMap<K> <* TreeMap<K, List<K>>
*
* smaller(NavigableSet<? extends Integer, ? extends ArrayList<? extends Integer>>) =
* { NavigableSet<? extends Integer, ? extends ArrayList<? extends Integer>>,
* NavigableSet<? extends Integer, ? extends ArrayList<Integer>>
* NavigableSet<? extends Integer, ArrayList<? extends Integer>>
* NavigableSet<? extends Integer, ArrayList<Integer>>
* TreeSet<? extends Integer, ? extends ArrayList<? extends Integer>>,
* TreeSet<? extends Integer, ? extends ArrayList<Integer>>
* TreeSet<? extends Integer, ArrayList<? extends Integer>>
* TreeSet<? extends Integer, ArrayList<Integer>> }
* smaller(NavigableSet<? extends Integer, ? extends List<? extends Integer>>) =
* { Permutationen der List,
* Permutationen der List in TreeSets,
* MyMap<Integer> und MyMap<? extends Integer>
* }
*/
Type navSet = tf.getSimpleType("NavigableSet", extInt, tf.getExtendsType(tf.getSimpleType("ArrayList", extInt)));
Type navSet = tf.getSimpleType("NavigableMap", extInt, tf.getExtendsType(tf.getSimpleType("List", extInt)));
Assert.assertEquals(8, fc.smaller(navSet).size());
actual = fc.smaller(navSet);
Assert.assertEquals(82, actual.size());
Assert.assertTrue(actual.contains(myMapExtInt));
Assert.assertTrue(actual.contains(myMapInt));
}
@Test