Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.3-alpha, 2.1.0-beta
-
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b36e)
Java HotSpot(TM) Client VM (build 25.0-b04, mixed mode)
Description
Compiling org/apache/hadoop/mapreduce/lib/partition/InputSampler.java fails with the Java 8 preview compiler due to its stricter enforcement of JLS 15.12.2.6 (for Java 5 or Java 7), which demands that methods applicable via unchecked conversion have their return type erased:
[ERROR] hadoop-common/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/partition/InputSampler.java:[320,35] error: incompatible types: Object[] cannot be converted to K[]
@SuppressWarnings("unchecked") // getInputFormat, getOutputKeyComparator public static <K,V> void writePartitionFile(Job job, Sampler<K,V> sampler) throws IOException, ClassNotFoundException, InterruptedException { Configuration conf = job.getConfiguration(); final InputFormat inf = ReflectionUtils.newInstance(job.getInputFormatClass(), conf); int numPartitions = job.getNumReduceTasks(); K[] samples = sampler.getSample(inf, job); // returns Object[] according to JLS