[Reflection] Use reference equality to determine that a callable reference is bound
It helps to avoid problems when receiver object implements structural equals violating the equality contract #KT-60709
This commit is contained in:
committed by
Space Team
parent
64f90f685d
commit
291d52820c
@@ -53,7 +53,7 @@ internal class KFunctionImpl private constructor(
|
||||
descriptor
|
||||
)
|
||||
|
||||
override val isBound: Boolean get() = rawBoundReceiver != CallableReference.NO_RECEIVER
|
||||
override val isBound: Boolean get() = rawBoundReceiver !== CallableReference.NO_RECEIVER
|
||||
|
||||
override val descriptor: FunctionDescriptor by ReflectProperties.lazySoft(descriptorInitialValue) {
|
||||
container.findFunctionDescriptor(name, signature)
|
||||
|
||||
@@ -47,7 +47,7 @@ internal abstract class KPropertyImpl<out V> private constructor(
|
||||
val boundReceiver
|
||||
get() = rawBoundReceiver.coerceToExpectedReceiverType(descriptor)
|
||||
|
||||
override val isBound: Boolean get() = rawBoundReceiver != CallableReference.NO_RECEIVER
|
||||
override val isBound: Boolean get() = rawBoundReceiver !== CallableReference.NO_RECEIVER
|
||||
|
||||
private val _javaField = lazy(PUBLICATION) {
|
||||
when (val jvmSignature = RuntimeTypeMapper.mapPropertySignature(descriptor)) {
|
||||
|
||||
Reference in New Issue
Block a user