src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java

Print this page
rev 17771 : 8184777: species logic for BoundMethodHandle doesn't scale, needs refactor

@@ -25,10 +25,12 @@
 
 package java.lang.invoke;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
+
 import static java.lang.invoke.LambdaForm.*;
 import static java.lang.invoke.LambdaForm.BasicType.*;
 
 /** Working storage for an LF that is being transformed.
  *  Similarly to a StringBuffer, the editing can take place in multiple steps.

@@ -323,19 +325,19 @@
 
     /** Replace any Name whose function is in oldFns with a copy
      *  whose function is in the corresponding position in newFns.
      *  Only do this if the arguments are exactly equal to the given.
      */
-    LambdaFormBuffer replaceFunctions(NamedFunction[] oldFns, NamedFunction[] newFns,
+    LambdaFormBuffer replaceFunctions(List<NamedFunction> oldFns, List<NamedFunction> newFns,
                                       Object... forArguments) {
         assert(inTrans());
-        if (oldFns.length == 0)  return this;
+        if (oldFns.size() == 0)  return this;
         for (int i = arity; i < length; i++) {
             Name n = names[i];
-            int nfi = indexOf(n.function, oldFns);
+            int nfi = oldFns.indexOf(n.function);
             if (nfi >= 0 && Arrays.equals(n.arguments, forArguments)) {
-                changeName(i, new Name(newFns[nfi], n.arguments));
+                changeName(i, new Name(newFns.get(nfi), n.arguments));
             }
         }
         return this;
     }