create method from usage: check corresponding to used subst

This commit is contained in:
anna
2012-11-13 20:18:06 +01:00
parent 37a10553d8
commit 2cbb7c740a
@@ -78,10 +78,11 @@ public class CreateMethodFromUsageFix extends CreateFromUsageBaseFix {
private static boolean isMethodSignatureExists(PsiMethodCallExpression call, PsiClass target) {
String name = call.getMethodExpression().getReferenceName();
final JavaResolveResult resolveResult = call.getMethodExpression().advancedResolve(false);
PsiExpressionList list = call.getArgumentList();
PsiMethod[] methods = target.findMethodsByName(name, false);
for (PsiMethod method : methods) {
if (PsiUtil.isApplicable(method, PsiSubstitutor.EMPTY, list)) return true;
if (PsiUtil.isApplicable(method, resolveResult.getSubstitutor(), list)) return true;
}
return false;
}