Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-5020

Compile failure with JDK8

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.3-alpha, 2.1.0-beta
    • 2.1.1-beta
    • client
    • 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
      

      Attachments

        1. MAPREDUCE-5020.patch
          1 kB
          Trevor Robinson

        Activity

          People

            scurrilous Trevor Robinson
            scurrilous Trevor Robinson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: