mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
[java-dfa] IDEA-354336 Java DFA fails to report nullable var passed to notnull arg after instanceof
GitOrigin-RevId: 2fada677a054fbd049e12e9b585a5f08711a5b26
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c05ea7c662
commit
3b45af56a7
@@ -0,0 +1,22 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class Main {
|
||||
Record foo() {
|
||||
PsiFile file = fooBar();
|
||||
if (file instanceof PsiCompiledFile compiledFile) {
|
||||
return new Record(compiledFile);
|
||||
}
|
||||
return new Record(<warning descr="Argument 'file' might be null">file</warning>);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PsiFile fooBar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
interface PsiFile {}
|
||||
interface PsiCompiledFile extends PsiFile {}
|
||||
|
||||
private record Record(@NotNull PsiFile file) {}
|
||||
}
|
||||
@@ -130,4 +130,6 @@ public class DataFlowInspection21Test extends DataFlowInspectionTestCase {
|
||||
|
||||
public void testArrayElementWrappedInPureMethod() { doTest(); }
|
||||
public void testArrayAddedIntoCollection() { doTest(); }
|
||||
|
||||
public void testInstanceOfPatternAffectNullity() { doTest(); }
|
||||
}
|
||||
Reference in New Issue
Block a user