The following code is from Oracle's JDK java.util.logging.LogRecord
public LogRecord(Level level, String msg) {
// Make sure level isn't null, by calling random method.
level.getClass();
this.level = level;
message = msg;
// Assign a thread ID and a unique sequence number.
sequenceNumber = globalSequenceNumber.getAndIncrement();
threadID = defaultThreadID();
millis = System.currentTimeMillis();
needToInferCaller = true; }
Does someone knows if there are any good reason to do this
// Make sure level isn't null, by calling random method.
level.getClass();
Instead of this?
if (level == null) throw new NullPointerException();