filter out references in javadoc to fix IDEA-185139 A method's call hierarchy shows also references
This commit is contained in:
committed by
Nikita Bobko
parent
89aa15c419
commit
a79efd0768
@@ -14,6 +14,7 @@ import com.intellij.psi.PsiElement
|
|||||||
import com.intellij.psi.PsiMember
|
import com.intellij.psi.PsiMember
|
||||||
import com.intellij.psi.PsiMethod
|
import com.intellij.psi.PsiMethod
|
||||||
import com.intellij.psi.PsiReference
|
import com.intellij.psi.PsiReference
|
||||||
|
import com.intellij.psi.impl.source.resolve.JavaResolveUtil
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
import com.intellij.psi.util.PsiTreeUtil
|
||||||
import com.intellij.util.ArrayUtil
|
import com.intellij.util.ArrayUtil
|
||||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||||
@@ -96,7 +97,10 @@ class KotlinCallerTreeStructure(
|
|||||||
|
|
||||||
// If reference belongs to property initializer, show enclosing declaration instead
|
// If reference belongs to property initializer, show enclosing declaration instead
|
||||||
elementToSearch.processAllUsages(findOptions) {
|
elementToSearch.processAllUsages(findOptions) {
|
||||||
processReference(it.reference, it.element ?: return@processAllUsages, nodeDescriptor, callerToDescriptorMap, false)
|
val refElement = it.element
|
||||||
|
if (refElement != null && !JavaResolveUtil.isInJavaDoc(refElement)) {
|
||||||
|
processReference(it.reference, refElement, nodeDescriptor, callerToDescriptorMap, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return callerToDescriptorMap.values
|
return callerToDescriptorMap.values
|
||||||
@@ -129,4 +133,4 @@ class KotlinCallerTreeStructure(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun isAlwaysShowPlus() = true
|
override fun isAlwaysShowPlus() = true
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
<node text="K.persist() ()" base="true">
|
||||||
|
</node>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
open class K {
|
||||||
|
public fun <caret>persist() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
class X extends K {
|
||||||
|
/**
|
||||||
|
* see {@link #persist()}
|
||||||
|
*/
|
||||||
|
int f() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -314,6 +314,11 @@ public class HierarchyTestGenerated extends AbstractHierarchyTest {
|
|||||||
runTest("idea/testData/hierarchy/calls/callers/callInsideLambda/");
|
runTest("idea/testData/hierarchy/calls/callers/callInsideLambda/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("insideJavadoc")
|
||||||
|
public void testInsideJavadoc() throws Exception {
|
||||||
|
runTest("idea/testData/hierarchy/calls/callers/insideJavadoc/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kotlinClass")
|
@TestMetadata("kotlinClass")
|
||||||
public void testKotlinClass() throws Exception {
|
public void testKotlinClass() throws Exception {
|
||||||
runTest("idea/testData/hierarchy/calls/callers/kotlinClass/");
|
runTest("idea/testData/hierarchy/calls/callers/kotlinClass/");
|
||||||
|
|||||||
Reference in New Issue
Block a user