Tuesday, May 12, 2020

Re: JsInterop - fail to iterate @JsType in List

So I updated my sample project to remove the try/catch so it will throw the JavaScriptException

Logger.getLogger("").info("direct call: " + Car.car.start());
List<Car> cars = Arrays.asList(Car.car);
for (Car car : cars) {
  car.start();
}
Logger.getLogger("").info("It never goes here!!");

So here is the code that I've just deployed: https://github.com/freddyboucher/gwt-storage-objectify/commit/b0ad562f86deb09ee6bf556b32798116e627f347
And you can experience the issue here: https://jsinterop-dot-gwt-storage-objectify.appspot.com/?compiler.stackMode=emulated


On Tuesday, May 12, 2020 at 5:33:22 PM UTC+10, Freddy Boucher wrote:
Hi @Jens

Can be project referring to my package name?
But I confirm the log is correct and it's produced by this exact sample

package com.project.client;

import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;

@JsType(isNative = true)
public class Car {
 @JsProperty(namespace = JsPackage.GLOBAL) public static Car car;

  public native String start();
}




On Tuesday, May 12, 2020 at 5:28:27 PM UTC+10, Jens wrote:

But it fails with the following logs:
direct call: start
ConsoleLogger.java:33 FAILED to iterate a @JsType in a List
ConsoleLogger.java:55 Exception: com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 'project' of undefined
ConsoleLogger.java:33 TypeError: Cannot read property 'project' of undefined
at dse_g$ (App.java:75)
at tse_g$.use_g$ [as execute_1_g$] (App.java:66)

Where does 'project' come from? Looks like the exception does not match the example code?

-- J. 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/ab1463b1-3232-4920-b9f8-ba3d971766e7%40googlegroups.com.

No comments:

Post a Comment