hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r1162008 - in /hadoop/common/trunk/hadoop-common-project/hadoop-common: ./ src/main/java/org/apache/hadoop/io/ src/main/java/org/apache/hadoop/util/bloom/ src/test/java/org/apache/hadoop/io/
Date Fri, 26 Aug 2011 06:58:53 GMT
Author: szetszwo
Date: Fri Aug 26 06:58:52 2011
New Revision: 1162008

URL: http://svn.apache.org/viewvc?rev=1162008&view=rev
Log:
HADOOP-7547. Add generic type in WritableComparable subclasses.  Contributed by Uma Maheswara
Rao G

Modified:
    hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BinaryComparable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BooleanWritable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/ByteWritable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/DoubleWritable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FloatWritable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/IntWritable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/LongWritable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapFile.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/NullWritable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SetFile.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/UTF8.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/VIntWritable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/VLongWritable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/WritableComparable.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/Key.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/RandomDatum.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestTextNonUTF8.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestWritableName.java

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Fri Aug 26 06:58:52
2011
@@ -344,6 +344,9 @@ Release 0.23.0 - Unreleased
 
     HADOOP-7561. Make test-patch only run tests for changed modules. (tomwhite)
 
+    HADOOP-7547. Add generic type in WritableComparable subclasses.
+    (Uma Maheswara Rao G via szetszwo)
+
   OPTIMIZATIONS
   
     HADOOP-7333. Performance improvement in PureJavaCrc32. (Eric Caspole

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BinaryComparable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BinaryComparable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BinaryComparable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BinaryComparable.java
Fri Aug 26 06:58:52 2011
@@ -43,6 +43,7 @@ public abstract class BinaryComparable i
    * Compare bytes from {#getBytes()}.
    * @see org.apache.hadoop.io.WritableComparator#compareBytes(byte[],int,int,byte[],int,int)
    */
+  @Override
   public int compareTo(BinaryComparable other) {
     if (this == other)
       return 0;
@@ -61,6 +62,7 @@ public abstract class BinaryComparable i
   /**
    * Return true if bytes from {#getBytes()} match.
    */
+  @Override
   public boolean equals(Object other) {
     if (!(other instanceof BinaryComparable))
       return false;
@@ -74,6 +76,7 @@ public abstract class BinaryComparable i
    * Return a hash of the bytes returned from {#getBytes()}.
    * @see org.apache.hadoop.io.WritableComparator#hashBytes(byte[],int)
    */
+  @Override
   public int hashCode() {
     return WritableComparator.hashBytes(getBytes(), getLength());
   }

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BooleanWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BooleanWritable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BooleanWritable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BooleanWritable.java
Fri Aug 26 06:58:52 2011
@@ -28,7 +28,7 @@ import org.apache.hadoop.classification.
  */
 @InterfaceAudience.Public
 @InterfaceStability.Stable
-public class BooleanWritable implements WritableComparable {
+public class BooleanWritable implements WritableComparable<BooleanWritable> {
   private boolean value;
 
   /** 
@@ -69,6 +69,7 @@ public class BooleanWritable implements 
 
   /**
    */
+  @Override
   public boolean equals(Object o) {
     if (!(o instanceof BooleanWritable)) {
       return false;
@@ -77,6 +78,7 @@ public class BooleanWritable implements 
     return this.value == other.value;
   }
 
+  @Override
   public int hashCode() {
     return value ? 0 : 1;
   }
@@ -85,12 +87,14 @@ public class BooleanWritable implements 
 
   /**
    */
-  public int compareTo(Object o) {
+  @Override
+  public int compareTo(BooleanWritable o) {
     boolean a = this.value;
-    boolean b = ((BooleanWritable) o).value;
+    boolean b = o.value;
     return ((a == b) ? 0 : (a == false) ? -1 : 1);
   }
   
+  @Override
   public String toString() {
     return Boolean.toString(get());
   }
@@ -103,6 +107,7 @@ public class BooleanWritable implements 
       super(BooleanWritable.class);
     }
 
+    @Override
     public int compare(byte[] b1, int s1, int l1,
                        byte[] b2, int s2, int l2) {
       return compareBytes(b1, s1, l1, b2, s2, l2);

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/ByteWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/ByteWritable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/ByteWritable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/ByteWritable.java
Fri Aug 26 06:58:52 2011
@@ -26,7 +26,7 @@ import org.apache.hadoop.classification.
 /** A WritableComparable for a single byte. */
 @InterfaceAudience.Public
 @InterfaceStability.Stable
-public class ByteWritable implements WritableComparable {
+public class ByteWritable implements WritableComparable<ByteWritable> {
   private byte value;
 
   public ByteWritable() {}
@@ -48,6 +48,7 @@ public class ByteWritable implements Wri
   }
 
   /** Returns true iff <code>o</code> is a ByteWritable with the same value.
*/
+  @Override
   public boolean equals(Object o) {
     if (!(o instanceof ByteWritable)) {
       return false;
@@ -56,17 +57,20 @@ public class ByteWritable implements Wri
     return this.value == other.value;
   }
 
+  @Override
   public int hashCode() {
     return (int)value;
   }
 
   /** Compares two ByteWritables. */
-  public int compareTo(Object o) {
+  @Override
+  public int compareTo(ByteWritable o) {
     int thisValue = this.value;
-    int thatValue = ((ByteWritable)o).value;
+    int thatValue = o.value;
     return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
   }
 
+  @Override
   public String toString() {
     return Byte.toString(value);
   }
@@ -77,6 +81,7 @@ public class ByteWritable implements Wri
       super(ByteWritable.class);
     }
 
+    @Override
     public int compare(byte[] b1, int s1, int l1,
                        byte[] b2, int s2, int l2) {
       byte thisValue = b1[s1];

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java
Fri Aug 26 06:58:52 2011
@@ -183,6 +183,7 @@ public class BytesWritable extends Binar
     out.write(bytes, 0, size);
   }
   
+  @Override
   public int hashCode() {
     return super.hashCode();
   }
@@ -190,6 +191,7 @@ public class BytesWritable extends Binar
   /**
    * Are the two byte sequences equal?
    */
+  @Override
   public boolean equals(Object right_obj) {
     if (right_obj instanceof BytesWritable)
       return super.equals(right_obj);
@@ -199,6 +201,7 @@ public class BytesWritable extends Binar
   /**
    * Generate the stream of bytes as hex pairs separated by ' '.
    */
+  @Override
   public String toString() { 
     StringBuilder sb = new StringBuilder(3*size);
     for (int idx = 0; idx < size; idx++) {
@@ -225,6 +228,7 @@ public class BytesWritable extends Binar
     /**
      * Compare the buffers in serialized form.
      */
+    @Override
     public int compare(byte[] b1, int s1, int l1,
                        byte[] b2, int s2, int l2) {
       return compareBytes(b1, s1+LENGTH_BYTES, l1-LENGTH_BYTES, 

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/DoubleWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/DoubleWritable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/DoubleWritable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/DoubleWritable.java
Fri Aug 26 06:58:52 2011
@@ -30,7 +30,7 @@ import org.apache.hadoop.classification.
  */
 @InterfaceAudience.Public
 @InterfaceStability.Stable
-public class DoubleWritable implements WritableComparable {
+public class DoubleWritable implements WritableComparable<DoubleWritable> {
 
   private double value = 0.0;
   
@@ -57,6 +57,7 @@ public class DoubleWritable implements W
   /**
    * Returns true iff <code>o</code> is a DoubleWritable with the same value.
    */
+  @Override
   public boolean equals(Object o) {
     if (!(o instanceof DoubleWritable)) {
       return false;
@@ -65,15 +66,17 @@ public class DoubleWritable implements W
     return this.value == other.value;
   }
   
+  @Override
   public int hashCode() {
     return (int)Double.doubleToLongBits(value);
   }
   
-  public int compareTo(Object o) {
-    DoubleWritable other = (DoubleWritable)o;
-    return (value < other.value ? -1 : (value == other.value ? 0 : 1));
+  @Override
+  public int compareTo(DoubleWritable o) {
+    return (value < o.value ? -1 : (value == o.value ? 0 : 1));
   }
   
+  @Override
   public String toString() {
     return Double.toString(value);
   }
@@ -84,6 +87,7 @@ public class DoubleWritable implements W
       super(DoubleWritable.class);
     }
 
+    @Override
     public int compare(byte[] b1, int s1, int l1,
                        byte[] b2, int s2, int l2) {
       double thisValue = readDouble(b1, s1);

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FloatWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FloatWritable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FloatWritable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FloatWritable.java
Fri Aug 26 06:58:52 2011
@@ -26,7 +26,7 @@ import org.apache.hadoop.classification.
 /** A WritableComparable for floats. */
 @InterfaceAudience.Public
 @InterfaceStability.Stable
-public class FloatWritable implements WritableComparable {
+public class FloatWritable implements WritableComparable<FloatWritable> {
   private float value;
 
   public FloatWritable() {}
@@ -48,6 +48,7 @@ public class FloatWritable implements Wr
   }
 
   /** Returns true iff <code>o</code> is a FloatWritable with the same value.
*/
+  @Override
   public boolean equals(Object o) {
     if (!(o instanceof FloatWritable))
       return false;
@@ -55,17 +56,20 @@ public class FloatWritable implements Wr
     return this.value == other.value;
   }
 
+  @Override
   public int hashCode() {
     return Float.floatToIntBits(value);
   }
 
   /** Compares two FloatWritables. */
-  public int compareTo(Object o) {
+  @Override
+  public int compareTo(FloatWritable o) {
     float thisValue = this.value;
-    float thatValue = ((FloatWritable)o).value;
+    float thatValue = o.value;
     return (thisValue<thatValue ? -1 : (thisValue==thatValue ? 0 : 1));
   }
 
+  @Override
   public String toString() {
     return Float.toString(value);
   }
@@ -75,7 +79,7 @@ public class FloatWritable implements Wr
     public Comparator() {
       super(FloatWritable.class);
     }
-
+    @Override
     public int compare(byte[] b1, int s1, int l1,
                        byte[] b2, int s2, int l2) {
       float thisValue = readFloat(b1, s1);

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/IntWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/IntWritable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/IntWritable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/IntWritable.java
Fri Aug 26 06:58:52 2011
@@ -18,7 +18,10 @@
 
 package org.apache.hadoop.io;
 
-import java.io.*;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
@@ -26,7 +29,7 @@ import org.apache.hadoop.classification.
 /** A WritableComparable for ints. */
 @InterfaceAudience.Public
 @InterfaceStability.Stable
-public class IntWritable implements WritableComparable {
+public class IntWritable implements WritableComparable<IntWritable> {
   private int value;
 
   public IntWritable() {}
@@ -48,6 +51,7 @@ public class IntWritable implements Writ
   }
 
   /** Returns true iff <code>o</code> is a IntWritable with the same value. */
+  @Override
   public boolean equals(Object o) {
     if (!(o instanceof IntWritable))
       return false;
@@ -55,17 +59,20 @@ public class IntWritable implements Writ
     return this.value == other.value;
   }
 
+  @Override
   public int hashCode() {
     return value;
   }
 
   /** Compares two IntWritables. */
-  public int compareTo(Object o) {
+  @Override
+  public int compareTo(IntWritable o) {
     int thisValue = this.value;
-    int thatValue = ((IntWritable)o).value;
+    int thatValue = o.value;
     return (thisValue<thatValue ? -1 : (thisValue==thatValue ? 0 : 1));
   }
 
+  @Override
   public String toString() {
     return Integer.toString(value);
   }
@@ -75,7 +82,8 @@ public class IntWritable implements Writ
     public Comparator() {
       super(IntWritable.class);
     }
-
+    
+    @Override
     public int compare(byte[] b1, int s1, int l1,
                        byte[] b2, int s2, int l2) {
       int thisValue = readInt(b1, s1);

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/LongWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/LongWritable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/LongWritable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/LongWritable.java
Fri Aug 26 06:58:52 2011
@@ -18,7 +18,10 @@
 
 package org.apache.hadoop.io;
 
-import java.io.*;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
@@ -26,7 +29,7 @@ import org.apache.hadoop.classification.
 /** A WritableComparable for longs. */
 @InterfaceAudience.Public
 @InterfaceStability.Stable
-public class LongWritable implements WritableComparable {
+public class LongWritable implements WritableComparable<LongWritable> {
   private long value;
 
   public LongWritable() {}
@@ -60,9 +63,9 @@ public class LongWritable implements Wri
   }
 
   /** Compares two LongWritables. */
-  public int compareTo(Object o) {
+  public int compareTo(LongWritable o) {
     long thisValue = this.value;
-    long thatValue = ((LongWritable)o).value;
+    long thatValue = o.value;
     return (thisValue<thatValue ? -1 : (thisValue==thatValue ? 0 : 1));
   }
 
@@ -86,6 +89,8 @@ public class LongWritable implements Wri
 
   /** A decreasing Comparator optimized for LongWritable. */ 
   public static class DecreasingComparator extends Comparator {
+    
+    @Override
     public int compare(WritableComparable a, WritableComparable b) {
       return -super.compare(a, b);
     }

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapFile.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapFile.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapFile.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapFile.java
Fri Aug 26 06:58:52 2011
@@ -18,24 +18,23 @@
 
 package org.apache.hadoop.io;
 
+import java.io.EOFException;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.io.*;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.util.Options;
-import org.apache.hadoop.fs.*;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.conf.*;
-import org.apache.hadoop.util.Progressable;
-import org.apache.hadoop.util.ReflectionUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.SequenceFile.CompressionType;
-import org.apache.hadoop.io.SequenceFile.Reader;
-import org.apache.hadoop.io.SequenceFile.Writer;
 import org.apache.hadoop.io.compress.CompressionCodec;
-import org.apache.hadoop.io.compress.DefaultCodec;
+import org.apache.hadoop.util.Options;
+import org.apache.hadoop.util.Progressable;
+import org.apache.hadoop.util.ReflectionUtils;
 
 /** A file-based map from keys to values.
  * 

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/NullWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/NullWritable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/NullWritable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/NullWritable.java
Fri Aug 26 06:58:52 2011
@@ -26,7 +26,7 @@ import org.apache.hadoop.classification.
 /** Singleton Writable with no data. */
 @InterfaceAudience.Public
 @InterfaceStability.Stable
-public class NullWritable implements WritableComparable {
+public class NullWritable implements WritableComparable<NullWritable> {
 
   private static final NullWritable THIS = new NullWritable();
 
@@ -39,12 +39,11 @@ public class NullWritable implements Wri
     return "(null)";
   }
 
+  @Override
   public int hashCode() { return 0; }
-  public int compareTo(Object other) {
-    if (!(other instanceof NullWritable)) {
-      throw new ClassCastException("can't compare " + other.getClass().getName() 
-                                   + " to NullWritable");
-    }
+  
+  @Override
+  public int compareTo(NullWritable other) {
     return 0;
   }
   public boolean equals(Object other) { return other instanceof NullWritable; }
@@ -60,6 +59,7 @@ public class NullWritable implements Wri
     /**
      * Compare the buffers in serialized form.
      */
+    @Override
     public int compare(byte[] b1, int s1, int l1,
                        byte[] b2, int s2, int l2) {
       assert 0 == l1;

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SetFile.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SetFile.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SetFile.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SetFile.java
Fri Aug 26 06:58:52 2011
@@ -18,12 +18,14 @@
 
 package org.apache.hadoop.io;
 
-import java.io.*;
 
-import org.apache.hadoop.fs.*;
+import java.io.IOException;
+
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.conf.*;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 
 /** A file-based set of keys. */
 @InterfaceAudience.Public

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java
Fri Aug 26 06:58:52 2011
@@ -265,6 +265,7 @@ public class Text extends BinaryComparab
    * Convert text back to string
    * @see java.lang.Object#toString()
    */
+  @Override
   public String toString() {
     try {
       return decode(bytes, 0, length);
@@ -305,6 +306,7 @@ public class Text extends BinaryComparab
     return false;
   }
 
+  @Override
   public int hashCode() {
     return super.hashCode();
   }

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/UTF8.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/UTF8.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/UTF8.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/UTF8.java
Fri Aug 26 06:58:52 2011
@@ -36,7 +36,7 @@ import org.apache.hadoop.classification.
 @Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 @InterfaceStability.Stable
-public class UTF8 implements WritableComparable {
+public class UTF8 implements WritableComparable<UTF8> {
   private static final Log LOG= LogFactory.getLog(UTF8.class);
   private static final DataInputBuffer IBUF = new DataInputBuffer();
 
@@ -129,13 +129,14 @@ public class UTF8 implements WritableCom
   }
 
   /** Compare two UTF8s. */
-  public int compareTo(Object o) {
-    UTF8 that = (UTF8)o;
+  @Override
+  public int compareTo(UTF8 o) {
     return WritableComparator.compareBytes(bytes, 0, length,
-                                           that.bytes, 0, that.length);
+                                           o.bytes, 0, o.length);
   }
 
   /** Convert to a String. */
+  @Override
   public String toString() {
     StringBuilder buffer = new StringBuilder(length);
     try {
@@ -150,6 +151,7 @@ public class UTF8 implements WritableCom
   }
 
   /** Returns true iff <code>o</code> is a UTF8 with the same contents.  */
+  @Override
   public boolean equals(Object o) {
     if (!(o instanceof UTF8))
       return false;
@@ -161,6 +163,7 @@ public class UTF8 implements WritableCom
                                              that.bytes, 0, that.length) == 0;
   }
 
+  @Override
   public int hashCode() {
     return WritableComparator.hashBytes(bytes, length);
   }
@@ -171,6 +174,7 @@ public class UTF8 implements WritableCom
       super(UTF8.class);
     }
 
+    @Override
     public int compare(byte[] b1, int s1, int l1,
                        byte[] b2, int s2, int l2) {
       int n1 = readUnsignedShort(b1, s1);

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/VIntWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/VIntWritable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/VIntWritable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/VIntWritable.java
Fri Aug 26 06:58:52 2011
@@ -30,7 +30,7 @@ import org.apache.hadoop.classification.
  */
 @InterfaceAudience.Public
 @InterfaceStability.Stable
-public class VIntWritable implements WritableComparable {
+public class VIntWritable implements WritableComparable<VIntWritable> {
   private int value;
 
   public VIntWritable() {}
@@ -52,6 +52,7 @@ public class VIntWritable implements Wri
   }
 
   /** Returns true iff <code>o</code> is a VIntWritable with the same value.
*/
+  @Override
   public boolean equals(Object o) {
     if (!(o instanceof VIntWritable))
       return false;
@@ -59,17 +60,20 @@ public class VIntWritable implements Wri
     return this.value == other.value;
   }
 
+  @Override
   public int hashCode() {
     return value;
   }
 
   /** Compares two VIntWritables. */
-  public int compareTo(Object o) {
+  @Override
+  public int compareTo(VIntWritable o) {
     int thisValue = this.value;
-    int thatValue = ((VIntWritable)o).value;
+    int thatValue = o.value;
     return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
   }
-
+  
+  @Override
   public String toString() {
     return Integer.toString(value);
   }

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/VLongWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/VLongWritable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/VLongWritable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/VLongWritable.java
Fri Aug 26 06:58:52 2011
@@ -30,7 +30,7 @@ import org.apache.hadoop.classification.
  */
 @InterfaceAudience.Public
 @InterfaceStability.Stable
-public class VLongWritable implements WritableComparable {
+public class VLongWritable implements WritableComparable<VLongWritable> {
   private long value;
 
   public VLongWritable() {}
@@ -52,6 +52,7 @@ public class VLongWritable implements Wr
   }
 
   /** Returns true iff <code>o</code> is a VLongWritable with the same value.
*/
+  @Override
   public boolean equals(Object o) {
     if (!(o instanceof VLongWritable))
       return false;
@@ -59,17 +60,20 @@ public class VLongWritable implements Wr
     return this.value == other.value;
   }
 
+  @Override
   public int hashCode() {
     return (int)value;
   }
 
   /** Compares two VLongWritables. */
-  public int compareTo(Object o) {
+  @Override
+  public int compareTo(VLongWritable o) {
     long thisValue = this.value;
-    long thatValue = ((VLongWritable)o).value;
+    long thatValue = o.value;
     return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
   }
 
+  @Override
   public String toString() {
     return Long.toString(value);
   }

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/WritableComparable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/WritableComparable.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/WritableComparable.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/WritableComparable.java
Fri Aug 26 06:58:52 2011
@@ -37,7 +37,7 @@ import org.apache.hadoop.classification.
  *  
  * <p>Example:</p>
  * <p><blockquote><pre>
- *     public class MyWritableComparable implements WritableComparable {
+ *     public class MyWritableComparable implements WritableComparable<MyWritableComparable>
{
  *       // Some data
  *       private int counter;
  *       private long timestamp;
@@ -54,7 +54,7 @@ import org.apache.hadoop.classification.
  *       
  *       public int compareTo(MyWritableComparable o) {
  *         int thisValue = this.value;
- *         int thatValue = ((IntWritable)o).value;
+ *         int thatValue = o.value;
  *         return (thisValue &lt; thatValue ? -1 : (thisValue==thatValue ? 0 : 1));
  *       }
  *

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/Key.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/Key.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/Key.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/Key.java
Fri Aug 26 06:58:52 2011
@@ -167,7 +167,7 @@ public class Key implements WritableComp
   }
   
   // Comparable
-  
+  @Override
   public int compareTo(Key other) {
     int result = this.bytes.length - other.getBytes().length;
     for (int i = 0; result == 0 && i < bytes.length; i++) {

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/RandomDatum.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/RandomDatum.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/RandomDatum.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/RandomDatum.java
Fri Aug 26 06:58:52 2011
@@ -18,10 +18,13 @@
 
 package org.apache.hadoop.io;
 
-import java.util.*;
-import java.io.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Random;
 
-public class RandomDatum implements WritableComparable {
+
+public class RandomDatum implements WritableComparable<RandomDatum> {
   private int length;
   private byte[] data;
 
@@ -49,20 +52,22 @@ public class RandomDatum implements Writ
     in.readFully(data, 0, length);
   }
 
-  public int compareTo(Object o) {
-    RandomDatum that = (RandomDatum)o;
+  @Override
+  public int compareTo(RandomDatum o) {
     return WritableComparator.compareBytes(this.data, 0, this.length,
-                                           that.data, 0, that.length);
+                                           o.data, 0, o.length);
   }
 
+  @Override
   public boolean equals(Object o) {
-    return compareTo(o) == 0;
+    return compareTo((RandomDatum)o) == 0;
   }
 
   private static final char[] HEX_DIGITS =
   {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
 
   /** Returns a string representation of this object. */
+  @Override
   public String toString() {
     StringBuilder buf = new StringBuilder(length*2);
     for (int i = 0; i < length; i++) {

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestTextNonUTF8.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestTextNonUTF8.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestTextNonUTF8.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestTextNonUTF8.java
Fri Aug 26 06:58:52 2011
@@ -21,14 +21,10 @@ package org.apache.hadoop.io;
 import junit.framework.TestCase;
 
 import java.nio.charset.MalformedInputException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.util.*;
 import java.util.Arrays;
 
 /** Unit tests for NonUTF8. */
 public class TestTextNonUTF8 extends TestCase {
-  private static final Log LOG= LogFactory.getLog(TestTextNonUTF8.class);
 
   public void testNonUTF8() throws Exception{
     // this is a non UTF8 byte array

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestWritableName.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestWritableName.java?rev=1162008&r1=1162007&r2=1162008&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestWritableName.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestWritableName.java
Fri Aug 26 06:58:52 2011
@@ -18,12 +18,12 @@
 
 package org.apache.hadoop.io;
 
-import java.io.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
 import java.util.Random;
 
-import org.apache.hadoop.conf.Configurable;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.util.ReflectionUtils;
 
 import junit.framework.TestCase;
 
@@ -97,7 +97,7 @@ public class TestWritableName extends Te
   public void testBadName() throws Exception {
     Configuration conf = new Configuration();
     try {
-      Class<?> test = WritableName.getClass("unknown_junk",conf);
+      WritableName.getClass("unknown_junk",conf);
       assertTrue(false);
     } catch(IOException e) {
       assertTrue(e.getMessage().matches(".*unknown_junk.*"));



Mime
View raw message