Hadoop context type parameters in Kotlin

When I implement Hadoop Mapper or Reducer in Kotlin, I get an interesting contradiction with the compiler. Each time you use a Context object, the compiler generates the error message โ€œ4 type argumentsโ€ if you do not specify type arguments ( <KEYIN, VALUEIN, KEYOUT, VALUEOUT> ), and says โ€œNo type argumentsโ€ if you use arguments type of suggestion, Any ideas what happens here?

Example:

 // gives "4 type arguments expected" override fun setup(context: Context?) { super.setup(context) } // gives "No type arguments expected" override fun setup(context: Context<KeyIn, ValueIn, KeyOut, ValueOut>?) { super.setup(context) } 

Setting Mapper<KeyIn, ValueIn, KeyOut, ValueOut>.Context does the compilation, but since Context is an internal Mapper class, you should not imply the type of Context when you specify the type of Mapper that you are using extends, as in Java?

+4
source share
1 answer

Kotlin expects "4 type arguments" on Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> , and not on Context in Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context .

Example:

 override fun setup(context: Mappert<KeyIn, ValueIn, KeyOut, ValueOut>.Context?) { super.setup(context) } 

It is possible that type arguments for Context should / are implied. I suggest creating a problem in Kotlin YouTrack .

+3
source

All Articles