Delegated members should not be synthetic

Otherwise they are invisible to Java code
This commit is contained in:
Andrey Breslav
2014-01-23 10:21:03 +04:00
parent ec3eee133f
commit 39234b4d3e
4 changed files with 24 additions and 1 deletions
@@ -737,7 +737,7 @@ public class FunctionCodegen extends ParentCodegenAwareImpl {
Method overriddenMethod = jvmOverriddenMethodSignature.getAsmMethod();
Method delegateMethod = jvmDelegateMethodSignature.getAsmMethod();
int flags = ACC_PUBLIC | ACC_SYNTHETIC; // TODO.
int flags = ACC_PUBLIC;
MethodVisitor mv = v.newMethod(null, flags, delegateMethod.getName(), delegateMethod.getDescriptor(), null, null);
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
@@ -0,0 +1,7 @@
class JavaClass {
public static void main(String[] args) {
Test test = new Test();
test.foo();
test.getBar();
}
}
@@ -0,0 +1,11 @@
trait Trait {
fun foo()
val bar: Int
}
class Impl: Trait {
override fun foo() {}
override val bar = 1
}
class Test : Trait by Impl()
@@ -112,6 +112,11 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg
doTest("compiler/testData/compileJavaAgainstKotlin/method/ArrayOfIntegerArray.kt");
}
@TestMetadata("Delegation.kt")
public void testDelegation() throws Exception {
doTest("compiler/testData/compileJavaAgainstKotlin/method/Delegation.kt");
}
@TestMetadata("GenericArray.kt")
public void testGenericArray() throws Exception {
doTest("compiler/testData/compileJavaAgainstKotlin/method/GenericArray.kt");