src/jdk/nashorn/internal/runtime/linker/JavaSuperAdapter.java

Print this page
rev 1199 : 8072595: nashorn should not use obj.getClass() for null checks
Reviewed-by: hannesw, attila

*** 23,42 **** * questions. */ package jdk.nashorn.internal.runtime.linker; /** * Represents a an adapter for invoking superclass methods on an adapter instance generated by * {@code JavaAdapterBytecodeGenerator}. Note that objects of this class are just wrappers around the adapter instances, * without any behavior. All the behavior is defined in the {@code JavaSuperAdapterLinker}. */ class JavaSuperAdapter { private final Object adapter; JavaSuperAdapter(final Object adapter) { ! adapter.getClass(); // NPE check this.adapter = adapter; } public Object getAdapter() { return adapter; --- 23,44 ---- * questions. */ package jdk.nashorn.internal.runtime.linker; + import java.util.Objects; + /** * Represents a an adapter for invoking superclass methods on an adapter instance generated by * {@code JavaAdapterBytecodeGenerator}. Note that objects of this class are just wrappers around the adapter instances, * without any behavior. All the behavior is defined in the {@code JavaSuperAdapterLinker}. */ class JavaSuperAdapter { private final Object adapter; JavaSuperAdapter(final Object adapter) { ! Objects.requireNonNull(adapter); this.adapter = adapter; } public Object getAdapter() { return adapter;