changeset 47930:13415772f06a

8191442: Regression in LambdaFormBuffer.replaceFunctions Reviewed-by: vlivanov
author redestad
date Fri, 17 Nov 2017 15:43:12 +0100
parents 76519338df34
children 0545aafc7136
files src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java	Fri Nov 17 08:12:02 2017 -0600
+++ b/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java	Fri Nov 17 15:43:12 2017 +0100
@@ -115,9 +115,9 @@
         return true;
     }
 
-    private static int indexOf(NamedFunction fn, NamedFunction[] fns) {
-        for (int i = 0; i < fns.length; i++) {
-            if (fns[i] == fn)  return i;
+    private static int indexOf(NamedFunction fn, List<NamedFunction> fns) {
+        for (int i = 0; i < fns.size(); i++) {
+            if (fns.get(i) == fn)  return i;
         }
         return -1;
     }
@@ -333,7 +333,7 @@
         if (oldFns.isEmpty())  return this;
         for (int i = arity; i < length; i++) {
             Name n = names[i];
-            int nfi = oldFns.indexOf(n.function);
+            int nfi = indexOf(n.function, oldFns);
             if (nfi >= 0 && Arrays.equals(n.arguments, forArguments)) {
                 changeName(i, new Name(newFns.get(nfi), n.arguments));
             }