Fix "Cannot resolve method" error in Java for methods from trait

This commit is contained in:
Nikolay Krasko
2014-08-27 20:29:02 +04:00
parent 9859b10854
commit 97a95d6a6a
4 changed files with 21 additions and 2 deletions
@@ -112,7 +112,10 @@ public class KotlinLightMethodForDeclaration(
override fun getUseScope(): SearchScope = origin.getUseScope()
override fun equals(other: Any?): Boolean =
other is KotlinLightMethodForDeclaration && getName() == other.getName() && origin == other.origin
other is KotlinLightMethodForDeclaration &&
getName() == other.getName() &&
origin == other.origin &&
getContainingClass() == other.getContainingClass()
override fun hashCode(): Int = getName().hashCode() * 31 + origin.hashCode()
override fun hashCode(): Int = (getName().hashCode() * 31 + origin.hashCode()) * 31 + getContainingClass()!!.hashCode()
}
@@ -0,0 +1,6 @@
class C {
public C(B b, A a) {
a.foo();
b.foo();
}
}
@@ -0,0 +1,6 @@
public trait A {
public fun foo() {}
}
public class B: A {
}
@@ -69,4 +69,8 @@ public class KotlinAndJavaCheckerTest extends KotlinDaemonAnalyzerTestCase {
public void testUseKotlinSubclassesOfMappedTypes() throws Exception {
doTest(true, true, "UseKotlinSubclassesOfMappedTypes.java", "UseKotlinSubclassesOfMappedTypes.kt");
}
public void testImplementedMethodsFromTraits() throws Exception {
doTest(true, true, "ImplementedMethodsFromTraits.java", "ImplementedMethodsFromTraits.kt");
}
}