jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java
changeset 26466 3bbb6a284bd4
parent 25991 e48157b42439
child 26467 d69abed3a07d
equal deleted inserted replaced
26465:5ff735dd0d52 26466:3bbb6a284bd4
    26 package java.lang.invoke;
    26 package java.lang.invoke;
    27 
    27 
    28 
    28 
    29 import java.util.*;
    29 import java.util.*;
    30 import java.lang.invoke.LambdaForm.BasicType;
    30 import java.lang.invoke.LambdaForm.BasicType;
    31 import sun.invoke.util.*;
       
    32 import sun.misc.Unsafe;
    31 import sun.misc.Unsafe;
    33 
    32 
    34 import static java.lang.invoke.MethodHandleStatics.*;
    33 import static java.lang.invoke.MethodHandleStatics.*;
    35 import static java.lang.invoke.LambdaForm.BasicType.*;
    34 import static java.lang.invoke.LambdaForm.BasicType.*;
    36 
    35 
   986         asCollectorChecks(arrayType, arrayLength);
   985         asCollectorChecks(arrayType, arrayLength);
   987         int collectArgPos = type().parameterCount()-1;
   986         int collectArgPos = type().parameterCount()-1;
   988         MethodHandle target = this;
   987         MethodHandle target = this;
   989         if (arrayType != type().parameterType(collectArgPos))
   988         if (arrayType != type().parameterType(collectArgPos))
   990             target = convertArguments(type().changeParameterType(collectArgPos, arrayType));
   989             target = convertArguments(type().changeParameterType(collectArgPos, arrayType));
   991         MethodHandle collector = ValueConversions.varargsArray(arrayType, arrayLength);
   990         MethodHandle collector = MethodHandleImpl.varargsArray(arrayType, arrayLength);
   992         return MethodHandles.collectArguments(target, collectArgPos, collector);
   991         return MethodHandles.collectArguments(target, collectArgPos, collector);
   993     }
   992     }
   994 
   993 
   995     // private API: return true if last param exactly matches arrayType
   994     // private API: return true if last param exactly matches arrayType
   996     private boolean asCollectorChecks(Class<?> arrayType, int arrayLength) {
   995     private boolean asCollectorChecks(Class<?> arrayType, int arrayLength) {