mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: accept more patterns (IJ-CR-144289)
GitOrigin-RevId: c0692f8c924b32988ec98aae86c1ad9b466cb45a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b847b27f2c
commit
c3189981f6
+1
-1
@@ -231,7 +231,7 @@ public class EqualsWhichDoesntCheckParameterClassInspection extends BaseInspecti
|
||||
.map(PsiSwitchLabelStatementBase::getCaseLabelElementList)
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(list -> Arrays.stream(list.getElements()))
|
||||
.anyMatch(element -> element instanceof PsiTypeTestPattern);
|
||||
.anyMatch(element -> element instanceof PsiPrimaryPattern);
|
||||
if (checksType) makeChecked();
|
||||
}
|
||||
|
||||
|
||||
+12
-1
@@ -158,4 +158,15 @@ final class MyClass implements MyInterface {
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
record MyRecord(String str) {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) { // "'equals()' should check the class of its parameter" is falsely reported
|
||||
if (this == o) return true;
|
||||
return switch (o) {
|
||||
case MyRecord(String s) when s != null -> Objects.equals(str, s);
|
||||
case null, default -> false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user