summaryrefslogtreecommitdiff
path: root/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-07-25 13:10:36 -0700
committerTor Norbye <tnorbye@google.com>2014-07-25 13:10:36 -0700
commite5266e2343c8d275d79fa0be725180d0fe3a993c (patch)
tree0ba72f5de1949e0527874a799baa224cbe1537e0 /java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
parentb03a5855292feb8c331815f883fe64372aacd872 (diff)
parent2e5965e996aad62ab1338b09d54caaf99ff3dd6a (diff)
downloadidea-e5266e2343c8d275d79fa0be725180d0fe3a993c.tar.gz
Merge remote-tracking branch 'aosp/upstream-master' into merge
Conflicts: .idea/modules.xml Change-Id: I5e3d04bc83cdc26b2b56fca66b44b1dd8941b143
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.java11
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;
}
}
}