diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java index 66fc2bd0df8..6de2e1a90d2 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java @@ -4118,6 +4118,12 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn runTest("compiler/testData/codegen/boxInline/simple/funImportedFromObject.kt"); } + @Test + @TestMetadata("importedJavaStaticField.kt") + public void testImportedJavaStaticField() throws Exception { + runTest("compiler/testData/codegen/boxInline/simple/importedJavaStaticField.kt"); + } + @Test @TestMetadata("inlineCallInInlineLambda.kt") public void testInlineCallInInlineLambda() throws Exception { diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/DescriptorByIdSignatureFinder.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/DescriptorByIdSignatureFinder.kt index 7ccaeb565f5..dbe3945f25a 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/DescriptorByIdSignatureFinder.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/DescriptorByIdSignatureFinder.kt @@ -117,8 +117,8 @@ class DescriptorByIdSignatureFinder( if (isConstructorName(current)) addAll(classDescriptor.constructors) addAll(memberScope.getContributedFunctions(current, NoLookupLocation.FROM_BACKEND)) addAll(memberScope.getContributedVariables(current, NoLookupLocation.FROM_BACKEND)) - addAll(classDescriptor.staticScope.getContributedDescriptors { it == current }) } + addAll(classDescriptor.staticScope.getContributedDescriptors().filter { it.name == current }) } } } diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrBodyDeserializer.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrBodyDeserializer.kt index 25aa2aa00a5..7c7b4994de6 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrBodyDeserializer.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrBodyDeserializer.kt @@ -443,7 +443,7 @@ class IrBodyDeserializer( val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null val superQualifier = if (access.hasSuper()) { - declarationDeserializer.deserializeIrSymbolAndRemap(access.symbol) as IrClassSymbol + declarationDeserializer.deserializeIrSymbolAndRemap(access.`super`) as IrClassSymbol } else null val receiver = if (access.hasReceiver()) { deserializeExpression(access.receiver) @@ -549,7 +549,7 @@ class IrBodyDeserializer( val access = proto.fieldAccess val symbol = declarationDeserializer.deserializeIrSymbolAndRemap(access.symbol) as IrFieldSymbol val superQualifier = if (access.hasSuper()) { - declarationDeserializer.deserializeIrSymbolAndRemap(access.symbol) as IrClassSymbol + declarationDeserializer.deserializeIrSymbolAndRemap(access.`super`) as IrClassSymbol } else null val receiver = if (access.hasReceiver()) { deserializeExpression(access.receiver) diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt index b686bb34adb..987cf948c0b 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt @@ -361,7 +361,9 @@ open class IrFileSerializer( is IrReturnableBlockSymbol -> BinarySymbolData.SymbolKind.RETURNABLE_BLOCK_SYMBOL is IrFieldSymbol -> - if (symbol.owner.correspondingPropertySymbol?.owner.let { it == null || it.isDelegated }) + if (symbol.owner.correspondingPropertySymbol?.owner.let { + it == null || it.isDelegated || it.getter == null && it.setter == null + }) BinarySymbolData.SymbolKind.STANDALONE_FIELD_SYMBOL else BinarySymbolData.SymbolKind.FIELD_SYMBOL diff --git a/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/deserializeLazyDeclarations.kt b/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/deserializeLazyDeclarations.kt index 8c382f91c87..54ab9daf68b 100644 --- a/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/deserializeLazyDeclarations.kt +++ b/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/deserializeLazyDeclarations.kt @@ -164,7 +164,8 @@ private fun referencePublicSymbol( BinarySymbolData.SymbolKind.CLASS_SYMBOL -> referenceClass(descriptor as ClassDescriptor) BinarySymbolData.SymbolKind.CONSTRUCTOR_SYMBOL -> referenceConstructor(descriptor as ClassConstructorDescriptor) BinarySymbolData.SymbolKind.ENUM_ENTRY_SYMBOL -> referenceEnumEntry(descriptor as ClassDescriptor) - BinarySymbolData.SymbolKind.STANDALONE_FIELD_SYMBOL -> referenceField(descriptor as PropertyDescriptor) + BinarySymbolData.SymbolKind.STANDALONE_FIELD_SYMBOL, BinarySymbolData.SymbolKind.FIELD_SYMBOL + -> referenceField(descriptor as PropertyDescriptor) BinarySymbolData.SymbolKind.FUNCTION_SYMBOL -> referenceSimpleFunction(descriptor as FunctionDescriptor) BinarySymbolData.SymbolKind.TYPEALIAS_SYMBOL -> referenceTypeAlias(descriptor as TypeAliasDescriptor) BinarySymbolData.SymbolKind.PROPERTY_SYMBOL -> referenceProperty(descriptor as PropertyDescriptor) @@ -175,7 +176,8 @@ private fun referencePublicSymbol( BinarySymbolData.SymbolKind.CLASS_SYMBOL -> referenceClassFromLinker(idSig) BinarySymbolData.SymbolKind.CONSTRUCTOR_SYMBOL -> referenceConstructorFromLinker(idSig) BinarySymbolData.SymbolKind.ENUM_ENTRY_SYMBOL -> referenceEnumEntryFromLinker(idSig) - BinarySymbolData.SymbolKind.STANDALONE_FIELD_SYMBOL -> referenceFieldFromLinker(idSig) + BinarySymbolData.SymbolKind.STANDALONE_FIELD_SYMBOL, BinarySymbolData.SymbolKind.FIELD_SYMBOL + -> referenceFieldFromLinker(idSig) BinarySymbolData.SymbolKind.FUNCTION_SYMBOL -> referenceSimpleFunctionFromLinker(idSig) BinarySymbolData.SymbolKind.TYPEALIAS_SYMBOL -> referenceTypeAliasFromLinker(idSig) BinarySymbolData.SymbolKind.PROPERTY_SYMBOL -> referencePropertyFromLinker(idSig) diff --git a/compiler/testData/codegen/boxInline/simple/importedJavaStaticField.kt b/compiler/testData/codegen/boxInline/simple/importedJavaStaticField.kt new file mode 100644 index 00000000000..559c6c7e5ac --- /dev/null +++ b/compiler/testData/codegen/boxInline/simple/importedJavaStaticField.kt @@ -0,0 +1,12 @@ +// TARGET_BACKEND: JVM_IR +// WITH_RUNTIME +// FILE: 1.kt +import java.util.Locale + +inline fun inlineFun(): String { + val root = Locale.ROOT + return "OK" +} + +// FILE: 2.kt +fun box() = inlineFun() \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java index 34c2354822b..032b7b3cb33 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java @@ -4118,6 +4118,12 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/simple/funImportedFromObject.kt"); } + @Test + @TestMetadata("importedJavaStaticField.kt") + public void testImportedJavaStaticField() throws Exception { + runTest("compiler/testData/codegen/boxInline/simple/importedJavaStaticField.kt"); + } + @Test @TestMetadata("inlineCallInInlineLambda.kt") public void testInlineCallInInlineLambda() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index 4722ac1e7d9..2c7fade71e5 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -4118,6 +4118,12 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/simple/funImportedFromObject.kt"); } + @Test + @TestMetadata("importedJavaStaticField.kt") + public void testImportedJavaStaticField() throws Exception { + runTest("compiler/testData/codegen/boxInline/simple/importedJavaStaticField.kt"); + } + @Test @TestMetadata("inlineCallInInlineLambda.kt") public void testInlineCallInInlineLambda() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java index f9ee9ed142f..ce1f509f64c 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -4016,6 +4016,12 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab runTest("compiler/testData/codegen/boxInline/simple/funImportedFromObject.kt"); } + @Test + @TestMetadata("importedJavaStaticField.kt") + public void testImportedJavaStaticField() throws Exception { + runTest("compiler/testData/codegen/boxInline/simple/importedJavaStaticField.kt"); + } + @Test @TestMetadata("inlineCallInInlineLambda.kt") public void testInlineCallInInlineLambda() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java index 08ad06707a7..9be803d391b 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java @@ -4118,6 +4118,12 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO runTest("compiler/testData/codegen/boxInline/simple/funImportedFromObject.kt"); } + @Test + @TestMetadata("importedJavaStaticField.kt") + public void testImportedJavaStaticField() throws Exception { + runTest("compiler/testData/codegen/boxInline/simple/importedJavaStaticField.kt"); + } + @Test @TestMetadata("inlineCallInInlineLambda.kt") public void testInlineCallInInlineLambda() throws Exception {