mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
PsiDocMethodOrFieldRef: fixed javadoc resolve for references without param types (IDEA-205390)
This commit is contained in:
@@ -96,7 +96,7 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
|
||||
}
|
||||
}
|
||||
|
||||
final PsiType[] parameterTypes;
|
||||
final MethodSignature methodSignature;
|
||||
if (signature != null) {
|
||||
final List<PsiType> types = ContainerUtil.newArrayListWithCapacity(signature.length);
|
||||
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(element.getProject());
|
||||
@@ -108,16 +108,14 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
|
||||
types.add(PsiType.NULL);
|
||||
}
|
||||
}
|
||||
parameterTypes = types.toArray(PsiType.createArray(types.size()));
|
||||
methodSignature = MethodSignatureUtil.createMethodSignature(name, types.toArray(PsiType.createArray(types.size())),
|
||||
PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY,
|
||||
name.equals(scope.getName()));
|
||||
}
|
||||
else {
|
||||
parameterTypes = PsiType.EMPTY_ARRAY;
|
||||
methodSignature = null;
|
||||
}
|
||||
|
||||
final MethodSignature methodSignature = MethodSignatureUtil.createMethodSignature(name, parameterTypes,
|
||||
PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY,
|
||||
name.equals(scope.getName()));
|
||||
|
||||
PsiMethod method = findMethod(methodSignature, name, getAllMethods(scope, this));
|
||||
|
||||
if (method != null) {
|
||||
@@ -205,10 +203,10 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiMethod findMethod(@NotNull MethodSignature methodSignature, @Nullable String name, @NotNull PsiMethod[] allMethods) {
|
||||
public static PsiMethod findMethod(@Nullable MethodSignature methodSignature, @Nullable String name, @NotNull PsiMethod[] allMethods) {
|
||||
for (PsiMethod method : allMethods) {
|
||||
if (method.getName().equals(name) &&
|
||||
MethodSignatureUtil.areSignaturesErasureEqual(methodSignature, method.getSignature(PsiSubstitutor.EMPTY))) {
|
||||
(methodSignature == null || MethodSignatureUtil.areSignaturesErasureEqual(methodSignature, method.getSignature(PsiSubstitutor.EMPTY)))) {
|
||||
return method;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* {@link #foo}
|
||||
*/
|
||||
class Foo {
|
||||
void foo(Foo p1, Foo p2) {
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,7 @@ public class JavadocHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testSee5() { doTest(); }
|
||||
public void testSee6() { doTest(); }
|
||||
public void testLinkToItself() { doTest(); }
|
||||
public void testLinkToMethodNoParams() { doTest(); }
|
||||
public void testSeeConstants() { doTest(); }
|
||||
public void testSeeNonRefs() { doTest(); }
|
||||
public void testReturn0() { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user