diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java index 579071d2de4..678bceaa671 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java @@ -431,6 +431,14 @@ public class FunctionCodegen { private static void checkOverride(CodegenContext owner, GenerationState state, ClassBuilder v, Method jvmSignature, FunctionDescriptor functionDescriptor, FunctionDescriptor overriddenFunction) { Method method = state.getTypeMapper().mapSignature(functionDescriptor.getName(), functionDescriptor).getAsmMethod(); Method overriden = state.getTypeMapper().mapSignature(overriddenFunction.getName(), overriddenFunction.getOriginal()).getAsmMethod(); + + if(overriddenFunction.getModality() == Modality.ABSTRACT) { + Set overriddenFunctions = overriddenFunction.getOverriddenDescriptors(); + for (FunctionDescriptor of : overriddenFunctions) { + checkOverride(owner, state, v, jvmSignature, overriddenFunction, of.getOriginal()); + } + } + if(differentMethods(method, overriden)) { int flags = ACC_PUBLIC | ACC_BRIDGE; // TODO. diff --git a/compiler/testData/codegen/regressions/kt1345.kt b/compiler/testData/codegen/regressions/kt1345.kt new file mode 100644 index 00000000000..1888fa33dd8 --- /dev/null +++ b/compiler/testData/codegen/regressions/kt1345.kt @@ -0,0 +1,13 @@ +trait Creator { + fun create() : T +} + +class Actor(val code: String = "OK") + +trait Factory : Creator + +class MyFactory() : Factory { + override fun create(): Actor = Actor() +} + +fun box() : String = MyFactory().create().code \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java index b32ce49066d..c400b51caf5 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java @@ -303,4 +303,8 @@ public class ClassGenTest extends CodegenTestCase { blackBoxFile("regressions/kt633.kt"); } + + public void testKt1345() throws Exception { + blackBoxFile("regressions/kt1345.kt"); + } } diff --git a/examples/src/guice-kotlin/guice-kotlin.iws b/examples/src/guice-kotlin/guice-kotlin.iws index 7803ff96873..20a33e94f44 100644 --- a/examples/src/guice-kotlin/guice-kotlin.iws +++ b/examples/src/guice-kotlin/guice-kotlin.iws @@ -58,10 +58,10 @@ - + - + @@ -130,10 +130,10 @@ - + - + @@ -161,16 +161,15 @@ - @@ -203,16 +202,6 @@ - - - - - - - - @@ -235,6 +224,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -268,10 +299,10 @@ - - - + + + @@ -355,6 +386,24 @@ - + @@ -515,22 +546,23 @@ - + - - + + - + - + + @@ -597,105 +629,79 @@ - - - + - - - + - - - + - - - + - - - + - - - - - - - - - - + - - - + + + + + + - - - + - - - + - - - + - - - + - + + + + + + - - - - - - - - +