src/jdk/nashorn/internal/codegen/CompileUnit.java
Print this page
rev 1199 : 8072595: nashorn should not use obj.getClass() for null checks
Reviewed-by: hannesw, attila
@@ -24,10 +24,11 @@
*/
package jdk.nashorn.internal.codegen;
import java.io.Serializable;
+import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import jdk.nashorn.internal.ir.CompileUnitHolder;
/**
@@ -111,11 +112,11 @@
/**
* Set class when it exists. Only accessible from compiler
* @param clazz class with code for this compile unit
*/
void setCode(final Class<?> clazz) {
- clazz.getClass(); // null check
+ Objects.requireNonNull(clazz);
this.clazz = clazz;
// Revisit this - refactor to avoid null-ed out non-final fields
// null out emitter
this.classEmitter = null;
}