[ https://issues.apache.org/jira/browse/MAPREDUCE-5020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Allen Wittenauer updated MAPREDUCE-5020: ---------------------------------------- Fix Version/s: (was: 2.3.0) (was: 3.0.0) > Compile failure with JDK8 > ------------------------- > > Key: MAPREDUCE-5020 > URL: https://issues.apache.org/jira/browse/MAPREDUCE-5020 > Project: Hadoop Map/Reduce > Issue Type: Bug > Components: client > Affects Versions: 2.0.3-alpha, 2.1.0-beta > Environment: 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) > Reporter: Trevor Robinson > Assignee: Trevor Robinson > Labels: build-failure, jdk8 > Fix For: 2.1.1-beta > > Attachments: MAPREDUCE-5020.patch > > > 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|http://docs.oracle.com/javase/specs/jls/se5.0/html/expressions.html#15.12.2.6] > or [Java > 7|http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2.6]), > which demands that methods applicable via unchecked conversion have their > return type erased: > {noformat} > [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[] > {noformat} > {code} > @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 > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)