Java SE 7 Spec (http://docs.oracle.com/javase/7/docs/api/), java.util.ServiceLoader<S> section says:
"Unless otherwise specified, passing a null argument to any method in this class will cause a NullPointerException to be thrown."
According to the Spec, the statement ServiceLoader.load(null) should throw an NPE.
But actually it throws nothing, as can be checked by the following simple test:
public class Test {
public static void main(String[] args) {
try {
java.util.ServiceLoader.load(null);
System.out.println("Failed: NPE is not thrown");
} catch (NullPointerException e) {
System.out.println("OK");
}
}
}
"Unless otherwise specified, passing a null argument to any method in this class will cause a NullPointerException to be thrown."
According to the Spec, the statement ServiceLoader.load(null) should throw an NPE.
But actually it throws nothing, as can be checked by the following simple test:
public class Test {
public static void main(String[] args) {
try {
java.util.ServiceLoader.load(null);
System.out.println("Failed: NPE is not thrown");
} catch (NullPointerException e) {
System.out.println("OK");
}
}
}