diff options
Diffstat (limited to 'java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java')
-rw-r--r-- | java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java index 1e887030dcb4..416226e9ac8f 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java @@ -245,11 +245,14 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp PsiParameter[] candidateParams = method.getParameterList().getParameters(); if (candidateParams.length == 1) { if (TypeConversionUtil.areTypesConvertible(candidateParams[0].getType(), parameters[0].getType())) { - for (PsiMethod superMethod : psiMethod.findDeepestSuperMethods()) { - PsiMethod validSuperMethod = ensureNonAmbiguousMethod(parameters, superMethod); - if (validSuperMethod != null) return validSuperMethod; + final PsiMethod[] deepestSuperMethods = psiMethod.findDeepestSuperMethods(); + if (deepestSuperMethods.length > 0) { + for (PsiMethod superMethod : deepestSuperMethods) { + PsiMethod validSuperMethod = ensureNonAmbiguousMethod(parameters, superMethod); + if (validSuperMethod != null) return validSuperMethod; + } + return null; } - return null; } } } |