mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 21:41:24 +07:00
static methods in interfaces can't be hidden in subclasses (IDEA-124921)
This commit is contained in:
@@ -540,6 +540,11 @@ public class GenericsHighlightUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (superMethod.hasModifierProperty(PsiModifier.STATIC) && superContainingClass != null &&
|
||||
superContainingClass.isInterface() && PsiUtil.isLanguageLevel8OrHigher(superContainingClass)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final PsiType retErasure1 = TypeConversionUtil.erasure(checkMethod.getReturnType());
|
||||
final PsiType retErasure2 = TypeConversionUtil.erasure(superMethod.getReturnType());
|
||||
|
||||
|
||||
@@ -1142,6 +1142,7 @@ public class HighlightMethodUtil {
|
||||
}
|
||||
|
||||
if (isMethodStatic) {
|
||||
if (superClass.isInterface()) return null;
|
||||
int accessLevel = PsiUtil.getAccessLevel(modifierList);
|
||||
String accessModifier = PsiUtil.getAccessModifier(accessLevel);
|
||||
HighlightInfo info = isWeaker(method, modifierList, accessModifier, accessLevel, superMethod, true);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
interface StaticBase<T> {
|
||||
static <T> void foo(T t) {}
|
||||
}
|
||||
|
||||
class Foo implements StaticBase<Number> {
|
||||
static <T> void foo(T t){}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public class Interface8MethodsHighlightingTest extends LightCodeInsightFixtureTe
|
||||
public void testFinalStaticDefaultMethods() { doTest(false, false); }
|
||||
public void testIDEA122720() { doTest(false, false); }
|
||||
public void testIDEA123839() { doTest(false, false); }
|
||||
public void testStaticOverloading() { doTest(false, false); }
|
||||
public void testDefaultSupersInStaticContext() {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user