You can use JD-GUI for this.
http://java-decompiler.github.io/
This worked better for me as compared to the inbuilt IntelliJ plugin for decompilation. You just need to feed it your *.class files.
Kotlin Code
//TryingOutLamdas.kt
class TryingOutLambdas {
public fun performSomething()
{
takingAOnclickListener { x -> print("Hello $x").toString() }
}
fun takingAOnclickListener(onClickListener: (Int) -> (String))
{
onClickListener.invoke(6)
}
}
Converted bytecode for this using JD-GUI.
public final class TryingOutLambdas {
public final void performSomething() {
takingAOnclickListener(TryingOutLambdas$performSomething$1
.INSTANCE);
}
public final void takingAOnclickListener(@NotNull Function1 onClickListener) {
Intrinsics.checkParameterIsNotNull(onClickListener, "onClickListener");
onClickListener.invoke(Integer.valueOf(6));
}
static final class TryingOutLambdas$performSomething$1 extends Lambda implements Function1<Integer, String> {
public static final TryingOutLambdas$performSomething$1 INSTANCE = new TryingOutLambdas$performSomething$1();
@NotNull
public final String invoke(int x) {
String str = "Hello " + x;
boolean bool = false;
System.out.print(str);
return Unit.INSTANCE.toString();
}
TryingOutLambdas$performSomething$1() {
super(1);
}
}
}
In case a lambda expression accesses any variables from the function it is declared, a new object implementing that interface will be created instead of creating a Singleton instance created above.