src/share/classes/javax/annotation/processing/AbstractProcessor.java

Print this page

        

@@ -26,10 +26,11 @@
 package javax.annotation.processing;
 
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+import java.util.Objects;
 import javax.lang.model.element.*;
 import javax.lang.model.SourceVersion;
 import javax.tools.Diagnostic;
 
 /**

@@ -144,12 +145,11 @@
      * @throws IllegalStateException if this method is called more than once.
      */
     public synchronized void init(ProcessingEnvironment processingEnv) {
         if (initialized)
             throw new IllegalStateException("Cannot call init more than once.");
-        if (processingEnv == null)
-            throw new NullPointerException("Tool provided null ProcessingEnvironment");
+        Objects.requireNonNull(processingEnv, "Tool provided null ProcessingEnvironment");
 
         this.processingEnv = processingEnv;
         initialized = true;
     }