Issue with GWT 2.9.0 and Annotations/Predicates emulation

275 views
Skip to first unread message

David Nouls

unread,
May 15, 2020, 11:00:19 AM5/15/20
to GWT Users
I'm in the process of trying out GWT  2.9.0 with a big project.

I noticed that for some reason I suddenly get errors about sources  java.lang.annotation.Annotation (also about Predicate) not being available.
I guess there was a big cleanup of the inherits in all the packages ? Did I miss that in the release note that it might impact me ? Or is this a regression that was missed ?

In my case I get this error because I am using gwt-jackson.



David Nouls

unread,
May 16, 2020, 6:00:54 AM5/16/20
to GWT Users
Compiling module com.swift.cloud.platform.multitenant.event.SerializationTest.JUnit
   Resolving com.fasterxml.jackson.annotation.JacksonAnnotation
      Found type 'com.fasterxml.jackson.annotation.JacksonAnnotation'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JacksonAnnotationsInside
      Found type 'com.fasterxml.jackson.annotation.JacksonAnnotationsInside'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonAnyGetter
      Found type 'com.fasterxml.jackson.annotation.JsonAnyGetter'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonAnySetter
      Found type 'com.fasterxml.jackson.annotation.JsonAnySetter'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonCreator
      Found type 'com.fasterxml.jackson.annotation.JsonCreator'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonCreator.Mode
      Found type 'com.fasterxml.jackson.annotation.JsonCreator.Mode'
         [ERROR] Unable to find class java/lang/Enum
Compiling module com.swift.cloud.platform.multitenant.event.SerializationTest.JUnit
   Resolving com.fasterxml.jackson.annotation.JacksonAnnotation
      Found type 'com.fasterxml.jackson.annotation.JacksonAnnotation'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JacksonAnnotationsInside
      Found type 'com.fasterxml.jackson.annotation.JacksonAnnotationsInside'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonAnyGetter
      Found type 'com.fasterxml.jackson.annotation.JsonAnyGetter'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonAnySetter
      Found type 'com.fasterxml.jackson.annotation.JsonAnySetter'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonCreator
      Found type 'com.fasterxml.jackson.annotation.JsonCreator'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonCreator.Mode
      Found type 'com.fasterxml.jackson.annotation.JsonCreator.Mode'
         [ERROR] Unable to find class java/lang/Enum
Compiling module com.swift.cloud.platform.multitenant.event.SerializationTest.JUnit
   Resolving com.fasterxml.jackson.annotation.JacksonAnnotation
      Found type 'com.fasterxml.jackson.annotation.JacksonAnnotation'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JacksonAnnotationsInside
      Found type 'com.fasterxml.jackson.annotation.JacksonAnnotationsInside'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonAnyGetter
      Found type 'com.fasterxml.jackson.annotation.JsonAnyGetter'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonAnySetter
      Found type 'com.fasterxml.jackson.annotation.JsonAnySetter'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonCreator
      Found type 'com.fasterxml.jackson.annotation.JsonCreator'
         [WARN] Unable to resolve interface java/lang/annotation/Annotation
   Resolving com.fasterxml.jackson.annotation.JsonCreator.Mode
      Found type 'com.fasterxml.jackson.annotation.JsonCreator.Mode'
         [ERROR] Unable to find class java/lang/Enum

Colin Alworth

unread,
May 19, 2020, 10:41:29 AM5/19/20
to GWT Users
Nothing should have changed here as far as I am aware - GWT itself continues to have emulation for Annotation, Enum, etc (Predicate doesnt seem to be listed in your error)

One change was made in .gwt.xml files with their inherits - the jsinterop-annotations jar no longer contains a .gwt.xml file, and so Core.gwt.xml no longer references it (nor did it need to to begin with).

Are you compiling with -strict, and if so, is this the entire log?

