Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with the last version of truth #363

Closed
BraisGabin opened this issue Jul 26, 2023 · 1 comment
Closed

Incompatibility with the last version of truth #363

BraisGabin opened this issue Jul 26, 2023 · 1 comment

Comments

@BraisGabin
Copy link

I'm getting this exception after update the version of truth updates:

...
Caused by: java.lang.NoClassDefFoundError: com/google/common/collect/MoreCollectors
	at com.google.testing.compile.InMemoryJavaFileManager.findInMemoryInput(InMemoryJavaFileManager.java:134)
	at com.google.testing.compile.InMemoryJavaFileManager.findInMemoryInput(InMemoryJavaFileManager.java:121)
	at com.google.testing.compile.InMemoryJavaFileManager.getJavaFileForInput(InMemoryJavaFileManager.java:112)
	at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager.getJavaFileForInput(ClientCodeWrapper.java:287)
	at jdk.compiler/com.sun.tools.javac.code.ModuleFinder.getModuleInfoFromLocation(ModuleFinder.java:282)
	at jdk.compiler/com.sun.tools.javac.code.ModuleFinder.findModuleInfo(ModuleFinder.java:360)
	at jdk.compiler/com.sun.tools.javac.code.ModuleFinder.findAllModules(ModuleFinder.java:191)
	at jdk.compiler/com.sun.tools.javac.comp.Modules.getUnnamedModuleCompleter(Modules.java:1416)
	at jdk.compiler/com.sun.tools.javac.comp.Modules.setCompilationUnitModules(Modules.java:462)
	at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:267)
	at jdk.compiler/com.sun.tools.javac.comp.Modules.initModules(Modules.java:233)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.initModules(JavaCompiler.java:1041)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:939)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
	... 89 more

The last version of truth updates guava and I think that is the issue.

Here is the PR that shows this issue: SchwarzIT/dagger-lightsaber#3

@cpovirk
Copy link
Member

cpovirk commented Jul 26, 2023

Thanks. This is a general issue with any project that depends on guava-jre but also depends on a project that depends on guava-android :( The workaround is to declare a dependency on the newest version of guava-jre (currently 32.1.1-jre). (And then presumably Renovate will automatically keep you up to date with the latest guava-jre, preventing the problem from arising again, at least as long as you bump the Guava version each time before you bump the Truth version.)

We recently put some magic in place to make Gradle pick the right version automatically, but there's no similar solution for Maven.

It's possible that we can still make things better, either by releasing separate, Guava-style truth:1.1.6-android and truth:1.1.6-jre "versions" (which would be identical except for their Guava dep) or by making guava-android contain APIs like MoreCollectors. I'm hoping that we'll at least make some progress on the latter front later this year. You can follow google/guava#6567. Sorry for the ongoing trouble in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants