I often see java SourceCode where a null as value for a method or constructor is not allowed. A Typical implementation of this looks like
public void someMethod(Object someObject){
if(someObject == null) throw new NullPointerException()
someObject.aMethodCall()
}
I see no sense for myself in that at all, because if I attempt to call a Method on a nullPointer the NullPointerException is thrown anyways. I would see a sense if this method would throw an IllegalArgumentException or some other custom-made exception. Can someone clearify , why this check seems to makes sense (as I see it very often I'm assuming, that there has to be sense behind that), or why it's complete nonsense