ClsMethod.getNavigationElement() may be not a method anymore

This commit is contained in:
peter
2010-06-24 17:39:47 +04:00
parent 32daaf7eb0
commit f178c4ddee
2 changed files with 11 additions and 6 deletions
@@ -336,18 +336,23 @@ public class ClsMethodImpl extends ClsRepositoryPsiElement<PsiMethodStub> implem
}
@NotNull
public PsiElement getNavigationElement() {
public PsiMethod getSourceMirrorMethod() {
PsiClass sourceClassMirror = ((ClsClassImpl)getParent()).getSourceMirrorClass();
if (sourceClassMirror == null) return this;
final PsiMethod[] methodsByName = sourceClassMirror.findMethodsByName(getName(), false);
for (PsiMethod sourceMethod : methodsByName) {
if (MethodSignatureUtil.areParametersErasureEqual(this, sourceMethod) && sourceMethod != this) {
return sourceMethod.getNavigationElement();
for (PsiMethod sourceMethod : sourceClassMirror.findMethodsByName(getName(), false)) {
if (MethodSignatureUtil.areParametersErasureEqual(this, sourceMethod)) {
return sourceMethod;
}
}
return this;
}
@NotNull
public PsiElement getNavigationElement() {
final PsiMethod method = getSourceMirrorMethod();
return method != this ? method.getNavigationElement() : this;
}
public PsiTypeParameterList getTypeParameterList() {
return getStub().findChildStubByType(JavaStubElementTypes.TYPE_PARAMETER_LIST).getPsi();
}
@@ -63,7 +63,7 @@ public class ClsParameterImpl extends ClsRepositoryPsiElement<PsiParameterStub>
}
ClsMethodImpl method = (ClsMethodImpl)getDeclarationScope();
PsiMethod sourceMethod = (PsiMethod)method.getNavigationElement();
PsiMethod sourceMethod = method.getSourceMirrorMethod();
if (sourceMethod == method) {
final PsiParameterStubImpl parameterStub = (PsiParameterStubImpl) getStub();
if (!parameterStub.isAutoGeneratedName()) {