Community
Participate
Working Groups
Related to https://github.com/golo-lang/golo-lang/issues/277, but more subtle... [1..6]: stream(): map(|v| -> v + 1) vs. let a = 1 [1..6]: stream(): map(|v| -> v + a) The second sample raises a IllegalArgumentException: not a direct method handle. Here the handle is a “real” closure, i.e. it captures values. Thus, it's no more a DirectMethodHandle, since an adaptation is done to close the value, but a BoundMethodHandle$Species_LL, that can't apparently be used as a handle for metafactory. See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8020816 for a similar bug.
yloiseau commented 21 days ago Note that explicitly converting the closure fix the problem: let a = 1 [1..6]: stream(): map(asFunctionalInterface(Function.class, |v| -> v + a)) # ok [1..6]: stream(): map(asInterfaceInstance(Function.class, |v| -> v + a)) # ok so we can say it's a Golo feature (explicit over implicit :wink:)