JsType(isNative=true) scenario (unfortunately) special that JsType applies to all members; not only public. Compiler complains if you add a JsIgnore'd member.
On Thu, Aug 4, 2016 at 1:00 PM, Thomas Broyer <[email protected]> wrote: > 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) > > > On Thursday, August 4, 2016 at 9:33:04 PM UTC+2, Goktug Gokdogan wrote: >> >> 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? >> >> On Thu, Aug 4, 2016 at 2:50 AM, Teletin Alin <[email protected]> >> wrote: >> >>> 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.v >>> ersion> >>> <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, >>> >>> -- >>> 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 [email protected] >>> . >>> To view this discussion on the web visit https://groups.google.com/d/ms >>> gid/google-web-toolkit-contributors/0d7bb6ac-a184-4c55-a6f0- >>> f09af725a82a%40googlegroups.com >>> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/0d7bb6ac-a184-4c55-a6f0-f09af725a82a%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > 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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/google-web-toolkit-contributors/44347e9e-13c2- > 4bc4-b063-5fdfa93cd478%40googlegroups.com > <https://groups.google.com/d/msgid/google-web-toolkit-contributors/44347e9e-13c2-4bc4-b063-5fdfa93cd478%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA2qEo%2BPdQTXn3SZCt80dwFummh%2BDomPvKqG8EaTp7TWhw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
