jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java
changeset 37347 f6abe5d4bb1d
parent 29986 97167d851fc4
child 37363 329dba26ffd2
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java	Wed Apr 13 14:29:25 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java	Wed Apr 13 15:48:14 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -216,13 +216,7 @@
     }
 
     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());
     }
 
     /**