title: Why does a PairFunction that extends an abstract class loses its field values when it's called?
body: <p>How come when <code>NoParentFunction.call()</code> is called, it retains the field values whereas when <code>HasParentFunction().call()</code> is called, the field values are null/0?</p>
  
  <pre><code>public class Driver {
    public static void main(String[] args) {
      SparkConf conf = new SparkConf().setAppName("Simple Application").setMaster("local");
      JavaSparkContext sc = new JavaSparkContext(conf);
      JavaRDD&lt;String&gt; textFile = sc.textFile("some.txt");
  
      textFile.mapToPair(new NoParentFunction(123, "blah")).collect();
      textFile.mapToPair(new HasParentFunction(123, "blah")).collect();
  }
  
  public class NoParentFunction implements PairFunction&lt;String, String, String&gt; {
    private int myInt;
    private String myString;
  
    public NoParentFunction(int myInt, String myString) {
      this.myInt = myInt;
      this.myString = myString;
    }
  
    public Tuple2&lt;String, String&gt; call(String s) throws Exception {
      System.out.println("prints myInt correctly:" + myInt);
      return null;
    }
  }
  
  public class HasParentFunction extends AbstractFunction implements PairFunction&lt;String, String, String&gt; {
  
    public HasParentFunction(int myInt, String myString) {
      super(myInt, myString);
    }
  
    public Tuple2&lt;String, String&gt; call(String s) throws Exception {
      System.out.println("myInt: " + myInt + " is null");
      return null;
    }
  }
  
  public abstract class AbstractFunction {
    protected int myInt;
    protected String myString;
  
    public AbstractFunction(int myInt, String myString) {
      this.myInt = myInt;
      this.myString = myString;
    }
  
    abstract Tuple2&lt;String, String&gt; call(String s) throws Exception;
  }
  </code></pre>
  
  <p>I can see why <code>HasParentFunction</code> loses its field values, due to <code>AbstractFunction</code>'s no-args constructor being called. But how come this does not happen in the class that <strong><em>does not</em></strong> extend the abstract class?  </p>