Add tests for KT-40152
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: removeNullFromList.kt
|
||||
|
||||
class MyList : List<String> {
|
||||
override val size: Int get() = 0
|
||||
override fun contains(element: String): Boolean = false
|
||||
override fun containsAll(elements: Collection<String>): Boolean = false
|
||||
override fun get(index: Int): String = TODO()
|
||||
override fun indexOf(element: String): Int = -1
|
||||
override fun isEmpty(): Boolean = true
|
||||
override fun iterator(): Iterator<String> = TODO()
|
||||
override fun lastIndexOf(element: String): Int = -1
|
||||
override fun listIterator(): ListIterator<String> = TODO()
|
||||
override fun listIterator(index: Int): ListIterator<String> = TODO()
|
||||
override fun subList(fromIndex: Int, toIndex: Int): List<String> = this
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
J.test(MyList())
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
return "OK"
|
||||
}
|
||||
return "J.test(MyList()) should have thrown UnsupportedOperationException"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.List;
|
||||
|
||||
public class J {
|
||||
public static void test(List<String> list) {
|
||||
list.remove(null);
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class SimplePlatform
|
||||
|
||||
open class TargetPlatform(val componentPlatforms: Set<SimplePlatform>) :
|
||||
Collection<SimplePlatform> by componentPlatforms
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
@kotlin.Metadata
|
||||
public final class SimplePlatform {
|
||||
// source: 'collectionByDelegation.kt'
|
||||
public method <init>(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public class TargetPlatform {
|
||||
// source: 'collectionByDelegation.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field componentPlatforms: java.util.Set
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.util.Set): void
|
||||
public method add(p0: SimplePlatform): boolean
|
||||
public synthetic method add(p0: java.lang.Object): boolean
|
||||
public method addAll(p0: java.util.Collection): boolean
|
||||
public method clear(): void
|
||||
public method contains(@org.jetbrains.annotations.NotNull p0: SimplePlatform): boolean
|
||||
public bridge final method contains(p0: java.lang.Object): boolean
|
||||
public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean
|
||||
public final @org.jetbrains.annotations.NotNull method getComponentPlatforms(): java.util.Set
|
||||
public method getSize(): int
|
||||
public method isEmpty(): boolean
|
||||
public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator
|
||||
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
|
||||
public method toArray(): java.lang.Object[]
|
||||
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
@kotlin.Metadata
|
||||
public final class SimplePlatform {
|
||||
// source: 'collectionByDelegation.kt'
|
||||
public method <init>(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public class TargetPlatform {
|
||||
// source: 'collectionByDelegation.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field componentPlatforms: java.util.Set
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.util.Set): void
|
||||
public method add(p0: SimplePlatform): boolean
|
||||
public synthetic bridge method add(p0: java.lang.Object): boolean
|
||||
public method addAll(p0: java.util.Collection): boolean
|
||||
public method clear(): void
|
||||
public method contains(@org.jetbrains.annotations.NotNull p0: SimplePlatform): boolean
|
||||
public bridge final method contains(p0: java.lang.Object): boolean
|
||||
public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean
|
||||
public final @org.jetbrains.annotations.NotNull method getComponentPlatforms(): java.util.Set
|
||||
public method getSize(): int
|
||||
public method isEmpty(): boolean
|
||||
public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator
|
||||
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
|
||||
public method toArray(): java.lang.Object[]
|
||||
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
|
||||
}
|
||||
Reference in New Issue
Block a user