GWT [Error] Rebind result 'com.viktor.MyClassJSO' cannot be a JSO

after upgrading from GWT 2.6. to 2.8 stable version, I've started getting this error during compilation. The MyClassJSO is just plain JSO class (extends JavaScriptObject), so I really don't know where the problem is.

Does anyone know what does this error exactly mean?

I've managed to change logging level to more verbose one, but no further info appears.

Thanks for all answers.

Upvotes: 0

Views: 221

Answers (1)

Colin Alworth
Colin Alworth

Reputation: 18331

You can't create a JSO with GWT.create(...) (nor can you generate JSO types). The only way is to create the instance in JSNI.

Depending on what kind of object it is, you can either use JavaScriptObject.createObject(), or will need a static factory method to manage the creation of the object in JavaScript.

MyClassJSO jso = (MyClassJSO) JavaScriptObject.createObject();

or

MyClassJSO jso = JavaScriptObject.createObject().cast();

or

MyClassJSO jso = MyClassJSO.createInstance();

public static native MyClassJSO createInstance() /*-{
    return new MyObjectFromJavaScript;//or whatever you need to do 
    //in JS to create the object
}-*/;

Upvotes: 2

Related Questions