mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not search null-literal argument for notnull var-arg parameter IDEA-160134
This commit is contained in:
+4
@@ -42,6 +42,10 @@ public class JavaNullMethodArgumentUtil {
|
||||
}
|
||||
|
||||
public static void searchNullArgument(@NotNull PsiMethod method, final int argumentIdx, @NotNull Processor<PsiExpression> nullArgumentProcessor) {
|
||||
final PsiParameter parameter = method.getParameterList().getParameters()[argumentIdx];
|
||||
if (parameter.getType() instanceof PsiEllipsisType) {
|
||||
return;
|
||||
}
|
||||
final GlobalSearchScope scope = findScopeWhereNullArgumentCanPass(method, argumentIdx);
|
||||
if (scope == null) return;
|
||||
MethodReferencesSearch.search(method, scope, true).forEach(ref -> {
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class Test {
|
||||
static void someMethod(@NotNull Object... varargParameter) {
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
someMethod(null, null);
|
||||
}
|
||||
}
|
||||
@@ -171,6 +171,10 @@ public class NullableStuffInspectionTest extends LightCodeInsightFixtureTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNullPassedAsPartNotNullAnnotatedOfVarArg() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testHonorParameterDefaultInSetters() {
|
||||
DataFlowInspectionTest.addJavaxNullabilityAnnotations(myFixture);
|
||||
DataFlowInspectionTest.addJavaxDefaultNullabilityAnnotations(myFixture);
|
||||
|
||||
Reference in New Issue
Block a user