Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native image issue #147

Closed
rafalg opened this issue Jun 16, 2023 · 4 comments · Fixed by #175
Closed

Native image issue #147

rafalg opened this issue Jun 16, 2023 · 4 comments · Fixed by #175
Labels
bug Something isn't working

Comments

@rafalg
Copy link

rafalg commented Jun 16, 2023

Hi,

Trying to run my app as an native image. However get this issue:

java.lang.NoSuchFieldException: original at java.base@17.0.5/java.lang.Class.getDeclaredField(DynamicHub.java:961) at com.github.avrokotlin.avro4k.schema.SchemaForKt.schemaFor(SchemaFor.kt:170)
Is it a must for avro4k to use reflection?

@Chuckame
Copy link
Contributor

Hello,
It's a good question.
In fact, we should not use reflection since the core of using kotlinx serialization is to not have reflection. This line is about a tricks that unwrap a nullable field serializer to maybe get an internal avro serializer.

We are currently re thinking about the schema generation by fully using kotlinx serialization features.

It won't be that quick, so the quick answer is yes, and let's see in the future to not have reflection anymore.

@Chuckame
Copy link
Contributor

See #148

@Chuckame
Copy link
Contributor

Still using reflection with AvroSchema and AvroLogicalType. Waiting for the next kotlinx-serialization release that will include this PR to allow accessing the descriptor without reflection: Kotlin/kotlinx.serialization#2633

@Chuckame Chuckame reopened this Apr 22, 2024
@Chuckame
Copy link
Contributor

Chuckame commented May 3, 2024

Duplicate of #199

@Chuckame Chuckame marked this as a duplicate of #199 May 3, 2024
@Chuckame Chuckame closed this as completed May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants