Fixed find usages for Java's invoke()
This commit is contained in:
@@ -75,7 +75,7 @@ fun PsiReference.matchesTarget(candidateTarget: PsiElement): Boolean {
|
||||
// Optimizations
|
||||
when (this) {
|
||||
is KtInvokeFunctionReference -> {
|
||||
if (candidateTarget !is KtNamedFunction) return false
|
||||
if (candidateTarget !is KtNamedFunction && candidateTarget !is PsiMethod) return false
|
||||
}
|
||||
is KtDestructuringDeclarationReference -> {
|
||||
if (candidateTarget !is KtNamedFunction && candidateTarget !is KtParameter && candidateTarget !is PsiMethod) return false
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// PSI_ELEMENT: com.intellij.psi.PsiMethod
|
||||
// OPTIONS: usages
|
||||
|
||||
public class JavaClass {
|
||||
public void <caret>invoke() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun f(c: JavaClass) {
|
||||
c()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Resolved c()
|
||||
Searched references to JavaClass
|
||||
Searched references to parameter c of f(c: JavaClass) in Kotlin files
|
||||
@@ -0,0 +1 @@
|
||||
Implicit 'invoke' 2 c()
|
||||
@@ -1575,6 +1575,12 @@ public class FindUsagesTestGenerated extends AbstractFindUsagesTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("javaInvoke.0.java")
|
||||
public void testJavaInvoke() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/java/findJavaMethodUsages/javaInvoke.0.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("OverriddenMethodSyntheticAccessor.0.java")
|
||||
public void testOverriddenMethodSyntheticAccessor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/java/findJavaMethodUsages/OverriddenMethodSyntheticAccessor.0.java");
|
||||
|
||||
Reference in New Issue
Block a user