I noticed what might be a potential Kotlin bug. I...
# gradle
c
I noticed what might be a potential Kotlin bug. I’m building a list of file paths for a Gradle task, and it blows up when configuration cache is enabled while using
buildList
with this error.
Copy code
Could not load the value of field `collection` of `kotlin.collections.builders.SerializedCollection` bean found in input property `$1` of task
Using
mutableList<String>().apply {...}
or
buildList{...}.toList()
is a workaround. Based on the error message, it sounds like
buildList
yields a non-serializable list while
mutableList
yields a serializable list. I’m reproduced using Gradle 8.2.1 and Kotlin 1.9.0 with config cache enabled. (I know Gradle 8.2.1 is using Kotlin 1.8.20 for build scripts, but Kotlin 1.9.0 enabled me to turn config cache on.)
e
oh I see you mentioned Gradle 8.2.1 and Kotlin 1.9.0. you're not using Kotlin 1.9.0 inside of a Gradle plugin, right? the embedded Kotlin version is 1.8.20 and anything else in buildscript classpath can cause issues
c
The Kotlin 1.9.0 gradle plugin is just visible so I can write convention plugins against it.
e
ok, then a binary convention plugin or a script plugin?
I'm not seeing an issue myself though
c
My reproduction case is in a private project, however this open source project is set up almost identically https://github.com/zcash/kotlin-bip39/tree/main/build-conventions-bip39 except for using an older version of Gradle and Kotlin.
e
ah, writing script plugins that apply KGP is problematic