Unsure if this is a gradle issue or a <#C7L3JB43G|...
# gradle
s
Unsure if this is a gradle issue or a #compiler issue, but I'm trying to get a data class compiled with java parameter metadata for some reflection stuff on the java side of a mixed java/kotlin project. I've added this block to the subproject's
build.gradle.kts
Copy code
kotlin {
  compilerOptions {
    javaParameters = true
  }
}
but at runtime (or at least, during an integration test), when I inspect the class's
declaredConstructors
, the all-args constructor has no parameter metadata—`constructor.getParameters()` returns
null
. I'm not sure if this is some kind of issue with multi-project gradle projects, if I'm not setting
javaParameters
in the correct place, or if that flag just doesn't do what I need it to. the kotlin plugin is being added with this line
Copy code
kotlin("jvm") version("1.9.20") apply(false)
After some more debugging, it seems like this is working as expected, but as it would turn out, the constructors you get from
getDeclaredConstructors()
and
getConstructors()
are not the same, and the former does not include parameter metadata for some reason
Nope... that wasn't quite it—turns out that kotlin classes include an extra constructor in the reflection metadata... one that includes all the declared parameters, plus an
int
and a
kotlin.jvm.internal.DefaultConstructorMarker
💀. This constructor doesn't include any parameter metadata (and I can't use it anyhow)
👌 1