-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@JsProperty method access is optimised to function call in abstract native jstype #9358
Comments
Passing --generateJsInteropExports? |
No but all of the types involved have |
That's correct you shouldn't need it if you are calling a isNative=true method from Java. |
Yes, that example uses the latest snapshots. There are really only these two classes + Errai, but I will try and make a smaller reproducer. |
Thanks for the smaller repro. @rluble This might be something around accident overrides; not sure. |
I'll have a look but I think your diagnostic is spot on. Because it is declared abstract the explicit stub created by the accidental override is probably not inheriting JsInfo. |
A sketch of a fix is in https://gwt-review.googlesource.com/#/c/15093. |
JsMember information is inherited from overriden methods and pruning any of these overridden methods might cause the compiler to "forget" that a JsMethod/JsProperty is a JsMethod/JsProperty. This is the correct behaviour in most cases (as only if -nogenerateJsInteropExports those overriden members are pruned), except for the case of native JsMethods. This patch makes methods and fields that can be implemented externally live. Bug: gwtproject#9358 Bug-Link: http://github.com/gwtproject/gwt/issues/9358 Change-Id: I80637883849af5d99542f8d0bc35c3e5b895a9e1
In some cases, methods annotated with
@JsProperty
on a native@JsType
are optimized to obfuscated function calls in a full compile.Here is a reproducer for the problem. To see the issue, checkout the linked project and do a full compile (mvn clean package), then deploy the war file, and load the host page in Chrome. When you load the host page, you should see the message that calling
getTextContent
has failed and see a stack trace in the console where an obfuscated function was called rather than a property access totextContent
. If you compile the project with optimization level 0, the property access works as expected.Strangely enough, the problem goes away if I add a call to
getTextContent
on anAnchor
field (see here).I spent some time trying to simplify this project, but was unable to reproduce the problem in a project without Errai.
The text was updated successfully, but these errors were encountered: