What is the java equivalent of this code:
# getting-started
k
What is the java equivalent of this code:
n
there’s no
typealias
in java
and there are extension function in java
k
actually, i need lambda with receiver equivalent, typealias is not the biggest problem
n
there are no extension functions in java and even less lambda with receiver sorry...
k
but kotlin will compile to java bytecode, so there should be something it compiles to
d
The typealias itself doesn't exist at all in the bytecode. Kotlin will replace all usages of
ErrorEvent
with the alias. Function types are compiled to
kotlin.jvm.functions.FunctionN
with N being the arity. In this case you would get
Function1<ErrorConsumer, Unit>
💯 2
💪 3
s
“compiles to jvm bytecode” != identically representable in java
1
☝️ 2
b
@FunctionalInterface interface ErrorConsumer { void call(); }
Take Welland is correct