Monday, November 6, 2017

Problem writing module-info.java for gwt modules using jsinterop

hi,

I'm moving a maven java/gwt multi-modules project to java 9 and would like to write module-info.java files also for gwt modules (why not?).

I'm using GWT 2.8.2. Since it doesn't provide java 9 modules info, I need to rely on automatic module names. I wrote my module-info.java as follow:

module my.gwt.module {
...
requires gwt
.user; // works
requires jsinterop
.annotations; // doesn't work
...
}

The java 9 compiler accepts this file without complaining (no "module not found" error so I guess it finds the modules). And it successfully compiles java files that only uses gwt.user. But compiling java files also using jsinterop fails with the following error:

package jsinterop.annotations is not visible
(package jsinterop.annotations is declared in the unnamed module, but module jsinterop.annotations does not read it)

Any idea why?

I found a workaround by adding a dependency to the jsinterop head snapshot in my pom (also declared the google snapshot repository):

<dependency>
 
<groupId>com.google.jsinterop</groupId>
 
<artifactId>jsinterop-annotations</artifactId>
 
<version>HEAD-SNAPSHOT</version>
</dependency>

and changing my module info to:

module my.gwt.module {
...
requires gwt
.user; // works
requires jsinterop
.annotations.HEAD.SNAPSHOT; // works
...
}

Then the java 9 compiler successfully compiles java files using jsinterop. But I would prefer not doing this.

Any better solution?

--
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment