فهرست منبع

HADOOP-1585. Declare the classes in GenericWritable to be subclasses of
Writable.


git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@555697 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 18 سال پیش
والد
کامیت
538c595489
2فایلهای تغییر یافته به همراه6 افزوده شده و 3 حذف شده
  1. 3 0
      CHANGES.txt
  2. 3 3
      src/java/org/apache/hadoop/io/GenericWritable.java

+ 3 - 0
CHANGES.txt

@@ -331,6 +331,9 @@ Trunk (unreleased changes)
 102. HADOOP-1535.  Fix the user-controlled grouping to the reduce function.
      (Vivek Ratan via omalley)
 
+103. HADOOP-1585.  Modify GenericWritable to declare the classes as subtypes
+     of Writable (Espen Amble Kolstad via omalley)
+
 Release 0.13.0 - 2007-06-08
 
  1. HADOOP-1047.  Fix TestReplication to succeed more reliably.

+ 3 - 3
src/java/org/apache/hadoop/io/GenericWritable.java

@@ -81,9 +81,9 @@ public abstract class GenericWritable implements Writable {
 
   public void readFields(DataInput in) throws IOException {
     type = in.readByte();
-    Class clazz = getTypes()[type & 0xff];
+    Class<? extends Writable> clazz = getTypes()[type & 0xff];
     try {
-      instance = (Writable) clazz.newInstance();
+      instance = clazz.newInstance();
     } catch (Exception e) {
       e.printStackTrace();
       throw new IOException("Cannot initialize the class: " + clazz);
@@ -103,6 +103,6 @@ public abstract class GenericWritable implements Writable {
    * Return all classes that may be wrapped.  Subclasses should implement this
    * to return a constant array of classes.
    */
-  abstract protected Class[] getTypes();
+  abstract protected Class<? extends Writable>[] getTypes();
 
 }