mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-highlighting] Report static fields that collide with record components
Fixes IDEA-246454 bad code is green: record component already defined GitOrigin-RevId: 1b2a48c0eb0b543ec9d60d7ed3cf2b3aabc3330c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4dfb7b9999
commit
874d090e21
+2
@@ -651,6 +651,8 @@ public final class HighlightUtil {
|
||||
PsiField fieldByName = aClass.findFieldByName(variable.getName(), false);
|
||||
if (fieldByName != null && fieldByName != field) {
|
||||
oldVariable = fieldByName;
|
||||
} else {
|
||||
oldVariable = ContainerUtil.find(aClass.getRecordComponents(), c -> c.getName().equals(field.getName()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
+3
@@ -66,4 +66,7 @@ record ProhibitedMembers() {
|
||||
System.out.println("initializer");
|
||||
}</error>
|
||||
<error descr="Modifier 'native' not allowed here">native</error> void test();
|
||||
}
|
||||
record StaticFieldCollides(int i) {
|
||||
static int <error descr="Variable 'i' is already defined in the scope">i</error>;
|
||||
}
|
||||
Reference in New Issue
Block a user