mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
check ref in foreach iterated value (IDEA-59874)
This commit is contained in:
@@ -466,6 +466,11 @@ public class NullityInferrer {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (parent instanceof PsiForeachStatement) {
|
||||
if (((PsiForeachStatement)parent).getIteratedValue() == expr) {
|
||||
registerNotNullAnnotation(parameter);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (isNotNull(method)) {
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
class Test {
|
||||
void foo(@NotNull List requests){
|
||||
for (Object request : requests) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import java.util.*;
|
||||
class Test {
|
||||
void foo(List requests){
|
||||
for (Object request : requests) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,10 @@ public class NullityInferrerTest extends CodeInsightTestCase {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testParameterUsedInForeachIteratedValue() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
//-----------------------fields---------------------------------------------------
|
||||
public void testFieldsAssignment() throws Exception {
|
||||
doTest(false);
|
||||
|
||||
Reference in New Issue
Block a user