PrepZone Logo
PrepZone
Back to Java

Java · Hard

How does invokedynamic work under the hood? How are Java lambdas compiled?

JavaAdvanced JavaJVM

Answer preview

Java lambdas are not implemented as anonymous inner classes (pre-Java 8 approach). Instead, the compiler emits invokedynamic bytecode that bootstraps a functional interface implementation at runtime via LambdaMetafactory.…