Fix "Cannot resolve method" error in Java for methods from trait
This commit is contained in:
+5
-2
@@ -112,7 +112,10 @@ public class KotlinLightMethodForDeclaration(
|
|||||||
override fun getUseScope(): SearchScope = origin.getUseScope()
|
override fun getUseScope(): SearchScope = origin.getUseScope()
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean =
|
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 {
|
public void testUseKotlinSubclassesOfMappedTypes() throws Exception {
|
||||||
doTest(true, true, "UseKotlinSubclassesOfMappedTypes.java", "UseKotlinSubclassesOfMappedTypes.kt");
|
doTest(true, true, "UseKotlinSubclassesOfMappedTypes.java", "UseKotlinSubclassesOfMappedTypes.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testImplementedMethodsFromTraits() throws Exception {
|
||||||
|
doTest(true, true, "ImplementedMethodsFromTraits.java", "ImplementedMethodsFromTraits.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user