10/27/2021, 9:02 PM
This is javap result of .class of kotlin code. So the invoke method returning java.lang.Object is marked as synthetic and bridge method that's why is it possible to have two methods with same name but different return type. At source code it's not possible but in byte code by manually generating byte code using some byte code generator can we do that?


10/27/2021, 9:09 PM
val c = Supplier<Int> { 1 } // Kotlin
Supplier<Integer> c = () -> 1; // Java
both should generate similar synthetic bridge methods
When compiling a class or interface that extends a parameterized class or implements a parameterized interface, the compiler may need to create a synthetic method, which is called a bridge method, as part of the type erasure process.