JVM: fix EnclosingMethod information for SAMs in inline lambdas
Pass parentContext to SamWrapperCodegen from the outside instead of using the one from parentCodegen. The difference is that in case of an inline lambda, we're creating an InlineLambdaContext whose parent is a ClosureContext, but the codegen for that lambda has that latter ClosureContext as its context. So the getNonInlineOuterContext call in SamWrapperCodegen.generateInnerClassInformation wasn't able to identify that this is a context of a lambda that needs to be skipped, and generated it as EnclosingMethod, which caused Java reflection to fail because once that lambda was inlined, it was removed and thus didn't make it to runtime. #KT-44827 Fixed
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@ synthetic final class<null> TKt$sam$Sam$0 {
|
||||
public synthetic final <null> method get(): java.lang.Object
|
||||
public <null> method getFunctionDelegate(): kotlin.Function
|
||||
public <null> method hashCode(): int
|
||||
enclosing class TKt
|
||||
enclosing method TKt.genericSam()Ljava/lang/Object;
|
||||
private synthetic final field <null> function: kotlin.jvm.functions.Function0
|
||||
inner (anonymous) class TKt$sam$Sam$0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user