Skip bridge methods generation for inline classes

This commit is contained in:
Mikhail Zarechenskiy
2018-02-06 13:56:24 +03:00
parent 4eb64fb4b9
commit e1d3b21201
4 changed files with 38 additions and 1 deletions
@@ -218,7 +218,9 @@ public class FunctionCodegen {
generateParameterAnnotations(functionDescriptor, mv, jvmSignature);
GenerateJava8ParameterNamesKt.generateParameterNames(functionDescriptor, mv, jvmSignature, state, (flags & ACC_SYNTHETIC) != 0);
generateBridges(functionDescriptor);
if (contextKind != OwnerKind.ERASED_INLINE_CLASS) {
generateBridges(functionDescriptor);
}
if (isJvm8InterfaceWithDefaultsMember(functionDescriptor, state) && contextKind != OwnerKind.DEFAULT_IMPLS && state.getGenerateDefaultImplsForJvm8()) {
generateDelegateForDefaultImpl(functionDescriptor, origin.getElement());
@@ -0,0 +1,9 @@
// !LANGUAGE: +InlineClasses
interface A<T> {
fun foo(a: T)
}
inline class Foo(val x: Long) : A<Foo> {
override fun foo(a: Foo) {}
}
@@ -0,0 +1,20 @@
@kotlin.Metadata
public interface A {
public abstract method foo(p0: java.lang.Object): void
}
@kotlin.Metadata
public final static class Foo$Erased {
public final static @org.jetbrains.annotations.NotNull method box(p0: long): Foo
public static method foo(p0: long, p1: long): void
}
@kotlin.Metadata
public final class Foo {
private final field x: long
public method <init>(p0: long): void
public synthetic method foo(p0: java.lang.Object): void
public method foo(p0: long): void
public final method getX(): long
public final method unbox(): long
}
@@ -267,6 +267,12 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("noBridgesForErasedInlineClass.kt")
public void testNoBridgesForErasedInlineClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeListing/inlineClasses/noBridgesForErasedInlineClass.kt");
doTest(fileName);
}
@TestMetadata("shapeOfInlineClassWithPrimitive.kt")
public void testShapeOfInlineClassWithPrimitive() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeListing/inlineClasses/shapeOfInlineClassWithPrimitive.kt");