changeset 8464:edad6c9e1bd7

8155985: Persistent Parameter Processing Reviewed-by: jrose, vlivanov, ahgross
author mhaupt
date Wed, 13 Jul 2016 20:49:11 +0100
parents 1bd8382967aa
children d2343d3a1892
files src/share/classes/java/lang/invoke/MethodHandles.java
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/invoke/MethodHandles.java	Mon Apr 04 15:48:23 2016 +0300
+++ b/src/share/classes/java/lang/invoke/MethodHandles.java	Wed Jul 13 20:49:11 2016 +0100
@@ -1942,6 +1942,7 @@
      */
     public static
     MethodHandle dropArguments(MethodHandle target, int pos, List<Class<?>> valueTypes) {
+        valueTypes = copyTypes(valueTypes);
         MethodType oldType = target.type();  // get NPE
         int dropped = valueTypes.size();
         MethodType.checkSlotCount(dropped);
@@ -1957,6 +1958,11 @@
         return target.dropArguments(newType, pos, dropped);
     }
 
+    private static List<Class<?>> copyTypes(List<Class<?>> types) {
+        Object[] a = types.toArray();
+        return Arrays.asList((Class<?>[]) Arrays.copyOf(a, a.length, Class[].class));
+    }
+
     /**
      * Produces a method handle which will discard some dummy arguments
      * before calling some other specified <i>target</i> method handle.