Unwrap Kotlin inline value classes return values
The result returned by Kotlin reflective invocation of a function returning an inline value class is wrapped, which makes sense from Kotlin POV but from a JVM perspective the associated value and type should be unwrapped to be consistent with what would happen with a reflective invocation done by Java. This commit unwraps such result. Closes gh-33026
This commit is contained in:
@@ -205,6 +205,13 @@ class InvocableHandlerMethodKotlinTests {
|
||||
assertHandlerResultValue(result, "1")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun valueClassReturnValue() {
|
||||
val method = ValueClassController::valueClassReturnValue.javaMethod!!
|
||||
val result = invoke(ValueClassController(), method,)
|
||||
assertHandlerResultValue(result, "foo")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun valueClassWithDefaultValue() {
|
||||
this.resolvers.add(stubResolver(null, Double::class.java))
|
||||
@@ -376,6 +383,9 @@ class InvocableHandlerMethodKotlinTests {
|
||||
fun valueClass(limit: LongValueClass) =
|
||||
"${limit.value}"
|
||||
|
||||
fun valueClassReturnValue() =
|
||||
StringValueClass("foo")
|
||||
|
||||
fun valueClassWithDefault(limit: DoubleValueClass = DoubleValueClass(3.1)) =
|
||||
"${limit.value}"
|
||||
|
||||
@@ -420,6 +430,9 @@ class InvocableHandlerMethodKotlinTests {
|
||||
|
||||
data class Animal(override val name: String) : Named
|
||||
|
||||
@JvmInline
|
||||
value class StringValueClass(val value: String)
|
||||
|
||||
@JvmInline
|
||||
value class LongValueClass(val value: Long)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user