RaiMan / SikuliX1

SikuliX version 2.0.0+ (2019+)
https://sikulix.github.io
MIT License
2.78k stars 356 forks source link

NoSuchMethodError due to use Guava 20.0 #260

Closed DavidPerezIngeniero closed 4 years ago

DavidPerezIngeniero commented 4 years ago

When running Sikuli API 2.0.1, in a Linux environment with Java 1.8.0.222 I get this error:

java.lang.NoSuchMethodError ( java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.toImmutableList()Ljava/util/stream/Collector; )

It looks like this is due to using Google Guava 20.0 instead of 21.0.

RaiMan commented 4 years ago

what about a stacktrace?

DavidPerezIngeniero commented 4 years ago

Thanks for your help. Maybe bug https://github.com/RaiMan/SikuliX1/issues/258 prevents me from getting a stack trace. Confirmed if I use Guava 21.0, then this problem disappears.

balmma commented 4 years ago

Guava 20.0 is a transitive dependency of org.reflections 0.9.11 and seems to cause problems in various projects.

There is even an open issue in the org.reflections project:

https://github.com/ronmamo/reflections/issues/194

There also is an open PR to remove Guava from org.reflections, but this will take some time to find its way into a new version:

https://github.com/ronmamo/reflections/pull/271

Easiest mitigation seems to be to downgrade org.reflections to 0.9.10 until a new version is available. 0.9.10 uses Guava 15.0 which seems to be much more compatible to future versions.

balmma commented 4 years ago

Or probably it would be even better to use the following dependency which is a fork of org.reflections and doesn't use Guava at all (instead min. required Java version is 8 which is fine for SikuliX):

<dependency>
    <groupId>net.oneandone.reflections8</groupId>
    <artifactId>reflections8</artifactId>
    <version>0.11.6</version>
</dependency>
balmma commented 4 years ago

Should be fixed with PR #264 .

DavidPerezIngeniero commented 4 years ago

Thanks Matthias!

RaiMan commented 4 years ago

@balmma Thanks also. I really had no idea.

RaiMan commented 4 years ago

@DavidPerezIngeniero the fixes related to your latest 2 issues are available in the nightly build 2.1.0 (if you want to check) and will be available in 2.0.2 around year end

DavidPerezIngeniero commented 4 years ago

Thanks RaiMan. Confirmed that version 2.1.0-SNAPSHOT works better than 2.0.1!. :-)