--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Wed Jan 13 17:36:01 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Jan 14 13:53:13 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3120,6 +3120,8 @@
MethodHandle handler) {
MethodType ttype = target.type();
MethodType htype = handler.type();
+ if (!Throwable.class.isAssignableFrom(exType))
+ throw new ClassCastException(exType.getName());
if (htype.parameterCount() < 1 ||
!htype.parameterType(0).isAssignableFrom(exType))
throw newIllegalArgumentException("handler does not accept exception type "+exType);