Tuesday, November 15, 2016

Class cast problem

Hi 
I have two JsNative classes:

@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public abstract class ArrayBuffer {...}

and

@JsType(isNative = true)
public interface JSObject {
@SuppressWarnings("unchecked")
@JsOverlay
default <T extends JSObject> T cast() {
return (T) this;
}
}


and I have a native (XHR result) js method that is declared so that it returns JSObject
And then I cast it to ArrayBuffer and I got a runtime exception.

Shouldn't the type checking be disabled for isNative @JsType ?

Thanks


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment