kotlinx.serialization
kotlinx.serialization copied to clipboard
SerialInfo annotation: Default parameters in custom annotation cause compiler exception
Describe the bug
I'm using custom annotation @YamlComment annotated with @SerialInfo. If @YamlComment annotation contains default parameters compiler will throw an error
To Reproduce
@Target(AnnotationTarget.PROPERTY)
@SerialInfo
public annotation class YamlComment(
val comment: String,
val trimIndent: Boolean = false // Throws an error
)
Environment
- Kotlin version: 1.6.21
- Library version: Plugin: 1.6.21, SerializationCore: 1.3.3
- Kotlin platforms: JVM
- Gradle version: 7.4.2
- Other relevant context: JDK 8 is used for project code, JDK 11 is used for Gradle
This specific case seems to be fixed in 1.7, but it's broken when the first parameter is vararg :/
I've opened KT-53235 on YouTrack for this issue
Hi!
As I understand it, default parameters are still not supported? I have such a case - it does not build with caches for JVM and strange problems in Kotlin/Native
https://youtrack.jetbrains.com/issue/KT-53475/KotlinNative-for-iOS-IllegalArgumentException-Sequence-has-more-than-one-element
Seems to be fixed in the latest release (or in Kotlin 1.8.0).