diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt b/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt index e596cada53a..802cbd00aad 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt +++ b/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt @@ -30,11 +30,10 @@ class PlatformStaticGenerator( val state: GenerationState ) : Function2 { - override fun invoke(p1: ImplementationBodyCodegen, p2: ClassBuilder) { + override fun invoke(codegen: ImplementationBodyCodegen, classBuilder: ClassBuilder) { val typeMapper = state.getTypeMapper() - val callable = typeMapper.mapToCallableMethod(descriptor, false, p1.getContext()) - val asmMethod = callable.getAsmMethod() - val methodVisitor = p2.newMethod( + val asmMethod = typeMapper.mapSignature(descriptor).getAsmMethod() + val methodVisitor = classBuilder.newMethod( Synthetic(declarationOrigin.element, descriptor), Opcodes.ACC_STATIC or AsmUtil.getMethodAsmFlags(descriptor, OwnerKind.IMPLEMENTATION), asmMethod.getName()!!, @@ -55,7 +54,13 @@ class PlatformStaticGenerator( iv.load(index, paramType); index += paramType.getSize(); } - callable.invokeWithoutAssertions(iv) + + val syntheticOrOriginalMethod = typeMapper.mapToCallableMethod( + codegen.getContext().accessibleFunctionDescriptor(descriptor), + false, + codegen.getContext() + ) + syntheticOrOriginalMethod.invokeWithoutAssertions(iv) iv.areturn(asmMethod.getReturnType()); methodVisitor.visitEnd(); } diff --git a/compiler/testData/codegen/boxWithStdlib/platformStatic/syntheticAccessor.kt b/compiler/testData/codegen/boxWithStdlib/platformStatic/syntheticAccessor.kt new file mode 100644 index 00000000000..b2c6154771b --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/platformStatic/syntheticAccessor.kt @@ -0,0 +1,17 @@ +import kotlin.platform.* + +class C { + class object { + private platformStatic fun foo(): String { + return "OK" + } + } + + fun bar(): String { + return foo() + } +} + +fun box(): String { + return C().bar() +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java index 1da88526cce..da4923cf34d 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java @@ -1763,6 +1763,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/platformStatic/simple.kt"); doTestWithStdlib(fileName); } + + @TestMetadata("syntheticAccessor.kt") + public void testSyntheticAccessor() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/platformStatic/syntheticAccessor.kt"); + doTestWithStdlib(fileName); + } } @TestMetadata("compiler/testData/codegen/boxWithStdlib/platformTypes")