Program: 176486
Project: 176486
Buggy source:
private static boolean deepEquals(Object a,Object b,Set visited){
  LinkedList<DualKey> stack=new LinkedList<DualKey>();
  stack.addFirst(new DualKey(a,b));
  while (!stack.isEmpty()) {
    DualKey dualKey=stack.removeFirst();
    visited.add(dualKey);
    if (dualKey._key1 == null || dualKey._key2 == null) {
      if (dualKey._key1 != dualKey._key2) {
        return false;
      }
      continue;
    }
    if (!dualKey._key1.getClass().equals(dualKey._key2.getClass())) {
      return false;
    }
    if (dualKey._key1.getClass().isArray()) {
      int len=Array.getLength(dualKey._key1);
      if (len != Array.getLength(dualKey._key2)) {
        return false;
      }
      for (int i=0; i < len; i++) {
        DualKey dk=new DualKey(Array.get(dualKey._key1,i),Array.get(dualKey._key2,i));
        if (!visited.contains(dk)) {
          stack.addFirst(dk);
        }
      }
      continue;
    }
    if (dualKey._key1 instanceof SortedSet) {
      if (!compareOrdered(dualKey,stack,visited)) {
        return false;
      }
      continue;
    }
    if (dualKey._key1 instanceof Set) {
      if (!compareUnordered((Set)dualKey._key1,(Set)dualKey._key2,visited)) {
        return false;
      }
      continue;
    }
    if (dualKey._key1 instanceof Collection) {
      if (!compareOrdered(dualKey,stack,visited)) {
        return false;
      }
      continue;
    }
    if (dualKey._key1 instanceof SortedMap) {
      Map map1=(Map)dualKey._key1;
      Map map2=(Map)dualKey._key2;
      if (map1.size() != map2.size()) {
        return false;
      }
      Iterator i1=map1.entrySet().iterator();
      Iterator i2=map2.entrySet().iterator();
      while (i1.hasNext()) {
        Map.Entry entry1=(Map.Entry)i1.next();
        Map.Entry entry2=(Map.Entry)i2.next();
        DualKey dk=new DualKey(entry1.getKey(),entry2.getKey());
        if (!visited.contains(dk)) {
          stack.addFirst(dk);
        }
        dk=new DualKey(entry1.getValue(),entry2.getValue());
        if (!visited.contains(dk)) {
          stack.addFirst(dk);
        }
      }
      continue;
    }
    if (dualKey._key1 instanceof Map) {
      Map<Object,Object> map1=(Map)dualKey._key1;
      Map<Object,Object> map2=(Map)dualKey._key2;
      if (map1.size() != map2.size()) {
        return false;
      }
      for (      Map.Entry entry1 : map1.entrySet()) {
        Map.Entry saveEntry2=null;
        for (        Map.Entry entry2 : map2.entrySet()) {
          if (deepEquals(entry1.getKey(),entry2.getKey(),visited)) {
            saveEntry2=entry2;
            break;
          }
        }
        if (saveEntry2 == null) {
          return false;
        }
        DualKey dk=new DualKey(entry1.getValue(),saveEntry2.getValue());
        if (!(visited instanceof ProxyCollection) && !visited.contains(dk)) {
          stack.addFirst(dk);
        }
      }
      continue;
    }
    if (hasCustomEquals(dualKey._key1.getClass())) {
      if (!dualKey._key1.equals(dualKey._key2)) {
        return false;
      }
      continue;
    }
    Collection<Field> fields=getDeepDeclaredFields(dualKey._key1.getClass());
    for (    Field field : fields) {
      try {
        DualKey dk=new DualKey(field.get(dualKey._key1),field.get(dualKey._key2));
        if (dk != null) {
          boolean isPersistentCollection=false;
          if (dk._key1 != null) {
            isPersistentCollection=ProxyHelper.isProxyCollection(dk._key1);
          }
          if (isPersistentCollection) {
            dk._key1=null;
          }
          if (dk._key1 != null && !visited.contains(dk)) {
            stack.addFirst(dk);
          }
        }
      }
 catch (      Exception e) {
        continue;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private static boolean deepEquals(Object a,Object b,Set visited){
  LinkedList<DualKey> stack=new LinkedList<DualKey>();
  stack.addFirst(new DualKey(a,b));
  while (!stack.isEmpty()) {
    DualKey dualKey=stack.removeFirst();
    visited.add(dualKey);
    if (dualKey._key1 == null || dualKey._key2 == null) {
      if (dualKey._key1 != dualKey._key2) {
        return false;
      }
      continue;
    }
    if (!dualKey._key1.getClass().equals(dualKey._key2.getClass())) {
      return false;
    }
    if (dualKey._key1.getClass().isArray()) {
      int len=Array.getLength(dualKey._key1);
      if (len != Array.getLength(dualKey._key2)) {
        return false;
      }
      for (int i=0; i < len; i++) {
        DualKey dk=new DualKey(Array.get(dualKey._key1,i),Array.get(dualKey._key2,i));
        if (!visited.contains(dk)) {
          stack.addFirst(dk);
        }
      }
      continue;
    }
    if (dualKey._key1 instanceof SortedSet) {
      if (!compareOrdered(dualKey,stack,visited)) {
        return false;
      }
      continue;
    }
    if (dualKey._key1 instanceof Set) {
      if (!compareUnordered((Set)dualKey._key1,(Set)dualKey._key2,visited)) {
        return false;
      }
      continue;
    }
    if (dualKey._key1 instanceof Collection) {
      if (!compareOrdered(dualKey,stack,visited)) {
        return false;
      }
      continue;
    }
    if (dualKey._key1 instanceof SortedMap) {
      Map map1=(Map)dualKey._key1;
      Map map2=(Map)dualKey._key2;
      if (map1.size() != map2.size()) {
        return false;
      }
      Iterator i1=map1.entrySet().iterator();
      Iterator i2=map2.entrySet().iterator();
      while (i1.hasNext()) {
        Map.Entry entry1=(Map.Entry)i1.next();
        Map.Entry entry2=(Map.Entry)i2.next();
        DualKey dk=new DualKey(entry1.getKey(),entry2.getKey());
        if (!visited.contains(dk)) {
          stack.addFirst(dk);
        }
        dk=new DualKey(entry1.getValue(),entry2.getValue());
        if (!visited.contains(dk)) {
          stack.addFirst(dk);
        }
      }
      continue;
    }
    if (dualKey._key1 instanceof Map) {
      Map<Object,Object> map1=(Map)dualKey._key1;
      Map<Object,Object> map2=(Map)dualKey._key2;
      if (map1.size() != map2.size()) {
        return false;
      }
      for (      Map.Entry entry1 : map1.entrySet()) {
        Map.Entry saveEntry2=null;
        for (        Map.Entry entry2 : map2.entrySet()) {
          if (deepEquals(entry1.getKey(),entry2.getKey(),visited)) {
            saveEntry2=entry2;
            break;
          }
        }
        if (saveEntry2 == null) {
          return false;
        }
        DualKey dk=new DualKey(entry1.getValue(),saveEntry2.getValue());
        if (!(visited instanceof ProxyCollection) && !visited.contains(dk)) {
          stack.addFirst(dk);
        }
      }
      continue;
    }
    if (hasCustomEquals(dualKey._key1.getClass())) {
      if (!dualKey._key1.equals(dualKey._key2)) {
        return false;
      }
      continue;
    }
    Collection<Field> fields=getDeepDeclaredFields(dualKey._key1.getClass());
    for (    Field field : fields) {
      try {
        DualKey dk=new DualKey(field.get(dualKey._key1),field.get(dualKey._key2));
        if (dk != null) {
          boolean isPersistentCollection=false;
          if (dk._key1 != null) {
            isPersistentCollection=ProxyHelper.isProxyCollection(dk._key1);
          }
          if (isPersistentCollection) {
            dk._key1=null;
          }
          if (!isPersistentCollection && !visited.contains(dk)) {
            stack.addFirst(dk);
          }
        }
      }
 catch (      Exception e) {
        continue;
      }
    }
  }
  return true;
}