JVM_IR special handling for 'remove' collection method stub
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: removeOverriddenInJava.kt
|
||||
|
||||
open class A : Collection<String> {
|
||||
override val size: Int get() = TODO()
|
||||
override fun contains(element: String): Boolean = TODO()
|
||||
override fun containsAll(elements: Collection<String>): Boolean = TODO()
|
||||
override fun isEmpty(): Boolean = TODO()
|
||||
override fun iterator(): Iterator<String> = TODO()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
B().remove("OK")
|
||||
return B.removed as String
|
||||
}
|
||||
|
||||
// FILE: B.java
|
||||
public class B extends A {
|
||||
public static Object removed = null;
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
removed = o;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: removeOverriddenInJava_Map.kt
|
||||
|
||||
open class MapA : Map<String, String> {
|
||||
override val entries: Set<Map.Entry<String, String>> get() = null!!
|
||||
override val keys: Set<String> get() = null!!
|
||||
override val size: Int get() = null!!
|
||||
override val values: Collection<String> get() = null!!
|
||||
override fun containsKey(key: String): Boolean = null!!
|
||||
override fun containsValue(value: String): Boolean = null!!
|
||||
override fun get(key: String): String? = null!!
|
||||
override fun isEmpty(): Boolean = null!!
|
||||
}
|
||||
|
||||
fun box() = MapB().remove("OK")
|
||||
|
||||
// FILE: MapB.java
|
||||
public class MapB extends MapA {
|
||||
@Override
|
||||
public String remove(Object key) {
|
||||
return (String) key;
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -6,18 +6,18 @@ class A2 : A1(), Collection<String> {
|
||||
// No 'getSize()' method should be generated in A2
|
||||
|
||||
override fun contains(element: String): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
|
||||
override fun containsAll(elements: Collection<String>): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
|
||||
override fun isEmpty(): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
|
||||
override fun iterator(): Iterator<String> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -19,8 +19,7 @@ public final class A2 {
|
||||
public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean
|
||||
public method isEmpty(): boolean
|
||||
public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator
|
||||
public bridge final method remove(p0: java.lang.Object): boolean
|
||||
public method remove(p0: java.lang.String): boolean
|
||||
public method remove(p0: java.lang.Object): boolean
|
||||
public method removeAll(p0: java.util.Collection): boolean
|
||||
public method retainAll(p0: java.util.Collection): boolean
|
||||
public bridge final method size(): int
|
||||
|
||||
Reference in New Issue
Block a user