--- old/src/jdk.dynalink/share/classes/jdk/dynalink/linker/GuardedInvocation.java 2016-01-14 15:29:17.390966400 +0530 +++ new/src/jdk.dynalink/share/classes/jdk/dynalink/linker/GuardedInvocation.java 2016-01-14 15:29:17.020965900 +0530 @@ -202,6 +202,9 @@ this.invocation = Objects.requireNonNull(invocation); this.guard = guard; this.switchPoints = switchPoint == null ? null : new SwitchPoint[] { switchPoint }; + if (exception != null && !Throwable.class.isAssignableFrom(exception)) { + throw new IllegalArgumentException(exception.getName() + " is not assignable from Throwable"); + } this.exception = exception; } @@ -228,6 +231,9 @@ this.invocation = Objects.requireNonNull(invocation); this.guard = guard; this.switchPoints = switchPoints == null ? null : switchPoints.clone(); + if (exception != null && !Throwable.class.isAssignableFrom(exception)) { + throw new IllegalArgumentException(exception.getName() + " is not assignable from Throwable"); + } this.exception = exception; }