0

I followed all advices on http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/doc/helpInfo/jsoRestrictions.html and still get the infamous <init>$ error.

The following statement triggers the error:

final OpenCTM ctm = OpenCTM.create();

Where OpenCTM is:

public final class OpenCTM extends GObject {

    protected OpenCTM() {}

    public static native OpenCTM create() /*-{
        return new $wnd.GLGE.OpenCTM();
    }-*/;

    public native void setSrc(String url, String relativeTo) /*-{
        this.setSrc(url, relativeTo);
    }-*/;

}

The whole code is located in my GitHub repository and is still pretty small. I'm trying to write a wrapper library for the GLGE framework.

I really don't know what to do anymore.

letmaik
  • 3,348
  • 1
  • 36
  • 43
  • 1
    I have never heard of the "infamous `$` error", is this a GWT error or a GLGE error? Can you post exactly what the error is and at what point you get it? – funkybro Sep 06 '12 at 07:03
  • 1
    The closest I've heard of looks like the stack trace here: http://code.google.com/p/gwt-remote/issues/detail?id=1 and that is caused by trying to generate new `JSO`s at generator time, which shouldn't be allowed. funkybro is right, a stack trace will help in trying to give you suggestions, plus most info on when you get this (such as where in the glge-gwt proj this can be confirmed). – Colin Alworth Sep 06 '12 at 11:36
  • Ok, I will soon create a minimal sample project that uses glge-gwt. Then it should be more clear where the error happens. – letmaik Sep 06 '12 at 19:48

2 Answers2

0

It turned out that the error was a subsequent error and has hidden the root cause.

The solution is to actually compile this whole thing now and then, although theoretically unnecessary in dev mode. This led to:

Errors in 'file:/.../MaterialLayer.java'
       Line 90: missing formal parameter
> function (in) {
> ------------^

The corresponding Java code was:

public native void setMapinput(int in) /*-{
    this.setMapinput(in);
}-*/;

As in is a reserved word in JS, this probably led to some subsequent problems. Long story short, I changed the parameter to input and got it working...

Frustrating!

letmaik
  • 3,348
  • 1
  • 36
  • 43
0

I am no expert. I avoided this problem by moving my extended JavaScriptObject class outside of my EntryPoint:onModuleLoad() implemention.