class MySet : Set { override val size: Int get() = throw UnsupportedOperationException() override fun isEmpty(): Boolean { throw UnsupportedOperationException() } override fun contains(o: String): Boolean { throw UnsupportedOperationException() } override fun iterator(): Iterator { throw UnsupportedOperationException() } override fun containsAll(c: Collection): Boolean { throw UnsupportedOperationException() } } fun box(): String { val mySet = MySet() // no UnsupportedOperationException thrown mySet.contains(J.nullValue()) J.nullValue() in mySet val set: Set = mySet set.contains(J.nullValue()) J.nullValue() in set val anySet: Set = mySet as Set anySet.contains(J.nullValue()) anySet.contains(null) J.nullValue() in anySet null in anySet return "OK" }