IDEA-55154: Go To Declaration goes to wrong declaration for Groovy collection api when using generics

This commit is contained in:
Maxim Medvedev
2010-05-20 21:39:21 +04:00
parent 742e68d32b
commit 46d3a38a65
@@ -150,10 +150,10 @@ public class MethodResolverProcessor extends ResolverProcessor {
if (i < argTypes.length) {
PsiType argType = argTypes[i];
final GroovyPsiElement context = (GroovyPsiElement)myPlace;
if (!TypesUtil.isAssignable(paramType, argType, context.getManager(), context.getResolveScope(), false) &&
/*if (!TypesUtil.isAssignable(paramType, argType, context.getManager(), context.getResolveScope(), false) &&
TypesUtil.isAssignableByMethodCallConversion(paramType, argType, context)) {
return paramType;
}
}*/
return argType;
}
return PsiType.NULL;
@@ -263,19 +263,25 @@ public class MethodResolverProcessor extends ResolverProcessor {
return true;
}
//hack for default gdk methods
PsiType[] argTypes = myArgumentTypes;
if (method1 instanceof GrGdkMethod && method2 instanceof GrGdkMethod) {
method1 = ((GrGdkMethod)method1).getStaticMethod();
method2 = ((GrGdkMethod)method2).getStaticMethod();
if (myArgumentTypes != null) {
argTypes = new PsiType[argTypes.length + 1];
System.arraycopy(myArgumentTypes, 0, argTypes, 1, myArgumentTypes.length);
argTypes[0] = myThisType;
}
}
if (myIsConstructor && myArgumentTypes != null && myArgumentTypes.length == 1) {
if (myIsConstructor && argTypes != null && argTypes.length == 1) {
if (method1.getParameterList().getParametersCount() == 0) return true;
if (method2.getParameterList().getParametersCount() == 0) return false;
}
PsiParameter[] params1 = method1.getParameterList().getParameters();
PsiParameter[] params2 = method2.getParameterList().getParameters();
if (myArgumentTypes == null && params1.length != params2.length) return false;
if (argTypes == null && params1.length != params2.length) return false;
if (params1.length < params2.length) {
if (params1.length == 0) return false;
@@ -287,8 +293,8 @@ public class MethodResolverProcessor extends ResolverProcessor {
PsiType type1 = substitutor1.substitute(params1[i].getType());
PsiType type2 = substitutor2.substitute(params2[i].getType());
if (myArgumentTypes != null && myArgumentTypes.length > i) {
PsiType argType = myArgumentTypes[i];
if (argTypes != null && argTypes.length > i) {
PsiType argType = argTypes[i];
if (argType != null) {
final boolean converts1 = TypesUtil.isAssignable(type1, argType, manager, scope, false);
final boolean converts2 = TypesUtil.isAssignable(type2, argType, manager, scope, false);