Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to reference subclasses of static Java classes with generics in Scala
    primarykey
    data
    text
    <p>I have this Java code:</p> <pre><code>public class TestMapper extends AppEngineMapper&lt;Key, Entity, NullWritable, NullWritable&gt; { public TestMapper() { } // [... other overriden methods ...] @Override public void setup(Context context) { log.warning("Doing per-worker setup"); } } </code></pre> <p>...which I've converted to:</p> <pre><code>class TestMapper extends AppEngineMapper[Key, Entity, NullWritable, NullWritable] { // [... other overriden methods ...] override def setup(context: Context) { log.warning("Doing per-worker setup") } } </code></pre> <p><strong>Now the actual problem:</strong> </p> <p><strong><em>Context</em></strong> is defined as a nested class within the <strong>org.apache.hadoop.mapreduce.Mapper</strong> class:</p> <pre><code> public static class Mapper&lt;KEYIN, VALUEIN, KEYOUT, VALUEOUT&gt; { //[... some other methods ...] protected void setup(org.apache.hadoop.mapreduce.Mapper&lt;KEYIN,VALUEIN,KEYOUT,VALUEOUT&gt;.Context context) throws java.io.IOException, java.lang.InterruptedException { /* compiled code */ } public class Context extends org.apache.hadoop.mapreduce.MapContext&lt;KEYIN,VALUEIN,KEYOUT,VALUEOUT&gt; { public Context(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.mapreduce.TaskAttemptID conf, org.apache.hadoop.mapreduce.RecordReader&lt;KEYIN,VALUEIN&gt; taskid, org.apache.hadoop.mapreduce.RecordWriter&lt;KEYOUT,VALUEOUT&gt; reader, org.apache.hadoop.mapreduce.OutputCommitter writer, org.apache.hadoop.mapreduce.StatusReporter committer, org.apache.hadoop.mapreduce.InputSplit reporter) throws java.io.IOException, java.lang.InterruptedException { /* compiled code */ } } </code></pre> <p>So I can't tell my Scala class where/what <strong>Context</strong> actually is. If <strong>Mapper</strong> had no generics I could reference <strong>Context</strong> via </p> <pre><code>Mapper#Context </code></pre> <p>but how can I tell that Mapper has Generics? </p> <pre><code>Mapper[_,_,_,_]#Context </code></pre> <p>...didn't work.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload