-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Fix handling value class with private constructor on proxy #32536
Fix handling value class with private constructor on proxy #32536
Conversation
Does it add overhead and is it worthy if it does? |
hmm, maybe so but i don't know how heavy it is... anyway, i think this private constructor issue is regression and should be fixed |
let me share my initial and rough investigation i wrote the following test code to measure invoking time by using Kotlin @Test
fun measure() {
val method =
CoroutinesUtilsTests::class.java.declaredMethods.first { it.name.startsWith("suspendingFunctionWithValueClass") }
println(measureNanoTime {
repeat(1_000_000) {
CoroutinesUtils.invokeSuspendingFunction(method, this, "foo", null)
}
})
} in and then, i executed the test five times on each of this is the results (unit: nano sec)
both execution time is around 1.3 sec or 2.7 sec, and there seems no big performance issue |
Problem
CoroutineUtils
andInvocableHandlerMethod
will throw exception when value class whose constructor is private is given likestacktrace
Solution
use
KCallablesJvm.setAccessible
before creating object to avoid the exceptionConcern
in this PR, i modified three places. those of them are same. is it better to extract them into a single method?