avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1235064 - in /avro/trunk: CHANGES.txt lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java
Date Mon, 23 Jan 2012 23:31:51 GMT
Author: cutting
Date: Mon Jan 23 23:31:51 2012
New Revision: 1235064

URL: http://svn.apache.org/viewvc?rev=1235064&view=rev
Log:
AVRO-1000. Java: Remove incompatible implementations of equals() and hashCode() from GenericData.Array.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
    avro/trunk/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1235064&r1=1235063&r2=1235064&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Mon Jan 23 23:31:51 2012
@@ -69,6 +69,9 @@ Avro 1.6.2 (unreleased)
     AVRO-993. Java: Add methods back to GenericDatumReader that were 
     removed in AVRO-839. (jbaldassari)
 
+    AVRO-1000. Java: Remove incompatible implementations of equals()
+    and hashCode() from GenericData.Array.  (cutting)
+
 Avro 1.6.1 (8 November 2011)
 
   INCOMPATIBLE CHANGES

Modified: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java?rev=1235064&r1=1235063&r2=1235064&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java (original)
+++ avro/trunk/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java Mon Jan
23 23:31:51 2012
@@ -198,19 +198,6 @@ public class GenericData {
     public T peek() {
       return (size < elements.length) ? (T)elements[size] : null;
     }
-    @Override
-    public int hashCode() {
-      return GenericData.get().hashCode(this, schema);
-    }
-    @Override
-    public boolean equals(Object o) {
-      if (o == this) return true;                 // identical object
-      if (!(o instanceof Array)) return false;    // not an array
-      Array that = (Array)o;
-      if (!schema.equals(that.schema))
-        return false;                             // not the same schema
-      return this.compareTo(that) == 0;
-    }
     public int compareTo(GenericArray<T> that) {
       return GenericData.get().compare(this, that, this.getSchema());
     }

Modified: avro/trunk/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java?rev=1235064&r1=1235063&r2=1235064&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java (original)
+++ avro/trunk/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java Mon
Jan 23 23:31:51 2012
@@ -168,6 +168,11 @@ public class TestGenericData {
     GenericArray<Integer> array = new GenericData.Array<Integer>(1, schema);
     array.add(99);
     assertEquals(new Integer(99), array.get(0));
+    List<Integer> list = new ArrayList<Integer>();
+    list.add(99);
+    assertEquals(array, list);
+    assertEquals(list, array);
+    assertEquals(list.hashCode(), array.hashCode());
     try {
       array.get(2);
       fail("Expected IndexOutOfBoundsException getting index 2");



Mime
View raw message