It should be NullPointerException. The convention enforced by Guava's NullPointerTester is that all parameters not annotated @Nullable must cause method invocation to result in an NPE if that parameter is null.
There's another thing worth mentioning regarding the use of checkNotNull. Don't take this at face value because this is merely a suspicion. I know very little about how JVM magic works. But if I recall correctly, the JVM profiler maintains a branch counter for every single if (foo == null) { ... } statement. I imagine it does this so HotSpot can generate assembly with branch prediction instructions? I have no idea. But there's a possibility that using checkNotNull will significantly reduce the amount of memory used by the JVM branch counting, assuming you have tens of thousands of CNN's in your app. But I'm just guessing here.
26
u/jart Jul 11 '15
It should be
NullPointerException. The convention enforced by Guava'sNullPointerTesteris that all parameters not annotated@Nullablemust cause method invocation to result in an NPE if that parameter isnull.