-
Notifications
You must be signed in to change notification settings - Fork 221
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
Error NoSuchMethodError com.google.common.collect.ImmutableMap #1140
Comments
Interesting, because according to https://mvnrepository.com/artifact/com.lemonappdev/konsist/0.13.0 there's no Guava dep there. Anyway, since the error is coming from guava related classes. I still recommend looking at the issue with the process I did here: #906 Also make sure that without that dependency (and no other changes) the tests actually work, to prevent unnecessary investigation related to Konsist. Would you be able to provide a minimal repro? (e.g. one where uncommenting a line produces this behavior) |
Thanks for your comment. But in my case it is more complex project and we use some additional dependencies. |
@TWiStErRob I did some more investigation and it seems that To reproduce error you can checkout the branch: https://github.com/PMiarka/paparazzi/tree/bug/1140_konsist_incompatibiltiy uncomment java.lang.NoSuchMethodError: 'com.google.common.collect.ImmutableMap com.google.common.collect.ImmutableMap$Builder.buildOrThrow()' |
Had a quick look, and I can confirm that depInsight is the same w/o coroutines. I noticed that I will have a look tomorrow, but my hunch is that there's a non-repackaged version somewhere. I'm planning to debug the class/jar file location w/o coroutines. |
I executed this: gradlew :sample:testDUT --tests ComposeA11yTest --rerun --debug-jvm Then added a breakpoint at java.util.Arrays.asList(
com.google.common.collect.SparseImmutableTable.class.getProtectionDomain().getCodeSource().getLocation(),
com.google.common.collect.ImmutableMap.Builder.class.getProtectionDomain().getCodeSource().getLocation()
) and got:
😮 I diffed As for workaround for your crash, I'm not sure what to do, you can try these long shots:
|
This is related to the Truth/Guava issue referenced here: #1206 Applying this workaround in |
@jrodbx for me the workaround did not fix the issue. Did you uncomment the coroutines line as described here: #1140 (comment)? But, anyway, it's fair to close this as we cannot do anything here, konsist needs to be fixed. I would also recommend stop using konsist until it uses kotlin-compiler-embeddable as JetBrains resolved the issue with that recommendation. Or create a separate module for architectural or screenshot tests. |
Thanks for you time. I really appreciate it! I completely agree that it is fair to close this issue. You guys do awesome work, thanks for paparazzi! :) |
@PMiarka Can you try if this works for you at runtime when running konsist? configurations.all {
// https://docs.gradle.org/current/userguide/resolution_rules.html#sec:dependency_substitution_rules
resolutionStrategy.dependencySubstitution {
substitute(module("org.jetbrains.kotlin:kotlin-compiler"))
.using(module("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.9.10"))
}
} |
I verified it and it works!
Big kudos for you help! |
No, I did not. I only followed the OP's repro steps (added |
Hey All Let me drop an update here as Konsist maintainer. First of all this is quite impressive investigation 👏👏👏 I was able to replace Artifact is public, however snapshots repo has to be added to the project. The version 0.15.0-SNAPSHOT contains the fix (see PR for more details). BTW I was not aware of this issue for some time. It’s always good to repost such problems to Konsist slack channel, start new GitHub discussion at Konsist repo or just tag me to make things smoother in the future ;-) |
@igorwojda I've tested it with: Index: sample/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/sample/build.gradle b/sample/build.gradle
--- a/sample/build.gradle (revision 85696ae12ec4bae38b2cbec20c76a7324056422c)
+++ b/sample/build.gradle (date 1710966933236)
@@ -24,11 +24,18 @@
}
}
+repositories {
+ maven { name = "Sonatype 01"; url = "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
+}
+
dependencies {
+ api libs.guava
implementation libs.composeUi.material
implementation libs.composeUi.uiTooling
testImplementation libs.testParameterInjector
+ testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
+ testImplementation("com.lemonappdev:konsist:XXX")
}
// https://github.com/diffplug/spotless/issues/1572
However the results are not fully conclusive, because 0.15.0 changes the dependency tree and therefore result in a different ordering. The relative order of konsist, guava, kotlin-compiler and other deps have changed, but I can confirm that |
Description
A clear and concise description of what the bug is.
Steps to Reproduce
testImplementation("com.lemonappdev:konsist:0.13.0")
error:
Similar problem but probably caused by the same reason I face in my personal project, but there the error is:
java.lang.NoSuchMethodError at SparseImmutableTable.java:85
Expected behavior
recordParaprazziDebug works as normal
Additional information:
Basing on research it is related to guava version.
I tried to exclude from konsist guava, but it do not work.
Are there any other options to fix it?
The text was updated successfully, but these errors were encountered: