hadoop 1.0.3 编译时遇到的BUG

JDK 1.7  编译hadoop遇到以下错误:
echo] contrib: gridmix
[javac] Compiling 31 source files to /home/hadoop/branch-1.0_0427/build/contrib/gridmix/classes
[javac] /home/hadoop/branch-1.0_0427/src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/Gridmix.java:396: error: type argument ? extends T is not within bounds of type-variable E
[javac] private <T> String getEnumValues(Enum<? extends T>[] e) {
[javac] ^
[javac] where T,E are type-variables:
[javac] T extends Object declared in method <T>getEnumValues(Enum<? extends T>[])
[javac] E extends Enum<E> declared in class Enum
[javac] /home/hadoop/branch-1.0_0427/src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/Gridmix.java:399: error: type argument ? extends T is not within bounds of type-variable E
[javac] for (Enum<? extends T> v : e) {
[javac] ^
[javac] where T,E are type-variables:
[javac] T extends Object declared in method <T>getEnumValues(Enum<? extends T>[])
[javac] E extends Enum<E> declared in class Enum
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors

BUILD FAILED /home/hadoop/branch-1.0_0427/build.xml:703: The following error occurred while executing this line: /home/hadoop/branch-1.0_0427/src/contrib/build.xml:30: The following error occurred while executing this line: /home/hadoop/branch-1.0_0427/src/contrib/build-contrib.xml:185: Compile failed; see the compiler error output for details.

经检查,是个bug:
commit 242f1611856ecf75e176063cbb04ed92702e200b
Author: Eli Collins <[email protected]>
Date:   Fri May 18 13:16:52 2012 -0700

    hadoop-8329.txt

diff --git hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/Gridmix.java hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/Gridmix.java
index eea90cf..4bdc001 100644
--- hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/Gridmix.java
+++ hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/Gridmix.java
@@ -697,10 +697,10 @@ public class Gridmix extends Configured implements Tool {
     }
   }
 
-  private <T> String getEnumValues(Enum<? extends T>[] e) {
+  private String getEnumValues(Enum<?>[] e) {
     StringBuilder sb = new StringBuilder();
     String sep = "";
-    for (Enum<? extends T> v : e) {
+    for (Enum<?> v : e) {
       sb.append(sep);
       sb.append(v.name());
       sep = "|";

你可能感兴趣的:(hadoop)