diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java index 4abe9b4cc93..6b910cd40db 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java @@ -801,9 +801,10 @@ public class FunctionCodegen { @NotNull Method bridge, @NotNull Method delegateTo, boolean isSpecialBridge, - boolean superCallNeeded + boolean isStubDeclarationWithDelegationToSuper ) { - int flags = ACC_PUBLIC | ACC_BRIDGE | (!isSpecialBridge ? ACC_SYNTHETIC : 0) | (isSpecialBridge ? ACC_FINAL : 0); // TODO. + boolean isSpecialOrDelegationToSuper = isSpecialBridge || isStubDeclarationWithDelegationToSuper; + int flags = ACC_PUBLIC | ACC_BRIDGE | (!isSpecialOrDelegationToSuper ? ACC_SYNTHETIC : 0) | (isSpecialBridge ? ACC_FINAL : 0); // TODO. MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.Bridge(descriptor, origin), flags, bridge.getName(), bridge.getDescriptor(), null, null); @@ -826,7 +827,7 @@ public class FunctionCodegen { reg += argTypes[i].getSize(); } - if (superCallNeeded) { + if (isStubDeclarationWithDelegationToSuper) { ClassDescriptor parentClass = getSuperClassDescriptor((ClassDescriptor) descriptor.getContainingDeclaration()); assert parentClass != null; String parentInternalName = typeMapper.mapClass(parentClass).getInternalName(); diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/contains.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/contains.txt index b2ec39aa68e..8f8b706296a 100644 --- a/compiler/testData/codegen/bytecodeListing/specialBridges/contains.txt +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/contains.txt @@ -24,13 +24,13 @@ @kotlin.jvm.internal.KotlinClass A3 { public method (): void - public synthetic method contains(p0: java.lang.Object): boolean + public method contains(p0: java.lang.Object): boolean public abstract method getSize(): int - public synthetic method indexOf(p0: java.lang.Object): int - public synthetic method lastIndexOf(p0: java.lang.Object): int + public method indexOf(p0: java.lang.Object): int + public method lastIndexOf(p0: java.lang.Object): int public final method remove(p0: int): java.lang.Object - public synthetic method remove(p0: java.lang.Object): boolean - public synthetic method removeAt(p0: int): java.lang.Object + public method remove(p0: java.lang.Object): boolean + public method removeAt(p0: int): java.lang.Object public final method size(): int } @@ -39,27 +39,27 @@ public method contains(p0: java.lang.Object): boolean public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean public abstract method getSize(): int - public synthetic method indexOf(p0: java.lang.Object): int - public synthetic method lastIndexOf(p0: java.lang.Object): int + public method indexOf(p0: java.lang.Object): int + public method lastIndexOf(p0: java.lang.Object): int public final method remove(p0: int): java.lang.Object - public synthetic method remove(p0: java.lang.Object): boolean - public synthetic method removeAt(p0: int): java.lang.Object + public method remove(p0: java.lang.Object): boolean + public method removeAt(p0: int): java.lang.Object public final method size(): int } @kotlin.jvm.internal.KotlinClass A5 { public method (): void public final method contains(p0: java.lang.Object): boolean - public synthetic method contains(p0: java.lang.String): boolean + public method contains(p0: java.lang.String): boolean public abstract method getSize(): int public final method indexOf(p0: java.lang.Object): int - public synthetic method indexOf(p0: java.lang.String): int + public method indexOf(p0: java.lang.String): int public final method lastIndexOf(p0: java.lang.Object): int - public synthetic method lastIndexOf(p0: java.lang.String): int + public method lastIndexOf(p0: java.lang.String): int public final method remove(p0: int): java.lang.String public final method remove(p0: java.lang.Object): boolean - public synthetic method remove(p0: java.lang.String): boolean - public synthetic method removeAt(p0: int): java.lang.String + public method remove(p0: java.lang.String): boolean + public method removeAt(p0: int): java.lang.String public final method size(): int } @@ -70,13 +70,13 @@ public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean public abstract method getSize(): int public final method indexOf(p0: java.lang.Object): int - public synthetic method indexOf(p0: java.lang.String): int + public method indexOf(p0: java.lang.String): int public final method lastIndexOf(p0: java.lang.Object): int - public synthetic method lastIndexOf(p0: java.lang.String): int + public method lastIndexOf(p0: java.lang.String): int public final method remove(p0: int): java.lang.String public final method remove(p0: java.lang.Object): boolean - public synthetic method remove(p0: java.lang.String): boolean - public synthetic method removeAt(p0: int): java.lang.String + public method remove(p0: java.lang.String): boolean + public method removeAt(p0: int): java.lang.String public final method size(): int }