Closed dankurka closed 9 years ago
I don't think JavaScriptObject will change, but maybe the new JsInterop allows this.
Reported by t.broyer
on 2014-06-02 08:47:00
A Java interface can only be implemented by one JavaScriptObject and this is very unlikely
to change.
The new JsInterop just consists of interfaces and there is no need for any implementation
of the interface for the JavaScript side, however you can have as many Java implementors
of the interface that you want.
I am marking this as FixedNotReleased since we are putting JsInterop out for trial
usage with GWT 2.7
Reported by dankurka@google.com
on 2014-10-08 06:50:38
FixedNotReleased
Reported by dankurka@google.com
on 2014-10-08 06:50:50
JSOs are backed by objects with potentially no runtime type or prototype, and so all
methods have to be effectively non-polymorphic. This is why there can't be two implementors
of an interface.
Consider how you'd write the Javascript for this:
interface Foo {
void m();
}
class FooImpl extends JavaScriptObject implements Foo {
native void m() /*-{ this.x(); }-*/;
}
class FooImpl2 extends JavaScriptObject implements Foo {
native void m() /*-{ this.y(); }-*/;
}
Foo f = ...
f.m();
Now, what JS is to be generated for the call to f.m()? Should it invokve f.x() or f.y()?
By inspecting only the 'f' object, how would the compiler generate a conditional to
invoke one or the other?
The new JsInterop solves this problem (although not all edge cases) because the assumption
is made that if a method m() exists on the interface, it must exist on the underlying
object. The compiler always writes out f.m().
Reported by cromwellian@google.com
on 2014-10-08 08:37:23
Bulk edit: Released since GWT 2.7.0 RC1
Reported by dankurka@google.com
on 2014-10-30 10:42:17
Fixed
Originally reported on Google Code with ID 8741
Reported by
Alexander.Luya
on 2014-05-31 01:43:46