@Override public Boolean visit(final ReferenceType n1, final Node arg) { final ReferenceType n2 = (ReferenceType) arg; if (n1.getArrayCount() != n2.getArrayCount()) { return Boolean.FALSE; } if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } List<List<AnnotationExpr>> n1a = n1.getArraysAnnotations(); List<List<AnnotationExpr>> n2a = n2.getArraysAnnotations(); if (n1a != null && n2a != null) { if (n1a.size() != n2a.size()) { return Boolean.FALSE; } else { int i = 0; for (List<AnnotationExpr> aux : n1a) { if (!nodesEquals(aux, n2a.get(i))) { return Boolean.FALSE; } i++; } } } else if (n1a != n2a) { return Boolean.FALSE; } return Boolean.TRUE; }
@Override public Boolean visit(final UnionType n1, final Node arg) { final UnionType n2 = (UnionType) arg; List<ReferenceType> n1Elements = n1.getElements(); List<ReferenceType> n2Elements = n2.getElements(); if (n1Elements != null && n2Elements != null) { if (n1Elements.size() != n2Elements.size()) { return Boolean.FALSE; } else { int i = 0; for (ReferenceType aux : n1Elements) { if (aux.accept(this, n2Elements.get(i))) { return Boolean.FALSE; } i++; } } } else if (n1Elements != n2Elements) { return Boolean.FALSE; } return Boolean.TRUE; }