I've been using Configurate with Kotlin and encountered some issues. The extras-kotlin module mentions that it adds support for data classes. I assumed this meant normal Kotlin classes would be fully supported out of the box. However, when attempting to create configurations with normal Kotlin classes, the files are created but remain empty with no errors being present on the console.
I'm unsure if this behavior is intended or if I'm missing something in my setup.
Why I'm Not Using extra-kotlin:
I'm not using the extra-kotlin module because it depends on kotlin-reflect, which has known compatibility issues with Paper loaders. Additionally, shading kotlin-reflect properly into my project has been problematic.
Method Used to Create Configurations:
Here’s the method I use to create and load configurations:
private fun <T> create(clazz: Class<T>, fileName: String): T? {
try {
Files.createDirectories(dataFolder)
val path: Path = dataFolder.resolve(fileName)
val loader: YamlConfigurationLoader = loader(path)
val node: CommentedConfigurationNode = loader.load()
val config = node.get(clazz)
if (!Files.exists(path)) {
Files.createFile(path)
node.set(clazz, config)
}
loader.save(node)
return config
} catch (exception: IOException) {
exception.printStackTrace()
}
return null
}
Possible Cause:
I suspect the issue might be related to the object mapper since Kotlin has its own quirks compared to Java. If that's the case, the documentation should specify that the extra-kotlin module not only supports data classes but also provides full support for normal Kotlin classes.
Expected Behavior:
Normal Kotlin classes should be supported out of the box without requiring the extra-kotlin module.
If additional dependencies like kotlin-reflect are mandatory, this should be clarified in the documentation.
Let me know if I’m missing something or if this is unintended behavior.
PS: Since I usually don't express myself very well, this message was formatted by AI and rechecked after by me to make sure both parties understand it clearly.
I've been using Configurate with Kotlin and encountered some issues. The
extras-kotlin
module mentions that it adds support for data classes. I assumed this meant normal Kotlin classes would be fully supported out of the box. However, when attempting to create configurations with normal Kotlin classes, the files are created but remain empty with no errors being present on the console.I'm unsure if this behavior is intended or if I'm missing something in my setup.
Why I'm Not Using
extra-kotlin
:I'm not using the
extra-kotlin
module because it depends onkotlin-reflect
, which has known compatibility issues with Paper loaders. Additionally, shadingkotlin-reflect
properly into my project has been problematic.Method Used to Create Configurations:
Here’s the method I use to create and load configurations:
Possible Cause:
I suspect the issue might be related to the object mapper since Kotlin has its own quirks compared to Java. If that's the case, the documentation should specify that the
extra-kotlin
module not only supports data classes but also provides full support for normal Kotlin classes.Expected Behavior:
extra-kotlin
module.kotlin-reflect
are mandatory, this should be clarified in the documentation.Let me know if I’m missing something or if this is unintended behavior.
PS: Since I usually don't express myself very well, this message was formatted by AI and rechecked after by me to make sure both parties understand it clearly.