src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java

Print this page

        

@@ -36,10 +36,11 @@
 import java.util.Deque;
 import java.util.IdentityHashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * Contains utility methods for calculating the memory usage of objects. It
  * only works on the HotSpot JVM, and infers the actual memory layout (32 bit
  * vs. 64 bit word size, compressed object pointers vs. uncompressed) from

@@ -148,11 +149,11 @@
      * {@code memoryLayoutSpecification}.
      *
      * @param memoryLayoutSpecification a description of the JVM memory layout.
      */
     public ObjectSizeCalculator(final MemoryLayoutSpecification memoryLayoutSpecification) {
-        memoryLayoutSpecification.getClass();
+        Objects.requireNonNull(memoryLayoutSpecification);
         arrayHeaderSize = memoryLayoutSpecification.getArrayHeaderSize();
         objectHeaderSize = memoryLayoutSpecification.getObjectHeaderSize();
         objectPadding = memoryLayoutSpecification.getObjectPadding();
         referenceSize = memoryLayoutSpecification.getReferenceSize();
         superclassFieldPadding = memoryLayoutSpecification.getSuperclassFieldPadding();