I just pulled https://github.com/nmorel/gwt-jackson/ and updated it to use gwt 2.9, and it seems to run its tests cleanly for the main gwt-jackson package, and after I also update guava, the whole build passes:
[INFO] Reactor Summary for gwt-jackson :: Extensions :: Guava 0.15.5-SNAPSHOT:
[INFO]
[INFO] gwt-jackson :: Extensions :: Guava ................. SUCCESS [ 35.796 s]
[INFO] gwt-jackson :: Extensions :: Objectify ............. SUCCESS [ 27.423 s]
[INFO] gwt-jackson :: Extensions :: Remote Logging ........ SUCCESS [ 22.288 s]
[INFO] gwt-jackson :: Examples ............................ SUCCESS [  0.241 s]
[INFO] gwt-jackson :: Examples :: Minimal ................. SUCCESS [ 11.884 s]
[INFO] gwt-jackson :: Examples :: Hello World ............. SUCCESS [ 15.610 s]
[INFO] gwt-jackson :: Examples :: GWTP .................... SUCCESS [ 17.687 s]
[INFO] gwt-jackson :: Examples :: Requestor ............... SUCCESS [ 19.848 s]
[INFO] gwt-jackson :: Examples :: RestyGWT ................ SUCCESS [ 16.277 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:47 min
[INFO] Finished at: 2020-05-19T09:36:53-05:00
[INFO] ------------------------------------------------------------------------


Changes I made to run this:

diff --git a/extensions/guava/pom.xml b/extensions/guava/pom.xml
index 99e928a..739b629 100644
--- a/extensions/guava/pom.xml
+++ b/extensions/guava/pom.xml
@@ -29,7 +29,7 @@
   <description>Extension to support Guava types like Optional or ImmutableSet</description>
 
   <properties>
-    <guava.version>19.0</guava.version>
+    <guava.version>29.0-jre</guava.version>
   </properties>
 
   <dependencies>
diff --git a/pom.xml b/pom.xml
index 8eb1f1d..6250ad4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,10 +86,10 @@
     <maven-deploy-plugin.version>2.8.1</maven-deploy-plugin.version>
     <maven-jar-plugin.version>2.4</maven-jar-plugin.version>
     <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
-    <gwt-maven-plugin.version>2.7.0</gwt-maven-plugin.version>
+    <gwt-maven-plugin.version>2.8.2</gwt-maven-plugin.version>
 
     <!-- Dependencies version -->
-    <gwt.version>2.7.0</gwt.version>
+    <gwt.version>2.9.0</gwt.version>
     <jackson.version>2.10.1</jackson.version>
     <javapoet.version>1.0.0</javapoet.version>
     <junit.version>4.12</junit.version>
@@ -201,6 +201,7 @@
             <testTimeOut>1000</testTimeOut>
             <!--Only required due to a GWT DateTimeFormat issue see https://github.com/gwtproject/gwt/issues/8259-->
             <extraJvmArgs>-Duser.timezone=UTC</extraJvmArgs>
+            <sourceLevel>1.8</sourceLevel>
           </configuration>
           <dependencies>
             <dependency>


So I don't think this is intrinsic to GWT 2.9.0 or gwt-jackson - can you verify that gwt-jackson itself doesn't have this issue for you?

The one "compiler mysteriously breaks" issue I'm aware of in GWT 2.9.0 is to do with gwt-unitCache not being removed when you change sourceLevel, but perhaps there is another case we are missing - you could try deleting this directory (it usually lives next to the war/ dir) and see if this resolves your issue. If so, we'd like a little more detail on how you ran your project before/after so that we can more completely solve this.

-Colin

David Nouls

unread,
May 28, 2020, 2:03:48 PM5/28/20
to GWT Users
Strange, just retried today and now the compile worked properly.

Thanks for the support!
--
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-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/d68d95cb-db98-43ed-97f6-4a1ce5eac1cb%40googlegroups.com.

Colin Alworth

unread,
May 28, 2020, 2:25:37 PM5/28/20
to GWT Users
Glad you solved yours! As another update, we've seen two other cases of something that looks sort of similar to this.

In one instance, there was a dependency in the project of an old version of jsinterop-annotations, instead of the expected 2.0.0 release.

In the other instance, the project was creating a massive "reflection cache" of all annotations - the two fixes are to either exclude the jsinterop annotations from the cache (abbreviated rant: a cache like this should be based on a whitelist, not a blacklist), or provide sources and a .gwt.xml file for the annotations.

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

David Nouls

unread,
May 29, 2020, 7:55:42 AM5/29/20
to GWT Users
I was too quick to declare victory. 

I did not realize that I was no longer building with GWT 2.9.0 due to a bad merge my pom was overwritten with 2.8.2 again.

But what you just wrote helped indeed. I was still using jsinterop-base 1.0.0-RC1 and jsinterop-annotations 1.0.0.

Thanks for the help once more. Now I have a second problem, this time with some generics that is accepted by javac or IntelliJ but GWTC seems to not support it.

Thomas Broyer

unread,
May 29, 2020, 10:21:54 AM5/29/20
to GWT Users

On Friday, May 29, 2020 at 1:55:42 PM UTC+2, David Nouls wrote:

Now I have a second problem, this time with some generics that is accepted by javac or IntelliJ but GWTC seems to not support it.

Same here (on a third-party lib that hasn't been maintained for nearly 2 years 😭)

Colin Alworth

unread,
May 29, 2020, 10:43:36 AM5/29/20
to GWT Users
We did see type inference issues in earlier builds of the JDT version that GWT uses, but after an update was done we thought that the issues were resolved.

Can you give an example so we can check to see if JDT has handled this in a later update that we can migrate to?

Colin Alworth

unread,
May 29, 2020, 10:44:46 AM5/29/20
to GWT Users

David Nouls

unread,
May 29, 2020, 11:01:49 AM5/29/20
to GWT Users
Sorry, I created a different topic since I did not want to mix 2 problems in one group chat.
Reply all
Reply to author
Forward
0 new messages