don't override first field by same named second (IDEA-174523)

This commit is contained in:
Anna Kozlova
2017-06-16 11:51:12 +03:00
parent c9f38674c2
commit 5d8e3f67a1
3 changed files with 8 additions and 1 deletions

View File

@@ -149,7 +149,7 @@ public class ClassInnerStuffCache {
Map<String, PsiField> cachedFields = new THashMap<>();
for (PsiField field : fields) {
String name = field.getName();
if (!(field instanceof ExternallyDefinedPsiElement) || !cachedFields.containsKey(name)) {
if (!cachedFields.containsKey(name)) {
cachedFields.put(name, field);
}
}

View File

@@ -0,0 +1,4 @@
class Test {
int i;
int <error descr="Variable 'i' is already defined in the scope">i</error>;
}

View File

@@ -80,6 +80,9 @@ public class LightAdvHighlightingJdk6Test extends LightDaemonAnalyzerTestCase {
public void testThisInArgListOfAnonymous() {
doTest(false, false);
}
public void testSameFieldNameErrorOnSecond() {
doTest(false, false);
}
public void testEnumConstantWithoutInterfaceImplementation() throws Exception {
doTest(false, false);