< prev index next >
src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -214,17 +214,11 @@
}
return intfc.cast(proxy);
}
private static MethodHandle bindCaller(MethodHandle target, Class<?> hostClass) {
- MethodHandle cbmh = MethodHandleImpl.bindCaller(target, hostClass);
- if (target.isVarargsCollector()) {
- MethodType type = cbmh.type();
- int arity = type.parameterCount();
- return cbmh.asVarargsCollector(type.parameterType(arity-1));
- }
- return cbmh;
+ return MethodHandleImpl.bindCaller(target, hostClass).withVarargs(target.isVarargsCollector());
}
/**
* Determines if the given object was produced by a call to {@link #asInterfaceInstance asInterfaceInstance}.
* @param x any reference
< prev index next >