From 35c07dac6571aa77ba9449c5ff9045cccb51367a Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 8 Nov 2013 17:34:31 +0100 Subject: [PATCH] new inference: reject isExact for no constructor parameterized class --- .../PsiMethodReferenceExpressionImpl.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java index 797958ee2a91..9d0d23a10540 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java @@ -84,23 +84,22 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase } else if (isConstructor()) { methods = containingClass.getConstructors(); - if (methods.length == 0) { //default constructor - return containingClass; - } } if (methods != null) { PsiMethod psiMethod = null; - for (PsiMethod method : methods) { - if (PsiUtil.isAccessible(method, this, null)) { - if (psiMethod != null) return null; - psiMethod = method; + if (methods.length > 0) { + for (PsiMethod method : methods) { + if (PsiUtil.isAccessible(method, this, null)) { + if (psiMethod != null) return null; + psiMethod = method; + } + } + if (psiMethod == null) return null; + if (psiMethod.isVarArgs()) return null; + if (psiMethod.getTypeParameters().length > 0) { + final PsiReferenceParameterList parameterList = getParameterList(); + return parameterList != null && parameterList.getTypeParameterElements().length > 0 ? psiMethod : null; } - } - if (psiMethod == null) return null; - if (psiMethod.isVarArgs()) return null; - if (psiMethod.getTypeParameters().length > 0) { - final PsiReferenceParameterList parameterList = getParameterList(); - return parameterList != null && parameterList.getTypeParameterElements().length > 0 ? psiMethod : null; } if (containingClass.hasTypeParameters()) { final PsiElement qualifier = getQualifier(); @@ -119,7 +118,7 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase } } } - return psiMethod; + return psiMethod == null ? containingClass : psiMethod; } } return null;