Temporary fix for KT-5912
#KT-5912 Fixed
This commit is contained in:
committed by
Evgeny Gerashchenko
parent
6b336be10c
commit
6bcb2e9001
@@ -28,6 +28,7 @@ import org.jetbrains.jet.codegen.signature.BothSignatureWriter;
|
||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
@@ -164,6 +165,21 @@ public class ClosureCodegen extends ParentCodegenAware {
|
||||
FunctionCodegen fc = new FunctionCodegen(context, cv, state, getParentCodegen());
|
||||
fc.generateMethod(OtherOrigin(fun, funDescriptor), jvmMethodSignature, funDescriptor, strategy);
|
||||
|
||||
//TODO: rewrite cause ugly hack
|
||||
if (samType != null) {
|
||||
SimpleFunctionDescriptorImpl descriptorForBridges = SimpleFunctionDescriptorImpl
|
||||
.create(funDescriptor.getContainingDeclaration(), funDescriptor.getAnnotations(), erasedInterfaceFunction.getName(),
|
||||
CallableMemberDescriptor.Kind.DECLARATION, funDescriptor.getSource());
|
||||
|
||||
descriptorForBridges
|
||||
.initialize(null, erasedInterfaceFunction.getDispatchReceiverParameter(), erasedInterfaceFunction.getTypeParameters(),
|
||||
erasedInterfaceFunction.getValueParameters(), erasedInterfaceFunction.getReturnType(), Modality.OPEN,
|
||||
erasedInterfaceFunction.getVisibility());
|
||||
|
||||
descriptorForBridges.addOverriddenDescriptor(erasedInterfaceFunction);
|
||||
fc.generateBridges(descriptorForBridges);
|
||||
}
|
||||
|
||||
this.constructor = generateConstructor(cv, superClassAsmType);
|
||||
|
||||
if (isConst(closure)) {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
public class kt5912<T> {
|
||||
public static interface Action<T> {
|
||||
void call(T t);
|
||||
}
|
||||
|
||||
public static class Some<T> {
|
||||
public Some(T t) {
|
||||
}
|
||||
}
|
||||
|
||||
public static interface OnSubscribe<T> extends Action<Some<T>> {}
|
||||
|
||||
void perform(T t, OnSubscribe<T> subscribe) {
|
||||
subscribe.call(new Some(t));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun box(): String {
|
||||
var s = "Failt"
|
||||
kt5912<String>().perform("") { s = "OK" }
|
||||
return s
|
||||
}
|
||||
+6
@@ -410,6 +410,12 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod
|
||||
doTestAgainstJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5912.kt")
|
||||
public void testKt5912() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/kt5912.kt");
|
||||
doTestAgainstJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nonLiteralAndLiteralRunnable.kt")
|
||||
public void testNonLiteralAndLiteralRunnable() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralAndLiteralRunnable.kt");
|
||||
|
||||
Reference in New Issue
Block a user