title: GWT JsArray of self, recursive object array
body: <p>I am building a tree structure which an object references itself in like so:</p>
  
  <pre><code>public class ProjectObjectOL extends JavaScriptObject {
  
      protected ProjectObjectOL() { }
  
  
      public final native boolean getStatus()  /*-{ return this.status;  }-*/;
      public final native String getError()  /*-{ return this.error_message;  }-*/;
  
      public final native JsArray&lt;ProjectObjectOL&gt; getChildren() /*-{ this.children; }-*/;
  
  
  }
  </code></pre>
  
  <p>My problem is that I can't seem to get the children of the object.  I've tested it out, and I'm quite sure the JSON structure being passed back consists of an object that contains an array of children of that type which can contain children, etc.</p>
  
  <p>...but when trying to access even the simplest information about the children, the length of the array, it returns 0 every time.  I've tried with no success to figure out what it's doing wrong, all the other data returns fine, but this one piece will NOT retrieve the children.  Here is an example of how I might (directly) access the length for testing:</p>
  
  <pre><code>JSONObject oResults = (JSONObject) JSONParser.parse(response.getText());
                      ProjectListOL testoutputOL = oResults.isObject().getJavaScriptObject().cast();
                      ProjectObjectOL testObject = testoutputOL.getProjectList().get(1);
                      Window.alert(testObject.getChildren().length()+"");
  </code></pre>
  
  <p>A ProjectListOL contains an array of ProjectObjectOLs.  In the example above I simply grabbed the one I KNOW has children.  I'm using ColdFusion for the backend that returns the JSON object.  Once again, I have output this object multiple times, both in GWT and outside (directly dumping the JSON object from the file) verifying that the object is indeed set up how I expect it to be set up.</p>