0
votes

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.

2
I have never heard of the "infamous <init>$ 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
The closest I've heard of looks like the stack trace here: code.google.com/p/gwt-remote/issues/detail?id=1 and that is caused by trying to generate new JSOs 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
Ok, I will soon create a minimal sample project that uses glge-gwt. Then it should be more clear where the error happens. - letmaik

2 Answers

0
votes

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!

0
votes

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