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

Support for Kotlin value class in annotated services #5449

Merged
merged 1 commit into from Apr 3, 2024

Conversation

ikhoon
Copy link
Contributor

@ikhoon ikhoon commented Feb 7, 2024

Motivation:

The following error is raised when Kotlin value class is declared in the parameters of annotated services.

INFO: object is not an instance of declaring class
java.lang.IllegalArgumentException: object is not an instance of declaring class
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at kotlin.reflect.jvm.internal.calls.InlineClassAwareCaller.call(InlineClassAwareCaller.kt:135)
    at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:107)
    at kotlin.reflect.full.KCallables.callSuspend(KCallables.kt:56)
    at com.linecorp.armeria.internal.common.kotlin.ArmeriaCoroutineUtil$callKotlinSuspendingMethod$future$1.invokeSuspend(ArmeriaCoroutineUtil.kt:54)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:833)

See #5294 for the details.

Modifications:

Result:

@ikhoon ikhoon added this to the 1.28.0 milestone Feb 7, 2024
@ikhoon ikhoon added the defect label Feb 7, 2024
@ikhoon ikhoon marked this pull request as ready for review March 14, 2024 07:03
Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the late check 😅 Thanks for solving this @ikhoon ! 🙇 👍 🙇

@jrhee17 jrhee17 merged commit d71803d into line:main Apr 3, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kotlin annotated services don't support value classes with suspended methods
3 participants