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 Kotlin v2 #3788

Closed
gmitch215 opened this issue May 21, 2024 · 6 comments
Closed

Incompatibility with Kotlin v2 #3788

gmitch215 opened this issue May 21, 2024 · 6 comments
Labels
support Issues closed due to being a support request.

Comments

@gmitch215
Copy link

gmitch215 commented May 21, 2024

Dependabot PR on GitHub Actions reporting issues when upgrading from Kotlin 1.9.24 to 2.0.0.

A problem occurred configuring project ':socketmc-fabric'.
> Failed to notify project evaluation listener.
   > AssertionError (GSON 2.8.9): java.lang.IllegalAccessException: Can not set final java.util.Map field net.fabricmc.loom.configuration.providers.minecraft.ManifestVersion.latest to com.google.gson.internal.LinkedTreeMap
   > Cannot get MinecraftProvider before it has been setup

Tried rerunning it to see if it was something on my build, then tried rerunning it on the previous Kotlin version; the former failed and the latter succeeded, which might mean something changed in Kotlin v2. Pretty sure but not 100%.

Gradle File: here
Actions Logs: here

@modmuss50
Copy link
Member

modmuss50 commented May 21, 2024

I dont think this has anything to do with Kotlin, and is likely caused by an outdated gradle plugin (usually the foojay resolver), or an incorrect multi project setup.

@gmitch215
Copy link
Author

I dont think this has anything to do with Kotlin, and is likely caused by an outdated gradle plugin (usually the foojay resolver), or an incorrect multi project setup.

Don't see it in my Gradle Build; dunno what would be incorrect about the multi-project setup. It succeeds on previous Kotlin versions, so there might be something there.

@modmuss50
Copy link
Member

There is a Gradle bug that allows other Gradle plugins to pull in an older version of shared transitive dependenies such as gson.

You should make sure that you define all of your plugin versions in the root project, as documented here: https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl

@gmitch215
Copy link
Author

If that was true, why would it work on older Kotlin versions? The only thing that changed is the kotlin("jvm") plugin version - which doesn't even use Gson as a dependency - which is why this error is super weird. Even if that is the issue, why is K2 suddenly throwing a fit?

@modmuss50
Copy link
Member

Im not sure why this happens, this error happens when loom does not have the correct version of GSON on the classpath even though it correctly depends on a newer version.

FLK is building fine with Kotlin 2

@modmuss50 modmuss50 added the support Issues closed due to being a support request. label May 22, 2024
Copy link

👋 We use the issue tracker exclusively for final bug reports and feature requests. However, this issue appears to be better suited for either a discussion thread, or a message on our discord server. Please post your request on one of these, and the conversation can continue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Issues closed due to being a support request.
Projects
None yet
Development

No branches or pull requests

2 participants