I can’t figure how to fix these compilation errors:
javaClass()
error: Kotlin: Unresolved reference: javaClass
val myEvent: Event = Event()
myEvent += { (e: MyType): Unit → printMyType(e) }
error: “e: is unexpected token”
I can’t figure how to fix these compilation errors:
javaClass()
error: Kotlin: Unresolved reference: javaClass
val myEvent: Event = Event()
myEvent += { (e: MyType): Unit → printMyType(e) }
error: “e: is unexpected token”
Use SomeType::class.java
instead of javaClass<SomeType>
.
No parentheses around parameters of lambda is required, rewrite as:
myEvent += { e: MyType -> printMyType(e) }
or
myEvent += { printMyType(it) }
worked. many many 10x!!