Program: 5820
Project: 5820
Buggy source:
private boolean isSameExt(Object val1,Object val2){
  if (val1 == null && isEmpty(val2))   return true;
 else   if (val2 == null && isEmpty(val1))   return true;
 else   if (ObjectUtil.isSimple(val1) && ObjectUtil.isSimple(val2))   return val1.equals(val2);
 else   if (val1 instanceof byte[] && val2 instanceof byte[])   return Arrays.equals((byte[])val1,(byte[])val2);
 else   if ((val1 instanceof Value && val2 instanceof Value) || (val1 instanceof Enum && val2 instanceof Enum))   return val1.equals(val2);
 else   if (val1 != null && val1.getClass().isArray() && val2 != null && val2.getClass().isArray()) {
    if (Array.getLength(val1) != Array.getLength(val2))     return false;
    for (int idx=0; idx < Array.getLength(val1); idx++) {
      if (!isSameExt(Array.get(val1,idx),Array.get(val2,idx)))       return false;
    }
    return true;
  }
 else   if (val1 instanceof Set<?> && val2 instanceof Set<?>) {
    if ((val1 instanceof LazyableCollection && !((LazyableCollection)val1).isInitialized()) || (val2 instanceof LazyableCollection && !((LazyableCollection)val2).isInitialized()))     return false;
    Collection<?> coll1=(Collection<?>)val1;
    Collection<?> coll2=(Collection<?>)val2;
    if (coll1.size() != coll2.size())     return false;
    for (    Object e : coll1) {
      boolean found=false;
      for (      Object f : coll2) {
        if (isSameExt(e,f)) {
          found=true;
          break;
        }
      }
      if (!found)       return false;
    }
    for (    Object e : coll2) {
      boolean found=false;
      for (      Object f : coll1) {
        if (isSameExt(e,f)) {
          found=true;
          break;
        }
      }
      if (!found)       return false;
    }
    return true;
  }
 else   if (val1 instanceof List<?> && val2 instanceof List<?>) {
    if ((val1 instanceof LazyableCollection && !((LazyableCollection)val1).isInitialized()) || (val2 instanceof LazyableCollection && !((LazyableCollection)val2).isInitialized()))     return false;
    List<?> list1=(List<?>)val1;
    List<?> list2=(List<?>)val2;
    if (list1.size() != list2.size())     return false;
    for (int idx=0; idx < list1.size(); idx++) {
      if (!isSameExt(list1.get(idx),list2.get(idx)))       return false;
    }
    return true;
  }
 else   if (val1 instanceof Map<?,?> && val2 instanceof Map<?,?>) {
    if ((val1 instanceof LazyableCollection && !((LazyableCollection)val1).isInitialized()) || (val2 instanceof LazyableCollection && !((LazyableCollection)val2).isInitialized()))     return false;
    Map<?,?> map1=(Map<?,?>)val1;
    Map<?,?> map2=(Map<?,?>)val2;
    if (map1.size() != map2.size())     return false;
    for (    Object e : map1.keySet()) {
      Object key=null;
      for (      Object f : map2.keySet()) {
        if (isSameExt(e,f)) {
          key=f;
          break;
        }
      }
      if (key == null)       return false;
      if (!isSameExt(map1.get(e),map2.get(key)))       return false;
    }
    for (    Object f : map2.keySet()) {
      Object key=null;
      for (      Object e : map1.keySet()) {
        if (isSameExt(e,f)) {
          key=e;
          break;
        }
      }
      if (key == null)       return false;
      if (!isSameExt(map1.get(key),map2.get(f)))       return false;
    }
    return true;
  }
  Object n=val1 instanceof Wrapper ? ((Wrapper)val1).getWrappedObject() : val1;
  Object o=val2 instanceof Wrapper ? ((Wrapper)val2).getWrappedObject() : val2;
  if (isEntity(n) && isEntity(o))   return dataManager.getUid(n).equals(dataManager.getUid(o));
  return n == o;
}

