Fabric API

Fabric API

112M Downloads

Incompatibility with Kotlin v2

gmitch215 opened this issue ยท 6 comments

commented

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

commented

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?

commented

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.

commented

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.

commented

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

commented

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

commented

๐Ÿ‘‹ 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.