mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not report weaker access assignability higher in the hierarchy (IDEA-137533)
This commit is contained in:
+1
@@ -88,6 +88,7 @@ public class HighlightMethodUtil {
|
||||
PsiMethod superMethod = superMethodSignature.getMethod();
|
||||
if (method.hasModifierProperty(PsiModifier.ABSTRACT) && !MethodSignatureUtil.isSuperMethod(superMethod, method)) continue;
|
||||
if (!PsiUtil.isAccessible(containingFile.getProject(), superMethod, method, null)) continue;
|
||||
if (!includeRealPositionInfo && MethodSignatureUtil.isSuperMethod(superMethod, method)) continue;
|
||||
HighlightInfo info = isWeaker(method, modifierList, accessModifier, accessLevel, superMethod, includeRealPositionInfo);
|
||||
if (info != null) return info;
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
|
||||
class F {
|
||||
public void f() {}
|
||||
}
|
||||
|
||||
class E extends F {
|
||||
@Override
|
||||
<error descr="'f()' in 'E' clashes with 'f()' in 'F'; attempting to assign weaker access privileges ('protected'); was 'public'">protected</error> void f() {
|
||||
super.f();
|
||||
}
|
||||
}
|
||||
|
||||
class EE extends E {
|
||||
|
||||
}
|
||||
@@ -467,6 +467,10 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testDontReportWeakerVisibilityProblemUpInHierarchy() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
assertNotNull(collectionsClass);
|
||||
|
||||
Reference in New Issue
Block a user