You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
While running KotlinX serialization-equipped code in a GraalVM native image with given definition:
@Serializable
data classGCEInstanceMetadata(
valid:Long,
valname:String,
valhostname:String,
// ...
)
... this exception is raised at class-loading time, without invoking the serializer:
kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Unresolved class: class com.some.package.path.GCEInstanceMetadata$$serializer
at kotlin.reflect.jvm.internal.KClassImpl.reportUnresolvedClass(KClassImpl.kt:328)
at kotlin.reflect.jvm.internal.KClassImpl.access$reportUnresolvedClass(KClassImpl.kt:44)
at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:56)
at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:48)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:93)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:32)
at kotlin.reflect.jvm.internal.KClassImpl$Data.getDescriptor(KClassImpl.kt:48)
at kotlin.reflect.jvm.internal.KClassImpl.getDescriptor(KClassImpl.kt:182)
at kotlin.reflect.full.KClasses.getCompanionObject(KClasses.kt:48)
Obviously, one must include this class for reflection (as per #1125), so in my reflect-config.json, I have:
This reflection configuration is generated by the GraalVM agent. Is there anything missing that would preclude Kotlin from loading it via reflection?
Note that we are not actually using the serializer yet, this is actually reached just by trying to acquire a ::class reference which is marked @Serializable.
I can cross-file with GraalVM but I'm curious if the Kotlin team sees anything wrong with this agent-generated config. Maybe it's missing something simple.
To Reproduce
Will attach if needed
Expected behavior
Should load and reflect properly
Environment
Kotlin version: 1.7.20
Library version: 1.4.1
Kotlin platforms: JVM
Gradle version: 7.5.1
The text was updated successfully, but these errors were encountered:
Am I right that your issue is that this exception happens even if you explicitly add the $serializer class in the config?
I think the exception is raised on obtaining ::class reference because companion object info is needed for constructing KClass, but I can't say for sure with this short stacktrace.
I don't see any problems with GraalVM config, but @qwwdfsad has had more experience with it so he may have an idea.
@sandwwraith yes. for now we've avoided it by serializing these classes using Jackson which seems to work okay but we'll keep digging to find a root cause.
Describe the bug
While running KotlinX serialization-equipped code in a GraalVM native image with given definition:
... this exception is raised at class-loading time, without invoking the serializer:
Obviously, one must include this class for reflection (as per #1125), so in my
reflect-config.json
, I have:This reflection configuration is generated by the GraalVM agent. Is there anything missing that would preclude Kotlin from loading it via reflection?
Note that we are not actually using the serializer yet, this is actually reached just by trying to acquire a
::class
reference which is marked@Serializable
.I can cross-file with GraalVM but I'm curious if the Kotlin team sees anything wrong with this agent-generated config. Maybe it's missing something simple.
To Reproduce
Will attach if needed
Expected behavior
Should load and reflect properly
Environment
1.7.20
1.4.1
The text was updated successfully, but these errors were encountered: