title: Spark java.lang StackOverFlow Error When converting Custom class Object to DataSet
body: <pre><code>public class OuterClass implements Serializable {
  int id;
  ArrayList&lt;InnerClass&gt; listofInner;
  
  public int getId() {
      return id;
  }
  
  public void setId(int num) {
      this.id = num;
  }
  
  public ArrayList&lt;InnerClass&gt; getListofInner() {
      return listofInner;
  }
  
  public void setListofInner(ArrayList&lt;InnerClass&gt; list) {
      this.listofInner = list;
  }
  
  public static class InnerClass implements Serializable {
      String streetno;
      private List&lt;InnerClass&gt; children = new ArrayList&lt;InnerClass&gt;();
  
      public void setStreetno(String streetno) {
          this.streetno = streetno;
      }
  
      public String getStreetno() {
          return streetno;
      }
  
      public List&lt;InnerClass&gt; getChildren() {
          return children;
      }
  
      public void setChildren(List&lt;InnerClass&gt; children) {
          this.children = children;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>OuterClass us = new OuterClass();
      us.setId(111);
      //Inner
      OuterClass.InnerClass ic = new OuterClass.InnerClass();
      ic.setStreetno("My Street");
  
      ic.getChildren().add(new OuterClass.InnerClass());
  
  ArrayList&lt;OuterClass.InnerClass&gt; ar = new ArrayList&lt;OuterClass.InnerClass&gt;();
      ar.add(ic);
      us.setListofInner(ar);
  
  
      //DF
      Encoder&lt;OuterClass&gt; outerClassEncoder = Encoders.bean(OuterClass.class);
      Dataset&lt;OuterClass&gt; ds = spark.createDataset(Collections.singletonList(us), outerClassEncoder);
  </code></pre>
  
  <p>In the above <strong>InnerClass</strong> class has property 
  List children = new ArrayList(); this is a type of<strong>InnerClass</strong> list. Because of this when I am trying to covert this Custom Object to <strong>Dataset</strong>.  I am getting error</p>
  
  <p>java.lang.StackOverflowError: null
      at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.equals(TypeVariableImpl.java:189).</p>
  
  <p>If I remove the <strong>children</strong> property from InnerClass. It works fine.</p>
  
  <p>So Any one please help me..:)</p>