title: Mozilla Rhino - ScriptableObject with custom object?
body: <p>I am using Mozilla Rhino (JavaScript engine) for my Java application. I defined a ScriptableObject like this:</p>
  
  <pre><code>public class TheObj extends ScriptableObject {
  public TheObj(){
      //nothing
  }
  public TheObj(Scriptable scope, Scriptable prototype) {
      super(scope, prototype);
  }
  
  @Override
  public String getClassName() {
      return "Foo";
  }
  @JSStaticFunction
  public static Foo foo(Foo foo){
      return foo;
  }
  
  }
  </code></pre>
  
  <p>And the Foo class is:</p>
  
  <pre><code>public class Foo {
    public void bar(){
      System.out.println("it works");
    }
  }
  </code></pre>
  
  <p>But when I try <code>ScriptableObject.defineClass(scope, TheObj.class);</code> where <code>scope</code> is the Scriptable from <code>Context.enter().initStandardObjects();</code> then it throws </p>
  
  <pre><code>org.mozilla.javascript.EvaluatorException: Unsupported parameter type "Foo" in method "bar".
  </code></pre>
  
  <p>What can I do to fix this?</p>