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

Defender method bridges causes JsInterop checking errors #9440

Closed
gkdn opened this issue Oct 3, 2016 · 2 comments
Closed

Defender method bridges causes JsInterop checking errors #9440

gkdn opened this issue Oct 3, 2016 · 2 comments
Assignees

Comments

@gkdn
Copy link
Contributor

gkdn commented Oct 3, 2016

Repro:

@JsType(isNative = true, name = "ArrayLike", namespace = JsPackage.GLOBAL)
public interface ArrayLike<T> {

  @JsProperty
  int getLength();

  @JsProperty
  void setLength(int length);

  @JsOverlay
  default T getAt(int index) {
    return (T) JsUtils.getAt(this, index);
  }

  @JsOverlay
  default void setAt(int index, T value) {
    JsUtils.setAt(this, index, value);
  }
}

public abstract class JsArray<T> implements ArrayLike<T> {
}

Errors in jsinterop/base/ArrayLike.java
[ERROR] Line 21: JsOverlay method 'Object JsArray.getAt(int)' cannot be non-final nor native.
[ERROR] Line 26: JsOverlay method 'void JsArray.setAt(int, Object)' cannot be non-final nor native.

Note that also the error refers to JsArray.get listed under ArrayLike.

@rluble
Copy link
Contributor

rluble commented Oct 4, 2016

You missed an important piece of info out. JsArray is also native. The issue here does not have to do with traditional bridges but with the implementation strategy of default methods.

There is an assertion in JsInteropRestrictionChecker but the test might not be running with -ea.

I'll have a look.

@rluble
Copy link
Contributor

rluble commented Oct 4, 2016

Code review at https://gwt-review.googlesource.com/17140

@rluble rluble closed this as completed Oct 6, 2016
korzha pushed a commit to korzha/gwt that referenced this issue Oct 14, 2016
Native classes implementing interfaces with overlays triggerred a compiler
error due to the fact that overlays in native intefaces are "default"
methods and that the strategy of implementing them consists in creating
the corresponding synthetic override in classes that don't explicitly
implement the method.

Bug: #9440
Bug-Link: gwtproject/gwt#9440
Change-Id: I30a100c4d83f13df61fed57a54afb3b25a153250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants