mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
MethodCallInstruction: fix vararg handling when varargs are empty
This commit is contained in:
+1
-1
@@ -149,7 +149,7 @@ public class MethodCallInstruction extends Instruction implements ExpressionPush
|
||||
return EMPTY_NULLABILITY_ARRAY;
|
||||
}
|
||||
|
||||
int checkedCount = Math.min(myArgCount, parameters.length) - (myVarArgCall ? 1 : 0);
|
||||
int checkedCount = Math.min(myArgCount, parameters.length - (myVarArgCall ? 1 : 0));
|
||||
|
||||
Nullability[] nullabilities = new Nullability[myArgCount];
|
||||
for (int i = 0; i < checkedCount; i++) {
|
||||
|
||||
@@ -3,8 +3,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
class Test {
|
||||
public static void test(@NotNull Object... objects) { }
|
||||
|
||||
public static void test2(@NotNull Object first, @NotNull Object... rest) { }
|
||||
|
||||
public static void main(String[] args) {
|
||||
Object o = null;
|
||||
test(o);
|
||||
if(Math.random() > 0.5) test(o);
|
||||
if(Math.random() > 0.5) test2(<warning descr="Passing 'null' argument to parameter annotated as @NotNull">o</warning>);
|
||||
if(Math.random() > 0.5) test2(<warning descr="Argument 'o' might be null">o</warning>, o);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user