Browse Source

HADOOP-4154. Fix type warnings in WritableUtils. (szetszwo via omalley)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@694482 13f79535-47bb-0310-9956-ffa450edef68
Owen O'Malley 17 years ago
parent
commit
5e384a7d1f
2 changed files with 7 additions and 4 deletions
  1. 2 0
      CHANGES.txt
  2. 5 4
      src/core/org/apache/hadoop/io/WritableUtils.java

+ 2 - 0
CHANGES.txt

@@ -523,6 +523,8 @@ Trunk (unreleased changes)
     underReplicated block to the neededReplication queue using method 
     "add" not "update". (hairong)
 
+    HADOOP-4154. Fix type warnings in WritableUtils. (szetszwo via omalley)
+
 Release 0.18.1 - Unreleased
 
   IMPROVEMENTS

+ 5 - 4
src/core/org/apache/hadoop/io/WritableUtils.java

@@ -213,8 +213,9 @@ public final class WritableUtils  {
   /**
    * Allocate a buffer for each thread that tries to clone objects.
    */
-  private static ThreadLocal cloneBuffers = new ThreadLocal() {
-      protected synchronized Object initialValue() {
+  private static ThreadLocal<CopyInCopyOutBuffer> cloneBuffers
+      = new ThreadLocal<CopyInCopyOutBuffer>() {
+      protected synchronized CopyInCopyOutBuffer initialValue() {
         return new CopyInCopyOutBuffer();
       }
     };
@@ -242,7 +243,7 @@ public final class WritableUtils  {
    * @throws IOException
    */
   public static void cloneInto(Writable dst, Writable src) throws IOException {
-    CopyInCopyOutBuffer buffer = (CopyInCopyOutBuffer)cloneBuffers.get();
+    CopyInCopyOutBuffer buffer = cloneBuffers.get();
     buffer.outBuffer.reset();
     src.write(buffer.outBuffer);
     buffer.moveData();
@@ -404,7 +405,7 @@ public final class WritableUtils  {
    * @param enumVal enum value
    * @throws IOException
    */
-  public static void writeEnum(DataOutput out,  Enum enumVal) 
+  public static void writeEnum(DataOutput out,  Enum<?> enumVal) 
     throws IOException{
     Text.writeString(out, enumVal.name()); 
   }