src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardedInvocation.java
Print this page
*** 89,98 ****
--- 89,99 ----
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.invoke.SwitchPoint;
import java.lang.invoke.WrongMethodTypeException;
import java.util.List;
+ import java.util.Objects;
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.support.Guards;
/**
* Represents a conditionally valid method handle. It is an immutable triple of an invocation method handle, a guard
*** 168,179 ****
* @param exception the optional exception type that is expected to be thrown by the invocation and that also
* invalidates the linkage.
* @throws NullPointerException if invocation is null.
*/
public GuardedInvocation(final MethodHandle invocation, final MethodHandle guard, final SwitchPoint switchPoint, final Class<? extends Throwable> exception) {
! invocation.getClass(); // NPE check
! this.invocation = invocation;
this.guard = guard;
this.switchPoints = switchPoint == null ? null : new SwitchPoint[] { switchPoint };
this.exception = exception;
}
--- 169,179 ----
* @param exception the optional exception type that is expected to be thrown by the invocation and that also
* invalidates the linkage.
* @throws NullPointerException if invocation is null.
*/
public GuardedInvocation(final MethodHandle invocation, final MethodHandle guard, final SwitchPoint switchPoint, final Class<? extends Throwable> exception) {
! this.invocation = Objects.requireNonNull(invocation);
this.guard = guard;
this.switchPoints = switchPoint == null ? null : new SwitchPoint[] { switchPoint };
this.exception = exception;
}
*** 188,199 ****
* @param exception the optional exception type that is expected to be thrown by the invocation and that also
* invalidates the linkage.
* @throws NullPointerException if invocation is null.
*/
public GuardedInvocation(final MethodHandle invocation, final MethodHandle guard, final SwitchPoint[] switchPoints, final Class<? extends Throwable> exception) {
! invocation.getClass(); // NPE check
! this.invocation = invocation;
this.guard = guard;
this.switchPoints = switchPoints == null ? null : switchPoints.clone();
this.exception = exception;
}
--- 188,198 ----
* @param exception the optional exception type that is expected to be thrown by the invocation and that also
* invalidates the linkage.
* @throws NullPointerException if invocation is null.
*/
public GuardedInvocation(final MethodHandle invocation, final MethodHandle guard, final SwitchPoint[] switchPoints, final Class<? extends Throwable> exception) {
! this.invocation = Objects.requireNonNull(invocation);
this.guard = guard;
this.switchPoints = switchPoints == null ? null : switchPoints.clone();
this.exception = exception;
}