src/share/classes/java/lang/invoke/MethodHandleImpl.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File jdk Cdiff src/share/classes/java/lang/invoke/MethodHandleImpl.java

src/share/classes/java/lang/invoke/MethodHandleImpl.java

Print this page

        

*** 433,443 **** Class<?> src = lambdaType.parameterType(i); if (i == spreadArgPos) { // Spread the array. MethodHandle aload = MethodHandles.arrayElementGetter(spreadArgType); Name array = names[argIndex]; ! names[nameCursor++] = new Name(NF_checkSpreadArgument, array, spreadArgCount); for (int j = 0; j < spreadArgCount; i++, j++) { indexes[i] = nameCursor; names[nameCursor++] = new Name(aload, array, j); } } else if (i < indexes.length) { --- 433,443 ---- Class<?> src = lambdaType.parameterType(i); if (i == spreadArgPos) { // Spread the array. MethodHandle aload = MethodHandles.arrayElementGetter(spreadArgType); Name array = names[argIndex]; ! names[nameCursor++] = new Name(NF.checkSpreadArgument, array, spreadArgCount); for (int j = 0; j < spreadArgCount; i++, j++) { indexes[i] = nameCursor; names[nameCursor++] = new Name(aload, array, j); } } else if (i < indexes.length) {
*** 478,497 **** if (RAISE_RANDOM_EXCEPTIONS) throw newIllegalArgumentException("Array is not of length "+n); throw new WrongMethodTypeException("Array is not of length "+n); } ! private static final NamedFunction NF_checkSpreadArgument; static { try { ! NF_checkSpreadArgument = new NamedFunction(MethodHandleImpl.class .getDeclaredMethod("checkSpreadArgument", Object.class, int.class)); ! NF_checkSpreadArgument.resolve(); } catch (ReflectiveOperationException ex) { throw newInternalError(ex); } } /** Factory method: Collect or filter selected argument(s). */ static MethodHandle makeCollectArguments(MethodHandle target, MethodHandle collector, int collectArgPos, boolean retainOriginalArgs) { MethodType targetType = target.type(); // (a..., c, [b...])=>r --- 478,503 ---- if (RAISE_RANDOM_EXCEPTIONS) throw newIllegalArgumentException("Array is not of length "+n); throw new WrongMethodTypeException("Array is not of length "+n); } ! /** ! * Pre-initialized NamedFunctions for bootstrapping purposes. ! * Factored in an inner class to delay initialization until first usage. ! */ ! private static class NF { ! static final NamedFunction checkSpreadArgument; static { try { ! checkSpreadArgument = new NamedFunction(MethodHandleImpl.class .getDeclaredMethod("checkSpreadArgument", Object.class, int.class)); ! checkSpreadArgument.resolve(); } catch (ReflectiveOperationException ex) { throw newInternalError(ex); } } + } /** Factory method: Collect or filter selected argument(s). */ static MethodHandle makeCollectArguments(MethodHandle target, MethodHandle collector, int collectArgPos, boolean retainOriginalArgs) { MethodType targetType = target.type(); // (a..., c, [b...])=>r
src/share/classes/java/lang/invoke/MethodHandleImpl.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File