package test1 public class MyClass { } public fun MyClass.iterator(): Iterator { return object: Iterator { override fun next(): MyClass { throw Exception() } override fun hasNext(): Boolean { throw Exception() } } }