Github user jespersm commented on the pull request:
https://github.com/apache/groovy/commit/c24c0b7e6a67dcdf277207d4261cfa6f2b55031f#commitcomment-27228939
Calling a lambda is different from implementing a lambda (using the
grammar), and need (and should not) depend on it. Consider the following two
methods:
```groovy
@CompileStatic
static String callTheSAMStatic(Function<Integer, String> mySam) {
return mySam.apply(42)
}
static String callTheSAMDynamic(Function<Integer, String> mySam) {
return mySam.apply(42)
}
```
They can call into *any object* which implements Function<Integer, String>
no matter where it came from, not just Groovy native lambdas, obviously.
So maybe I'm confused about what you're trying to do here. I was guessing
that the feature we wanted was to be able to write this instead:
```groovy
@CompileStatic
static String callTheSAMStatic2(Function<Integer, String> mySam) {
return mySam(42)
}
static String callTheSAMDynamic2(Function<Integer, String> mySam) {
return mySam(42)
}
```
This could work perfectly in both the static and dynamic case, and work
independently of how "mySam" was produced. It would be, IMHO, much groovyer
than restricting it to native Groovy lambdas.
That's why I'm saying we should decouple it from the native-lambda branch.
---