changeset 4872:ba3e07024008

8009049: Better method handle binding Reviewed-by: jrose, twisti, jdn
author vlivanov
date Fri, 01 Mar 2013 03:50:17 +0400
parents 78dfaa989a38
children 5b067978a725
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	Fri Mar 01 03:50:33 2013 +0400
+++ 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;