src/jdk/internal/dynalink/beans/StaticClass.java
Print this page
rev 1199 : 8072595: nashorn should not use obj.getClass() for null checks
Reviewed-by: hannesw, attila
@@ -82,10 +82,11 @@
*/
package jdk.internal.dynalink.beans;
import java.io.Serializable;
+import java.util.Objects;
/**
* Object that represents the static facet of a class (its static methods, properties, and fields, as well as
* construction of instances using "dyn:new"). Objects of this class are recognized by the {@link BeansLinker} as being
* special, and operations on them will be linked against the represented class' static facet. The "class" synthetic
@@ -104,12 +105,11 @@
private static final long serialVersionUID = 1L;
private final Class<?> clazz;
/*private*/ StaticClass(final Class<?> clazz) {
- clazz.getClass(); // NPE check
- this.clazz = clazz;
+ this.clazz = Objects.requireNonNull(clazz);
}
/**
* Retrieves the {@link StaticClass} instance for the specified class.
* @param clazz the class for which the static facet is requested.