Fixed version (ground truth):
private boolean isSameExt(Object val1,Object val2){
  if (val1 == null && isEmpty(val2))   return true;
 else   if (val2 == null && isEmpty(val1))   return true;
 else   if (ObjectUtil.isSimple(val1) && ObjectUtil.isSimple(val2))   return val1.equals(val2);
 else   if (val1 instanceof byte[] && val2 instanceof byte[])   return Arrays.equals((byte[])val1,(byte[])val2);
 else   if ((val1 instanceof Value && val2 instanceof Value) || (val1 instanceof Enum && val2 instanceof Enum))   return val1.equals(val2);
 else   if (val1 != null && val1.getClass().isArray() && val2 != null && val2.getClass().isArray()) {
    if (Array.getLength(val1) != Array.getLength(val2))     return false;
    for (int idx=0; idx < Array.getLength(val1); idx++) {
      if (!isSameExt(Array.get(val1,idx),Array.get(val2,idx)))       return false;
    }
    return true;
  }
 else   if (val1 instanceof Set<?> && val2 instanceof Set<?>) {
    if ((val1 instanceof PersistentCollection && !((PersistentCollection)val1).wasInitialized()) || (val2 instanceof PersistentCollection && !((PersistentCollection)val2).wasInitialized()))     return false;
    Collection<?> coll1=(Collection<?>)val1;
    Collection<?> coll2=(Collection<?>)val2;
    if (coll1.size() != coll2.size())     return false;
    for (    Object e : coll1) {
      boolean found=false;
      for (      Object f : coll2) {
        if (isSameExt(e,f)) {
          found=true;
          break;
        }
      }
      if (!found)       return false;
    }
    for (    Object e : coll2) {
      boolean found=false;
      for (      Object f : coll1) {
        if (isSameExt(e,f)) {
          found=true;
          break;
        }
      }
      if (!found)       return false;
    }
    return true;
  }
 else   if (val1 instanceof List<?> && val2 instanceof List<?>) {
    if ((val1 instanceof PersistentCollection && !((PersistentCollection)val1).wasInitialized()) || (val2 instanceof PersistentCollection && !((PersistentCollection)val2).wasInitialized()))     return false;
    List<?> list1=(List<?>)val1;
    List<?> list2=(List<?>)val2;
    if (list1.size() != list2.size())     return false;
    for (int idx=0; idx < list1.size(); idx++) {
      if (!isSameExt(list1.get(idx),list2.get(idx)))       return false;
    }
    return true;
  }
 else   if (val1 instanceof Map<?,?> && val2 instanceof Map<?,?>) {
    if ((val1 instanceof PersistentCollection && !((PersistentCollection)val1).wasInitialized()) || (val2 instanceof PersistentCollection && !((PersistentCollection)val2).wasInitialized()))     return false;
    Map<?,?> map1=(Map<?,?>)val1;
    Map<?,?> map2=(Map<?,?>)val2;
    if (map1.size() != map2.size())     return false;
    for (    Object e : map1.keySet()) {
      Object key=null;
      for (      Object f : map2.keySet()) {
        if (isSameExt(e,f)) {
          key=f;
          break;
        }
      }
      if (key == null)       return false;
      if (!isSameExt(map1.get(e),map2.get(key)))       return false;
    }
    for (    Object f : map2.keySet()) {
      Object key=null;
      for (      Object e : map1.keySet()) {
        if (isSameExt(e,f)) {
          key=e;
          break;
        }
      }
      if (key == null)       return false;
      if (!isSameExt(map1.get(key),map2.get(f)))       return false;
    }
    return true;
  }
  Object n=val1 instanceof Wrapper ? ((Wrapper)val1).getWrappedObject() : val1;
  Object o=val2 instanceof Wrapper ? ((Wrapper)val2).getWrappedObject() : val2;
  if (isEntity(n) && isEntity(o))   return dataManager.getUid(n).equals(dataManager.getUid(o));
  return n == o;
}