Support fake Java property overrides in function equality in bridges
A synthetic property descriptor created for `B.value` (see the added test) should not be equal to the normal descriptor created by the fake override construction algorithm. Otherwise we can't reach this synthetic non-abstract descriptor when building bridges in `C`, which results in exception. #KT-31367 Fixed
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.load.java.descriptors
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
|
||||
class JavaForKotlinOverridePropertyDescriptor(
|
||||
ownerDescriptor: ClassDescriptor,
|
||||
getterMethod: SimpleFunctionDescriptor,
|
||||
setterMethod: SimpleFunctionDescriptor?,
|
||||
overriddenProperty: PropertyDescriptor
|
||||
) : JavaPropertyDescriptor(
|
||||
ownerDescriptor,
|
||||
Annotations.EMPTY,
|
||||
getterMethod.modality,
|
||||
getterMethod.visibility,
|
||||
setterMethod != null,
|
||||
overriddenProperty.name,
|
||||
getterMethod.source,
|
||||
null,
|
||||
CallableMemberDescriptor.Kind.DECLARATION,
|
||||
false,
|
||||
null
|
||||
)
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
||||
@Nullable
|
||||
private final Pair<UserDataKey<?>, ?> singleUserData;
|
||||
|
||||
private JavaPropertyDescriptor(
|
||||
protected JavaPropertyDescriptor(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull Annotations annotations,
|
||||
@NotNull Modality modality,
|
||||
|
||||
+1
-5
@@ -514,11 +514,7 @@ class LazyJavaClassMemberScope(
|
||||
"for getter is ${getterMethod.modality}, but for setter is ${setterMethod?.modality}"
|
||||
}
|
||||
|
||||
val propertyDescriptor = JavaPropertyDescriptor.create(
|
||||
ownerDescriptor, Annotations.EMPTY, getterMethod.modality, getterMethod.visibility,
|
||||
/* isVar = */ setterMethod != null, overriddenProperty.name, getterMethod.source,
|
||||
/* isStaticFinal = */ false
|
||||
)
|
||||
val propertyDescriptor = JavaForKotlinOverridePropertyDescriptor(ownerDescriptor, getterMethod, setterMethod, overriddenProperty)
|
||||
|
||||
propertyDescriptor.setType(getterMethod.returnType!!, listOf(), getDispatchReceiverParameter(), null)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user