The source of JavaScriptObject.cast()
looks like this:
public final <T extends JavaScriptObject> T cast() {
return (T) this;
}
So the answer is "yes", it is doing the same.
See:
题
Are the following JSNI wrapper classes doing the same?
public final MyClass extends JavaScriptObject {
// ...
private static MyClass createImpl() {
return (MyClass) JavaScriptObject.createObject();
}
}
and
public final MyClass extends JavaScriptObject {
// ...
private static MyClass createImpl() {
return JavaScriptObject.createObject().cast();
}
}
解决方案
The source of JavaScriptObject.cast()
looks like this:
public final <T extends JavaScriptObject> T cast() {
return (T) this;
}
So the answer is "yes", it is doing the same.
See: