Check JvmRecordSupport language feature before generating synthetic properties

This commit is contained in:
Denis.Zharkov
2020-12-02 13:29:42 +03:00
parent a4bf36aee7
commit 695d0dbfbb
7 changed files with 37 additions and 11 deletions
@@ -33,9 +33,10 @@ class DebuggerFieldExpressionCodegenExtension : ExpressionCodegenExtension {
if (propertyDescriptor is JavaPropertyDescriptor) {
val containingClass = propertyDescriptor.containingDeclaration as? JavaClassDescriptor
if (containingClass != null) {
val correspondingGetter = JavaSyntheticPropertiesScope(LockBasedStorageManager.NO_LOCKS, LookupTracker.DO_NOTHING)
.getSyntheticExtensionProperties(listOf(containingClass.defaultType), NoLookupLocation.FROM_BACKEND)
.firstOrNull { it.name == propertyDescriptor.name }
val correspondingGetter =
JavaSyntheticPropertiesScope(LockBasedStorageManager.NO_LOCKS, LookupTracker.DO_NOTHING, supportJavaRecords = true)
.getSyntheticExtensionProperties(listOf(containingClass.defaultType), NoLookupLocation.FROM_BACKEND)
.firstOrNull { it.name == propertyDescriptor.name }
if (correspondingGetter != null) {
return c.codegen.intermediateValueForProperty(
@@ -49,4 +50,4 @@ class DebuggerFieldExpressionCodegenExtension : ExpressionCodegenExtension {
return null
}
}
}
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.synthetic.JavaSyntheticPropertiesScope
import org.jetbrains.kotlin.types.KotlinType
import java.lang.IllegalStateException
class DebuggerFieldKotlinIndicesHelperExtension : KotlinIndicesHelperExtension {
override fun appendExtensionCallables(
@@ -23,7 +22,8 @@ class DebuggerFieldKotlinIndicesHelperExtension : KotlinIndicesHelperExtension {
nameFilter: (String) -> Boolean,
lookupLocation: LookupLocation
) {
val javaPropertiesScope = JavaSyntheticPropertiesScope(LockBasedStorageManager.NO_LOCKS, LookupTracker.DO_NOTHING)
val javaPropertiesScope =
JavaSyntheticPropertiesScope(LockBasedStorageManager.NO_LOCKS, LookupTracker.DO_NOTHING, supportJavaRecords = true)
val fieldScope = DebuggerFieldSyntheticScope(javaPropertiesScope)
for (property in fieldScope.getSyntheticExtensionProperties(receiverTypes, lookupLocation)) {
@@ -41,4 +41,4 @@ class DebuggerFieldKotlinIndicesHelperExtension : KotlinIndicesHelperExtension {
) {
throw IllegalStateException("Should not be called")
}
}
}