[ https://issues.apache.org/jira/browse/MAPREDUCE-5020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trevor Robinson updated MAPREDUCE-5020: --------------------------------------- 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|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} was: 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} > 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 > 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 > Labels: jdk8 > > 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 is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira