JVM IR: Produce correct generic signatures for special bridge methods
This commit is contained in:
committed by
Alexander Udalov
parent
c16b548dff
commit
9d63412b3e
@@ -1,4 +1,5 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
// java.lang.NoSuchMethodError: java.util.TreeMap.remove
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
interface ImmutableCollection<out E> : Collection<E> {
|
||||
fun add(element: @UnsafeVariance E): ImmutableCollection<E>
|
||||
fun addAll(elements: Collection<@UnsafeVariance E>): ImmutableCollection<E>
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
open class A0<E> : MutableList<E> {
|
||||
override fun add(element: E): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_SIGNATURES
|
||||
|
||||
class GenericMap<K, V> : MutableMap<K, V> by HashMap<K, V>()
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_SIGNATURES
|
||||
// Test expectations differ between JVM and JVM IR backends, because of KT-40277. This should be revisited once KT-40277 is resolved.
|
||||
|
||||
class StringStringMap : MutableMap<String, String> by HashMap<String, String>()
|
||||
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
@kotlin.Metadata
|
||||
public abstract class<Ljava/lang/Object;Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;Lkotlin/jvm/internal/markers/KMutableMap;> AbstractStringStringMap {
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Collection<Ljava/lang/String;>;> method getValues(): java.util.Collection
|
||||
public bridge final <()Ljava/util/Collection<Ljava/lang/String;>;> method values(): java.util.Collection
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Set<Ljava/lang/String;>;> method getKeys(): java.util.Set
|
||||
public bridge final <()Ljava/util/Set<Ljava/lang/String;>;> method keySet(): java.util.Set
|
||||
public bridge final <()Ljava/util/Set<Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/String;>;>;> method entrySet(): java.util.Set
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Set<Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/String;>;>;> method getEntries(): java.util.Set
|
||||
public <(Ljava/util/Map<+Ljava/lang/String;+Ljava/lang/String;>;)V> method putAll(@org.jetbrains.annotations.NotNull p0: java.util.Map): void
|
||||
public <null> method <init>(): void
|
||||
public <null> method clear(): void
|
||||
public <null> method containsKey(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
public bridge final <null> method containsKey(p0: java.lang.Object): boolean
|
||||
public <null> method containsValue(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
public bridge final <null> method containsValue(p0: java.lang.Object): boolean
|
||||
public @org.jetbrains.annotations.Nullable <null> method get(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public synthetic bridge <null> method get(p0: java.lang.Object): java.lang.Object
|
||||
public bridge final <null> method get(p0: java.lang.Object): java.lang.String
|
||||
public <null> method getSize(): int
|
||||
public <null> method isEmpty(): boolean
|
||||
public @org.jetbrains.annotations.Nullable <null> method put(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: java.lang.String): java.lang.String
|
||||
public synthetic bridge <null> method put(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object
|
||||
public @org.jetbrains.annotations.Nullable <null> method remove(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public synthetic bridge <null> method remove(p0: java.lang.Object): java.lang.Object
|
||||
public bridge final <null> method remove(p0: java.lang.Object): java.lang.String
|
||||
public bridge final <null> method size(): int
|
||||
private synthetic final field <Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/String;>;> $$delegate_0: java.util.HashMap
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class<Ljava/lang/Object;Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;Lkotlin/jvm/internal/markers/KMutableMap;> StringStringMap {
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Collection<Ljava/lang/String;>;> method getValues(): java.util.Collection
|
||||
public bridge final <()Ljava/util/Collection<Ljava/lang/String;>;> method values(): java.util.Collection
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Set<Ljava/lang/String;>;> method getKeys(): java.util.Set
|
||||
public bridge final <()Ljava/util/Set<Ljava/lang/String;>;> method keySet(): java.util.Set
|
||||
public bridge final <()Ljava/util/Set<Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/String;>;>;> method entrySet(): java.util.Set
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Set<Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/String;>;>;> method getEntries(): java.util.Set
|
||||
public <(Ljava/util/Map<+Ljava/lang/String;+Ljava/lang/String;>;)V> method putAll(@org.jetbrains.annotations.NotNull p0: java.util.Map): void
|
||||
public <null> method <init>(): void
|
||||
public <null> method clear(): void
|
||||
public <null> method containsKey(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
public bridge final <null> method containsKey(p0: java.lang.Object): boolean
|
||||
public <null> method containsValue(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
public bridge final <null> method containsValue(p0: java.lang.Object): boolean
|
||||
public @org.jetbrains.annotations.Nullable <null> method get(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public synthetic bridge <null> method get(p0: java.lang.Object): java.lang.Object
|
||||
public bridge final <null> method get(p0: java.lang.Object): java.lang.String
|
||||
public <null> method getSize(): int
|
||||
public <null> method isEmpty(): boolean
|
||||
public @org.jetbrains.annotations.Nullable <null> method put(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: java.lang.String): java.lang.String
|
||||
public synthetic bridge <null> method put(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object
|
||||
public @org.jetbrains.annotations.Nullable <null> method remove(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public synthetic bridge <null> method remove(p0: java.lang.Object): java.lang.Object
|
||||
public bridge final <null> method remove(p0: java.lang.Object): java.lang.String
|
||||
public bridge final <null> method size(): int
|
||||
private synthetic final field <Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/String;>;> $$delegate_0: java.util.HashMap
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_SIGNATURES
|
||||
// Test expectations differ between JVM and JVM IR backends, because of KT-40277. This should be revisited once KT-40277 is resolved.
|
||||
|
||||
class StringMap<V> : MutableMap<String, V> by HashMap<String, V>()
|
||||
|
||||
|
||||
compiler/testData/codegen/bytecodeListing/specialBridges/signatures/partiallySpecializedClass_ir.txt
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
@kotlin.Metadata
|
||||
public abstract class<<V:Ljava/lang/Object;>Ljava/lang/Object;Ljava/util/Map<Ljava/lang/String;TV;>;Lkotlin/jvm/internal/markers/KMutableMap;> AbstractStringMap {
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Collection<TV;>;> method getValues(): java.util.Collection
|
||||
public bridge final <()Ljava/util/Collection<TV;>;> method values(): java.util.Collection
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Set<Ljava/lang/String;>;> method getKeys(): java.util.Set
|
||||
public bridge final <()Ljava/util/Set<Ljava/lang/String;>;> method keySet(): java.util.Set
|
||||
public bridge final <()Ljava/util/Set<Ljava/util/Map$Entry<Ljava/lang/String;TV;>;>;> method entrySet(): java.util.Set
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Set<Ljava/util/Map$Entry<Ljava/lang/String;TV;>;>;> method getEntries(): java.util.Set
|
||||
public @org.jetbrains.annotations.Nullable <(Ljava/lang/Object;)TV;> method get(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.Object
|
||||
public bridge final <(Ljava/lang/Object;)TV;> method get(p0: java.lang.Object): java.lang.Object
|
||||
public @org.jetbrains.annotations.Nullable <(Ljava/lang/Object;)TV;> method remove(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.Object
|
||||
public bridge final <(Ljava/lang/Object;)TV;> method remove(p0: java.lang.Object): java.lang.Object
|
||||
public @org.jetbrains.annotations.Nullable <(Ljava/lang/String;TV;)TV;> method put(@org.jetbrains.annotations.NotNull p0: java.lang.String, p1: java.lang.Object): java.lang.Object
|
||||
public <(Ljava/util/Map<+Ljava/lang/String;+TV;>;)V> method putAll(@org.jetbrains.annotations.NotNull p0: java.util.Map): void
|
||||
public <null> method <init>(): void
|
||||
public <null> method clear(): void
|
||||
public <null> method containsKey(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
public bridge final <null> method containsKey(p0: java.lang.Object): boolean
|
||||
public <null> method containsValue(p0: java.lang.Object): boolean
|
||||
public <null> method getSize(): int
|
||||
public <null> method isEmpty(): boolean
|
||||
public synthetic bridge <null> method put(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object
|
||||
public bridge final <null> method size(): int
|
||||
private synthetic final field <Ljava/util/HashMap<Ljava/lang/String;TV;>;> $$delegate_0: java.util.HashMap
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class<<V:Ljava/lang/Object;>Ljava/lang/Object;Ljava/util/Map<Ljava/lang/String;TV;>;Lkotlin/jvm/internal/markers/KMutableMap;> StringMap {
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Collection<TV;>;> method getValues(): java.util.Collection
|
||||
public bridge final <()Ljava/util/Collection<TV;>;> method values(): java.util.Collection
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Set<Ljava/lang/String;>;> method getKeys(): java.util.Set
|
||||
public bridge final <()Ljava/util/Set<Ljava/lang/String;>;> method keySet(): java.util.Set
|
||||
public bridge final <()Ljava/util/Set<Ljava/util/Map$Entry<Ljava/lang/String;TV;>;>;> method entrySet(): java.util.Set
|
||||
public @org.jetbrains.annotations.NotNull <()Ljava/util/Set<Ljava/util/Map$Entry<Ljava/lang/String;TV;>;>;> method getEntries(): java.util.Set
|
||||
public @org.jetbrains.annotations.Nullable <(Ljava/lang/Object;)TV;> method get(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.Object
|
||||
public bridge final <(Ljava/lang/Object;)TV;> method get(p0: java.lang.Object): java.lang.Object
|
||||
public @org.jetbrains.annotations.Nullable <(Ljava/lang/Object;)TV;> method remove(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.Object
|
||||
public bridge final <(Ljava/lang/Object;)TV;> method remove(p0: java.lang.Object): java.lang.Object
|
||||
public @org.jetbrains.annotations.Nullable <(Ljava/lang/String;TV;)TV;> method put(@org.jetbrains.annotations.NotNull p0: java.lang.String, p1: java.lang.Object): java.lang.Object
|
||||
public <(Ljava/util/Map<+Ljava/lang/String;+TV;>;)V> method putAll(@org.jetbrains.annotations.NotNull p0: java.util.Map): void
|
||||
public <null> method <init>(): void
|
||||
public <null> method clear(): void
|
||||
public <null> method containsKey(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
public bridge final <null> method containsKey(p0: java.lang.Object): boolean
|
||||
public <null> method containsValue(p0: java.lang.Object): boolean
|
||||
public <null> method getSize(): int
|
||||
public <null> method isEmpty(): boolean
|
||||
public synthetic bridge <null> method put(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object
|
||||
public bridge final <null> method size(): int
|
||||
private synthetic final field <Ljava/util/HashMap<Ljava/lang/String;TV;>;> $$delegate_0: java.util.HashMap
|
||||
}
|
||||
@@ -90,18 +90,33 @@ fun box(
|
||||
}
|
||||
|
||||
/*
|
||||
16 INVOKEVIRTUAL A[0-9]+.removeAt \(I\) -> calls in bridges with signature `public final bridge remove\(I\)` + 7 calls from `public synthetic bridge remove\(I\)Ljava/lang/Object;`
|
||||
9 INVOKEVIRTUAL A[0-9]+\.remove \(I\) -> calls to A1-A9.removeAt
|
||||
1 INVOKEINTERFACE A9\.remove \(I\) -> call A9.removeAt
|
||||
1 INVOKEINTERFACE A9\.remove \(Ljava/lang/Object;\) -> call A9.remove
|
||||
|
||||
On the JVM backend we have:
|
||||
16 INVOKEVIRTUAL A[0-9]+.removeAt \(I\) -> calls in bridges with signature `public final bridge remove\(I\)` + 7 calls from `public synthetic bridge remove\(I\)Ljava/lang/Object;`
|
||||
9 INVOKEVIRTUAL A[0-9]+\.remove \(I\) -> calls to A1-A9.removeAt
|
||||
1 INVOKEVIRTUAL A10\.remove \(I\) -> one call in 'box' function
|
||||
|
||||
On the JVM IR backend we have:
|
||||
9 INVOKEVIRTUAL A[0-9]+.removeAt \(I\) -> calls in non-synthetic bridges with signature `public final bridge remove(I)`
|
||||
17 INVOKEVIRTUAL A[0-9]+\.remove \(I\) -> calls to A1-A9.removeAt + calls in synthetic bridges with signature `public synthetic bridge remove(I)Ljava/lang/Object;`
|
||||
2 INVOKEVIRTUAL A10\.remove \(I\) -> one call in 'box' function + call from synthetic `remove(I)` bridge
|
||||
|
||||
This currently differs because of KT-40277, and the test expectations should be revised once KT-40277 is resolved.
|
||||
*/
|
||||
|
||||
// 16 INVOKEVIRTUAL A[0-9]+.removeAt \(I\)
|
||||
// 9 INVOKEVIRTUAL A[0-9]+\.remove \(I\)
|
||||
// 1 INVOKEINTERFACE A9\.remove \(I\)
|
||||
// 1 INVOKEINTERFACE A9\.remove \(Ljava/lang/Object;\)
|
||||
// 1 INVOKEVIRTUAL A10\.remove \(I\)
|
||||
// 2 INVOKEINTERFACE java\/util\/List.remove \(I\)
|
||||
// 2 INVOKEINTERFACE java\/util\/List.remove \(Ljava/lang/Object;\)
|
||||
|
||||
// JVM_TEMPLATES:
|
||||
// 16 INVOKEVIRTUAL A[0-9]+.removeAt \(I\)
|
||||
// 9 INVOKEVIRTUAL A[0-9]+\.remove \(I\)
|
||||
// 1 INVOKEVIRTUAL A10\.remove \(I\)
|
||||
|
||||
// JVM_IR_TEMPLATES:
|
||||
// 9 INVOKEVIRTUAL A[0-9]+.removeAt \(I\)
|
||||
// 17 INVOKEVIRTUAL A[0-9]+\.remove \(I\)
|
||||
// 2 INVOKEVIRTUAL A10\.remove \(I\)
|
||||
|
||||
@@ -27,4 +27,14 @@ public class TestMap<K, V> implements Map<K, V> {
|
||||
|
||||
class MyMap: TestMap<String, String>()
|
||||
|
||||
// The Kotlin version of getOrDefault, which redirects to the default implementation in java.util.Map
|
||||
// 1 public bridge getOrDefault\(Ljava/lang/String;Ljava/lang/String;\)Ljava/lang/String;
|
||||
|
||||
// Test expectations differ between JVM and JVM IR backends, because of KT-40277. This should be revisited once KT-40277 is resolved.
|
||||
|
||||
// JVM_TEMPLATES:
|
||||
// 1 public final bridge getOrDefault\(Ljava/lang/Object;Ljava/lang/Object;\)Ljava/lang/Object;
|
||||
|
||||
// JVM_IR_TEMPLATES:
|
||||
// 1 public final bridge getOrDefault\(Ljava/lang/Object;Ljava/lang/String;\)Ljava/lang/String;
|
||||
// 1 public synthetic bridge getOrDefault\(Ljava/lang/Object;Ljava/lang/Object;\)Ljava/lang/Object;
|
||||
Reference in New Issue
Block a user