mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
ambiguous constants references: shadowing (IDEA-146058)
This commit is contained in:
@@ -69,10 +69,10 @@ public class JavaVariableConflictResolver implements PsiConflictResolver{
|
||||
Boolean oldClassIsInheritor = null;
|
||||
if (newClass != null && oldClass != null) {
|
||||
if (newClass.isInheritor(oldClass, true)) {
|
||||
if (!(scope instanceof PsiClass) ||
|
||||
scope.equals(oldClass) ||
|
||||
if (scope != null &&
|
||||
(scope.equals(oldClass) ||
|
||||
scope.equals(newClass) ||
|
||||
!((PsiClass)scope).isInheritorDeep(oldClass, newClass)) {
|
||||
!((PsiClass)scope).isInheritorDeep(oldClass, newClass))) {
|
||||
// candidate is better
|
||||
conflicts.remove(currentResult);
|
||||
currentResult = candidate;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
class MultipleInheritance {
|
||||
interface A {
|
||||
int X = 1;
|
||||
}
|
||||
|
||||
interface B extends A {
|
||||
int X = 2;
|
||||
}
|
||||
|
||||
interface C extends A, B {
|
||||
int Y = C.<error descr="Reference to 'X' is ambiguous, both 'A.X' and 'B.X' match">X</error>;
|
||||
}
|
||||
}
|
||||
|
||||
class Shadowing {
|
||||
interface A {
|
||||
int X = 1;
|
||||
}
|
||||
|
||||
interface B extends A {
|
||||
int X = 2;
|
||||
}
|
||||
|
||||
interface C extends B {
|
||||
int Y = C.X;
|
||||
}
|
||||
}
|
||||
@@ -379,6 +379,10 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testAmbiguousConstants() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testInsane() throws IOException {
|
||||
configureFromFileText("x.java", "class X { \nx_x_x_x\n }");
|
||||
List<HighlightInfo> infos = highlightErrors();
|
||||
|
||||
Reference in New Issue
Block a user