mirror of
https://github.com/corda/corda.git
synced 2024-12-19 21:17:58 +00:00
Vanja's fix for Kotlin reflection in GraalVM
This commit is contained in:
parent
8fa7efd867
commit
03215baa39
@ -5,6 +5,7 @@ import net.corda.core.internal.isConcreteClass
|
||||
import net.corda.core.internal.kotlinObjectInstance
|
||||
import net.corda.core.serialization.ConstructorForDeserialization
|
||||
import net.corda.core.serialization.DeprecatedConstructorForDeserialization
|
||||
import net.corda.core.utilities.SgxSupport
|
||||
import net.corda.serialization.internal.NotSerializableDetailedException
|
||||
import net.corda.serialization.internal.amqp.*
|
||||
import net.corda.serialization.internal.model.LocalTypeInformation.Abstract
|
||||
@ -488,15 +489,17 @@ internal data class LocalTypeInformationBuilder(val lookup: LocalTypeLookup,
|
||||
|
||||
private fun Method.returnsNullable(): Boolean = try {
|
||||
val returnTypeString = this.declaringClass.kotlin.memberProperties.firstOrNull {
|
||||
it.javaGetter == this
|
||||
}?.returnType?.toString() ?: "?"
|
||||
it.javaGetter == this || run {
|
||||
val getterName = it.getter.name.replace("_", "")
|
||||
(SgxSupport.isInsideEnclave && this.name == getterName.substringBefore("-").replace("<", "") + getterName.substringAfter("-")
|
||||
.capitalize().replace(">", ""))
|
||||
}
|
||||
}
|
||||
|
||||
returnTypeString.endsWith('?') || returnTypeString.endsWith('!')
|
||||
returnTypeString?.returnType?.isMarkedNullable ?: true
|
||||
} catch (e: KotlinReflectionInternalError) {
|
||||
// This might happen for some types, e.g. kotlin.Throwable? - the root cause of the issue
|
||||
// is: https://youtrack.jetbrains.com/issue/KT-13077
|
||||
// TODO: Revisit this when Kotlin issue is fixed.
|
||||
|
||||
// is: https://youtrack.jetbrains.com/issue/KT-13077 // TODO: Revisit this when Kotlin issue is fixed.
|
||||
true
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user