JVM IR: Generate synthetic final implementation methods in SAM wrappers
This commit is contained in:
committed by
Alexander Udalov
parent
a475fa2a21
commit
68e2d0d245
Generated
+5
@@ -4353,6 +4353,11 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
|
||||
public void testSamWrapperSyntheticFlags() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("samWrapperSyntheticImplementationMethod.kt")
|
||||
public void testSamWrapperSyntheticImplementationMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticImplementationMethod.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/statements")
|
||||
|
||||
+2
-1
@@ -209,7 +209,8 @@ abstract class SingleAbstractMethodLowering(val context: CommonBackendContext) :
|
||||
name = superMethod.name
|
||||
returnType = superMethod.returnType
|
||||
visibility = superMethod.visibility
|
||||
origin = subclass.origin
|
||||
modality = Modality.FINAL
|
||||
origin = IrDeclarationOrigin.SYNTHETIC_GENERATED_SAM_IMPLEMENTATION
|
||||
isSuspend = superMethod.isSuspend
|
||||
setSourceRange(createFor)
|
||||
}.apply {
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
public static void g(Runnable r) {
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun nonInlineFun() {
|
||||
val f = {}
|
||||
J.g(f)
|
||||
}
|
||||
|
||||
inline fun inlineFun() {
|
||||
val f = {}
|
||||
J.g(f)
|
||||
}
|
||||
|
||||
// 2 public final synthetic run\(\)V
|
||||
@@ -4425,6 +4425,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
public void testSamWrapperSyntheticFlags() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("samWrapperSyntheticImplementationMethod.kt")
|
||||
public void testSamWrapperSyntheticImplementationMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticImplementationMethod.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/statements")
|
||||
|
||||
+5
@@ -4353,6 +4353,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
||||
public void testSamWrapperSyntheticFlags() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("samWrapperSyntheticImplementationMethod.kt")
|
||||
public void testSamWrapperSyntheticImplementationMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticImplementationMethod.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/statements")
|
||||
|
||||
Reference in New Issue
Block a user