KT-4456 Generated wrong bytecode when Kotlin class inherited from Java Interface with method which have SAM type argument
#KT-4456 fixed
This commit is contained in:
@@ -1760,6 +1760,10 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CallResolverUtil.isOrOverridesSynthesized(callableMemberDescriptor)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Collection<CallableMemberDescriptor> overriddenDeclarations =
|
||||
OverridingUtil.getOverriddenDeclarations(callableMemberDescriptor);
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
interface JavaInterface {
|
||||
void foo(Runnable r);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Impl: JavaInterface {
|
||||
override fun foo(r: Runnable?) {
|
||||
r?.run()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val fooMethods = javaClass<Impl>().getMethods().filter { it.getName() == "foo" }
|
||||
if (fooMethods.size() != 1) return fooMethods.toString()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+5
@@ -224,6 +224,11 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
||||
doTestWithJava("compiler/testData/codegen/boxWithJava/sam/adapters/fileFilter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implementAdapter.kt")
|
||||
public void testImplementAdapter() throws Exception {
|
||||
doTestWithJava("compiler/testData/codegen/boxWithJava/sam/adapters/implementAdapter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritedInKotlin.kt")
|
||||
public void testInheritedInKotlin() throws Exception {
|
||||
doTestWithJava("compiler/testData/codegen/boxWithJava/sam/adapters/inheritedInKotlin.kt");
|
||||
|
||||
Reference in New Issue
Block a user