Details
Description
Following code executes without NPE being thrown:
import java.util.Arrays;
public class Test {
public static void main(String[] args) {
Arrays.parallelPrefix(new double[0], null);
Arrays.parallelPrefix(new int[0], null);
Arrays.parallelPrefix(new long[0], null);
Arrays.parallelPrefix(new Object[0], null);
Arrays.parallelPrefix(new double[0], 0, 0, null);
Arrays.parallelPrefix(new int[0], 0, 0, null);
Arrays.parallelPrefix(new long[0], 0, 0, null);
Arrays.parallelPrefix(new Object[0], 0, 0, null);
}
}
However according to spec NPE should be thrown - all the methods contain following:
* @throws NullPointerException if the specified array or function is null
It's understandable that why this happens but anyway behavior should correspond to spec.
The minimized test is attached.
import java.util.Arrays;
public class Test {
public static void main(String[] args) {
Arrays.parallelPrefix(new double[0], null);
Arrays.parallelPrefix(new int[0], null);
Arrays.parallelPrefix(new long[0], null);
Arrays.parallelPrefix(new Object[0], null);
Arrays.parallelPrefix(new double[0], 0, 0, null);
Arrays.parallelPrefix(new int[0], 0, 0, null);
Arrays.parallelPrefix(new long[0], 0, 0, null);
Arrays.parallelPrefix(new Object[0], 0, 0, null);
}
}
However according to spec NPE should be thrown - all the methods contain following:
* @throws NullPointerException if the specified array or function is null
It's understandable that why this happens but anyway behavior should correspond to spec.
The minimized test is attached.