changeset 5976:20f287fec09f

8009049: Better method handle binding Reviewed-by: jrose, twisti, jdn
author vlivanov
date Fri, 01 Mar 2013 03:50:17 +0400
parents f098e2297ff1
children 9cc342866505
files src/share/classes/sun/invoke/util/Wrapper.java
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/invoke/util/Wrapper.java	Wed Feb 27 13:58:55 2013 -0800
+++ b/src/share/classes/sun/invoke/util/Wrapper.java	Fri Mar 01 03:50:17 2013 +0400
@@ -456,6 +456,9 @@
             // If the target type is an interface, perform no runtime check.
             // (This loophole is safe, and is allowed by the JVM verifier.)
             // If the target type is a primitive, change it to a wrapper.
+            assert(!type.isPrimitive());
+            if (!type.isInterface())
+                type.cast(x);
             @SuppressWarnings("unchecked")
             T result = (T) x;  // unchecked warning is expected here
             return result;