0

シンプルに書き直しました。これがコンパイルされる理由:

MapReduceSpecification.of(
   "Something, anything", 
   input,
   mapper, // (extends Mapper<Job, Long, String>)
   Marshallers.getLongMarshaller(),
   Marshallers.getStringMarshaller(),
   NoReducer.<Long, String, String>create(),
   NoOutput.<String, String>create((int)1L)
);

しかし、これはそうではありません。コメント内の異なる「マッパー」拡張子に注意してください。

MapReduceSpecification.of(
   "Something, anything", 
   input,
   mapper, // (extends Mapper<Job, Long, JobSummary>)
   Marshallers.getLongMarshaller(),
   Marshallers.getSerializationMarshaller(),
   NoReducer.<Long, JobSummary, JobSummary>create(),
   NoOutput.<JobSummary, JobSummary>create((int)1L)
);

次のコンパイル例外をスローします。

The method
of(String,
Input<I>,
Mapper<I,K,V>,
Marshaller<K>,
Marshaller<V>,
Reducer<K,V,O>, Output<O,R>)
in the type MapReduceSpecification is not applicable for the arguments
(String,
JobInput,
JobMapper,
Marshaller<Long>,
Marshaller<Serializable>,
NoReducer<Long,JobSummary,JobSummary>,
NoOutput<JobSummary,JobSummary>)    

JobSummary は単純です (この例の目的のため):

public class JobSummary implements Serializable {
   public String Text;
}

I、K、V、O、R の謎の組み合わせのどの部分を見逃したのか、何か洞察はありますか?

4

1 に答える 1