Skip to content
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

JsInterop properties can override parent properties in optimized mode #9623

Open
adrienbaron opened this issue Jul 25, 2018 · 1 comment
Open

Comments

@adrienbaron
Copy link

GWT version: 2.8.2
Browser (with version): Version 68.0.3440.75
Operating System: macOS Mojave 10.14 Beta (18A336e)


Description

@JsProperty properties might override parent class properties when the application is built in optimized mode.
It's possible that issue could be reproduced in Dev Mode, but it's less likely to happen, and would be less problematic.

Steps to reproduce

Create a Parent class:

public class Parent {
  String data = "PARENT";

  public void logData() {
    DomGlobal.console.log(data);
  }
}

Create a Child class that extends Parent and exposes a @JsProperty named a:

public class Child extends Parent {
  @JsProperty
  String a = "CHILD";
}

Then in your onModuleLoad call:

new Child().logData();

Build and run in optimized mode.

  • What is expected: "PARENT" logged in the console.
  • What happens: "CHILD" is logged in the console.
Known workarounds

Workaround implies naming @JsProperty with names that are "collision safe", so at least 4 characters, but this is not always possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants