IG: don't check super methods when method is static (thanks to Daniil Ovchinnikov)

This commit is contained in:
Bas Leijdekkers
2017-04-18 14:23:55 +02:00
parent c99fe5e8d2
commit ea8e79d08d
2 changed files with 9 additions and 2 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,7 +78,7 @@ public class LambdaUnfriendlyMethodOverloadInspectionBase extends BaseInspection
return;
}
final String name = method.getName();
for (PsiMethod sameNameMethod : containingClass.findMethodsByName(name, true)) {
for (PsiMethod sameNameMethod : containingClass.findMethodsByName(name, !method.hasModifierProperty(PsiModifier.STATIC))) {
if (method.equals(sameNameMethod) || PsiSuperMethodUtil.isSuperMethod(method, sameNameMethod)) {
continue;
}
@@ -55,4 +55,11 @@ class Generics<M, K> {
void <warning descr="Lambda unfriendly overload of method 'm()'">m</warning>(IntFunction r, M l) {}
void <warning descr="Lambda unfriendly overload of method 'm()'">m</warning>(Function f, K l) {}
}
class A {
static void foo(Function f) {}
}
class B extends A {
static void foo(IntFunction f) {}
}