News for hackers. Stuff that matters.
Re:My most common code review suggestions by qznc on Thursday December 07, 2017 @08:46AM (#15869891)
What is the point? How is an assert better than a NullPointerException?

If asserts are disabled, then the null pointer checks are still inserted by the JVM.

Re:My most common code review suggestions by cpburns2009 on Thursday December 07, 2017 @11:38AM (#15871506)
The benefit of using an assert is that it makes the error condition known immediately to the caller and the reason. Otherwise, whose to say when the NPE will occur. It could be raised just a couple lines down, or it could be a couple methods or a classes away which increases the complexity of diagnosing the actual cause of the error.