if (t0.getTypeArguments() == null) {
Assert.assertNull(t1.getTypeArguments());
} else {
Map<TypeParameter, ProducedType> parms1 = t1.getTypeArguments();
for (Map.Entry<TypeParameter, ProducedType> e : t0.getTypeArguments().entrySet()) {
ProducedType tparm = parms1.get(e.getKey());
Assert.assertNotNull(tparm);
final String s0ppp = e.getValue().getProducedTypeQualifiedName();
if (stack.contains(s0ppp)) {
Assert.assertEquals(s0ppp, tparm.getProducedTypeQualifiedName());
} else {
compareTypes(e.getValue(), tparm, stack);
}
}
}
//Case types
if (t0.getCaseTypes() == null) {
Assert.assertNull(t1.getCaseTypes());
} else {
Iterator<ProducedType> cases = t1.getCaseTypes().iterator();
for (ProducedType c0 : t0.getCaseTypes()) {
ProducedType c1 = cases.next();
compareTypes(c0, c1, stack);
}
}
if (t0.getDeclaration().getSelfType() == null) {
Assert.assertNull(t1.getDeclaration().getSelfType());
} else {
compareTypes(t0.getDeclaration().getSelfType(), t1.getDeclaration().getSelfType(), stack);
}
if (t0.getSupertypes() == null) {
Assert.assertNull(t1.getSupertypes());
} else {
if (t0.getSupertypes().size() != t1.getSupertypes().size()) {
System.out.println("SRC " + t0ptqn + "(" + t0.getDeclaration().getContainer().getQualifiedNameString() + ") supers " + t0.getSupertypes());
System.out.println("JS " + t1.getProducedTypeQualifiedName() + "(" + t1.getDeclaration().getContainer().getQualifiedNameString() + ") supers " + t1.getSupertypes());
}
Assert.assertEquals("supertypes differ for " + t0 + ": " + t0.getSupertypes() + " vs " + t1.getSupertypes(),
t0.getSupertypes().size(), t1.getSupertypes().size());
Iterator<ProducedType> supers = t1.getSupertypes().iterator();
for (ProducedType s0 : t0.getSupertypes()) {
ProducedType s1 = supers.next();
if (s0 == t0) {
Assert.assertTrue(s1 == t1);
} else {
final String s0ppp = s0.getProducedTypeQualifiedName();
if (stack.contains(s0ppp)) {
Assert.assertEquals(s0ppp, s1.getProducedTypeQualifiedName());
} else {
compareTypes(s0, s1, stack);
}
}
}