Fix stub generation for special built-ins
Do not generate stubs if there is no special bridge in the current class - there are already Kotlin super class in hierarchy - special bridge has the same signature as method itself #KT-11915 Fixed
This commit is contained in:
@@ -91,7 +91,12 @@ object BuiltinSpecialBridgesUtil {
|
||||
|
||||
// Can be null if special builtin is final (e.g. 'name' in Enum)
|
||||
// because there should be no stubs for override in subclasses
|
||||
val superImplementationDescriptor = findSuperImplementationForStubDelegation(function, fake, isBodyOwner)
|
||||
val superImplementationDescriptor =
|
||||
if (specialBridge != null)
|
||||
findSuperImplementationForStubDelegation(function, fake, isBodyOwner)
|
||||
else
|
||||
null
|
||||
|
||||
if (superImplementationDescriptor != null) {
|
||||
bridges.add(BridgeForBuiltinSpecial(methodItself, signatureByDescriptor(superImplementationDescriptor), isDelegateToSuper = true))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import java.util.*
|
||||
|
||||
open class Map1 : HashMap<String, Any?>()
|
||||
class Map2 : Map1()
|
||||
fun box(): String {
|
||||
val m = Map2()
|
||||
if (m.entries.size != 0) return "fail 1"
|
||||
|
||||
m.put("56", "OK")
|
||||
val x = m.entries.iterator().next()
|
||||
|
||||
if (x.key != "56" || x.value != "OK") return "fail 2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -27,12 +27,8 @@ public abstract class A2 {
|
||||
@kotlin.Metadata
|
||||
public abstract class A3 {
|
||||
public method <init>(): void
|
||||
public method contains(p0: java.lang.Object): boolean
|
||||
public abstract method getSize(): 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 method remove(p0: java.lang.Object): boolean
|
||||
public method removeAt(p0: int): java.lang.Object
|
||||
public final method size(): int
|
||||
}
|
||||
@@ -43,10 +39,7 @@ public abstract class A4 {
|
||||
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 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 method remove(p0: java.lang.Object): boolean
|
||||
public method removeAt(p0: int): java.lang.Object
|
||||
public final method size(): int
|
||||
}
|
||||
@@ -136,4 +129,4 @@ public interface I2 {
|
||||
inner class I2$DefaultImpls
|
||||
public abstract method contains(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
public abstract method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -33,7 +33,6 @@ public final class A1 {
|
||||
public method <init>(): void
|
||||
public final method contains(p0: java.lang.Object): boolean
|
||||
public method contains(p0: java.lang.String): boolean
|
||||
public method getSize(): int
|
||||
public final method indexOf(p0: java.lang.Object): int
|
||||
public method indexOf(p0: java.lang.String): int
|
||||
public final method lastIndexOf(p0: java.lang.Object): int
|
||||
@@ -52,7 +51,6 @@ public final class A2 {
|
||||
public method <init>(): void
|
||||
public final method contains(p0: java.lang.Object): boolean
|
||||
public method contains(p0: java.lang.String): boolean
|
||||
public method getSize(): int
|
||||
public final method indexOf(p0: java.lang.Object): int
|
||||
public method indexOf(p0: java.lang.String): int
|
||||
public final method lastIndexOf(p0: java.lang.Object): int
|
||||
|
||||
@@ -13639,6 +13639,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("entrySetSOE.kt")
|
||||
public void testEntrySetSOE() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/specialBuiltins/entrySetSOE.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumAsOrdinaled.kt")
|
||||
public void testEnumAsOrdinaled() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/specialBuiltins/enumAsOrdinaled.kt");
|
||||
|
||||
Reference in New Issue
Block a user