Files
kotlin/compiler/testData/codegen/bytecodeText/builtinFunctions/genericParameterBridge/mutableCollection.kt
Denis Zharkov fa99ea1e98 Generate type-safe barrier in method body
In cases when signature of special bridge is the same as current method,
but type is not 'Any?'.

Also there is tiny optimization:
only null check needed if value parameter type is mapped to Object,
but it's not nullable.

 #KT-9973 Fixed
2015-11-17 16:27:02 +03:00

28 lines
874 B
Kotlin
Vendored

abstract class A1<Q> : MutableCollection<Q> {
override fun contains(o: Q): Boolean {
throw UnsupportedOperationException()
}
override fun containsAll(c: Collection<Q>): Boolean {
throw UnsupportedOperationException()
}
}
abstract class A2 : MutableCollection<String> {
override fun contains(o: String): Boolean {
throw UnsupportedOperationException()
}
override fun containsAll(c: Collection<String>): Boolean {
throw UnsupportedOperationException()
}
}
// 0 signature \(TQ;\)Z
// 2 signature \(Ljava/util/Collection<\+Ljava/lang/Object;>;\)Z
// 1 public final bridge contains\(Ljava/lang/Object;\)Z
// 1 public final bridge remove\(Ljava/lang/Object;\)Z
// 1 INVOKEVIRTUAL A[0-9]\.contains \(Ljava/lang/String;\)Z
/* 2 INSTANCEOF: one for 'remove', one for 'contains' type-safe bridges */
// 2 INSTANCEOF