cloud-kotlin-coroutines-annotations fails on Kotlin 2.4.0 with @Flag param
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 548
- Forks
- 60
- PR merge metrics
- No merged PRs in 30d
Description
This happens on executing the command:
java.lang.NoSuchFieldError: Class kotlin.reflect.KParameter$Kind does not have member field 'kotlin.reflect.KParameter$Kind CONTEXT'
at kotlin.reflect.jvm.internal.ReflectKCallableKt.computeAbsentArguments(ReflectKCallable.kt:96) ~[?:?]
at kotlin.reflect.jvm.internal.ReflectKCallableImpl$_absentArguments$1.invoke(ReflectKCallableImpl.kt:13) ~[?:?]
at kotlin.reflect.jvm.internal.ReflectKCallableImpl$_absentArguments$1.invoke(ReflectKCallableImpl.kt:13) ~[?:?]
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:70) ~[?:?]
at kotlin.reflect.jvm.internal.ReflectKCallableImpl.getAbsentArguments(ReflectKCallableImpl.kt:15) ~[?:?]
at kotlin.reflect.jvm.internal.ReflectKCallableKt.callDefaultMethod(ReflectKCallable.kt:133) ~[?:?]
at kotlin.reflect.jvm.internal.ReflectKCallableImpl.default$callBy(ReflectKCallableImpl.kt:70) ~[?:?]
at kotlin.reflect.jvm.internal.ReflectKCallableImpl.callBy(ReflectKCallableImpl.kt:10) ~[?:?]
at kotlin.reflect.full.KCallables.callSuspendBy(KCallables.kt:79) ~[?:?]
at org.incendo.cloud.kotlin.coroutines.annotations.KotlinAnnotatedMethodsKt$executeSuspendFunction$3.invokeSuspend(KotlinAnnotatedMethods.kt:316) ~[?:?]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[?:?]
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100) ~[?:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586) ~[?:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:829) ~[?:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717) ~[?:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704) ~[?:?]
Command declaration:
@Command("vnetwork trafficMonitor enable")
@ShortPerm("trafficMonitor")
fun enable(sender: User, @Flag("unit") unit: Unit = Unit.BIT) {
}
Kotlin compiler options:
kotlin {
compilerOptions {
jvmTarget.value(JvmTarget.fromTarget(javaVer.toString())) // JavaVersion.VERSION_11
// Remove Intrinsics checks
freeCompilerArgs.add("-Xno-call-assertions")
freeCompilerArgs.add("-Xno-receiver-assertions")
freeCompilerArgs.add("-Xno-param-assertions")
freeCompilerArgs.add("-java-parameters") // Fix cloud-annotations
}
}
This occurs on Kotlin 2.3.20 too, not a bug on Kotlin 2.3.10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the KotlinAnnotatedMethods.kt:316 stack-trace entry and reproduce the command declaration using Kotlin 2.3.20 and 2.4.0, comparing it with Kotlin 2.3.10. Done means the suspend command with the @Flag parameter executes without the NoSuchFieldError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 48/100