--- old/src/share/classes/java/lang/invoke/MethodHandle.java 2014-07-11 20:08:50.000000000 +0400 +++ new/src/share/classes/java/lang/invoke/MethodHandle.java 2014-07-11 20:08:50.000000000 +0400 @@ -991,8 +991,11 @@ return MethodHandles.collectArguments(target, collectArgPos, collector); } - // private API: return true if last param exactly matches arrayType - private boolean asCollectorChecks(Class arrayType, int arrayLength) { + /** + * See if {@code asCollector} can be validly called with the given arguments. + * Return false if the last parameter is not an exact match to arrayType. + */ + /*non-public*/ boolean asCollectorChecks(Class arrayType, int arrayLength) { spreadArrayChecks(arrayType, arrayLength); int nargs = type().parameterCount(); if (nargs != 0) { @@ -1154,7 +1157,7 @@ * @see #asFixedArity */ public MethodHandle asVarargsCollector(Class arrayType) { - Class arrayElement = arrayType.getComponentType(); + arrayType.getClass(); // explicit NPE boolean lastMatch = asCollectorChecks(arrayType, 0); if (isVarargsCollector() && lastMatch) return this; @@ -1311,6 +1314,7 @@ } throw member.makeAccessException("cannot make variable arity", null); } + /*non-public*/ MethodHandle viewAsType(MethodType newType) { // No actual conversions, just a new view of the same method. @@ -1469,6 +1473,7 @@ /*non-public*/ void updateForm(LambdaForm newForm) { if (form == newForm) return; + assert(this instanceof DirectMethodHandle && this.internalMemberName().isStatic()); // ISSUE: Should we have a memory fence here? UNSAFE.putObject(this, FORM_OFFSET, newForm); this.form.prepare(); // as in MethodHandle.