new inference: exact method reference: decline constructor with parameter with type parameter of class

This commit is contained in:
anna
2013-11-05 19:51:37 +01:00
parent 664ee85163
commit e1b69a4a46
@@ -102,6 +102,16 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
final PsiReferenceParameterList parameterList = getParameterList();
return parameterList != null && parameterList.getTypeParameterElements().length > 0 ? psiMethod : null;
}
if (psiMethod.isConstructor() && containingClass.hasTypeParameters()) {
final PsiElement qualifier = getQualifier();
if (qualifier instanceof PsiTypeElement) {
final PsiJavaCodeReferenceElement referenceElement = ((PsiTypeElement)qualifier).getInnermostComponentReferenceElement();
if (referenceElement != null) {
final PsiReferenceParameterList parameterList = referenceElement.getParameterList();
return parameterList != null && parameterList.getTypeParameterElements().length > 0 ? psiMethod : null;
}
}
}
return psiMethod;
}
}