GWT 2.8.0-rc1 issue (GWT 2.8.0-beta1 working)

175 views
Skip to first unread message

Teletin Alin

unread,
Aug 4, 2016, 10:40:20 AM8/4/16
to GWT Contributors
Hi,

I do have a problem since moving to rc1 related to a map object.
Using beta1 the code works ok, but with rc1 it yields "this.static$.animals.put is not a function".

Example code:

@JsNative(isNative = true, namespace="Example.com", name="Person")
public class Person{

        @JsProperty(name = "name")
        public String name;
        @JsProperty(name = "age")
        public int age;

        private Map<String, Animal> animals; //an extra property that is not found in javascript

        public native boolean isOld();

        @JsOverlay
        public final void buyAnimal(Animal animal){ // I don't know if it matters, but Animal object is also native as Person
                String animalName = animal.getName();
                animals.put(animalName, animal); // this fails with "this.static$.animals.put is not a function"
        }
}

The above code works fine when using beta1.
Is there some documentation related to differences between rc1 and beta1(at least related to jsinterop)?
What other changes should I make when moving to rc1?

My pom file contains:
...
<properties>
...
        <java.version>1.8</java.version>
        <gwt.version>2.8.0-rc1</gwt.version>
        <gwt.maven.plugin.version>2.8.0-SNAPSHOT</gwt.maven.plugin.version>
        <jsinterop.version>1.0.0-SNAPSHOT</jsinterop.version>
...
</properties>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.maven.plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<strict>true</strict>
<style>${gwt.style}</style>

<extraJvmArgs>-Xmx2048m -Xss1024k -XX:MaxPermSize=256m</extraJvmArgs>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<superDevMode>${superDevMode}</superDevMode>
<generateJsInteropExports>true</generateJsInteropExports>
<runTarget>...</runTarget>
<module>...</module>
<mode>htmlunit</mode>
</configuration>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>run</id>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>**/GwtTestSuite*.java</includes>
</configuration>
</execution>
</executions>
</plugin>
...
<dependencies>
...
        <!-- GWT -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
</dependency>
<dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-user</artifactId>
                <scope>provided</scope>
        </dependency>
        <dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<scope>provided</scope>
</dependency>
        <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-codeserver</artifactId>
                <scope>provided</scope>
        </dependency>
...
</dependencies>
...

Thank you,

Goktug Gokdogan

unread,
Aug 4, 2016, 3:33:04 PM8/4/16
to google-web-toolkit-contributors
I'm not sure what you mean by working fine. If animal doesn't exist in the object; it is expected to fail. Can you provide a full repro example?

--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/0d7bb6ac-a184-4c55-a6f0-f09af725a82a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thomas Broyer

unread,
Aug 4, 2016, 4:00:27 PM8/4/16
to GWT Contributors
Goktug: my reading of JsInterop is that @JsType(isNative=true) types shouldn't have non-annotated non-public members: either they're "mapped" properties and methods and should be public or annotated with @JsMethod or @JsProperty, or they're @JsOverlay methods; and there shouldn't be @JsIgnore'd members as well. If this is exact, then maybe the compiler should complain.
+1 for seeing a repro sample though, as the snippet wouldn't work anyway (to begin with, uses @JsNative instead of @JsType)

Goktug Gokdogan

unread,
Aug 4, 2016, 4:45:16 PM8/4/16
to google-web-toolkit-contributors
JsType(isNative=true) scenario (unfortunately) special that JsType applies to all members; not only public. Compiler complains if you add a JsIgnore'd member.

To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsu...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

Teletin Alin

unread,
Aug 7, 2016, 5:11:00 PM8/7/16
to GWT Contributors
First of all, thank you for your support.
 I have tried to create a repro example but unfortunately, I didn't succeed.
The issue has place in a project from my work and I can't put it here, so instead I have tried to create a sample project with the code that throws the issue.
For my surprise, the sample project works fine even if it is pretty the same with the original project which doesn't work.

I will put here the repro when I will have it.
Reply all
Reply to author
Forward
0 new messages