codeconsole opened a new pull request, #3116:
URL: https://github.com/apache/groovy/pull/3116
Master fails to load an interface with a statically compiled method
reference that takes a `String`, and
`MethodReferenceTest.testMethodReferencesInStaticAndDefaultMethodsOfInterface`
fails on every JDK since #3056 was merged:
```groovy
@groovy.transform.CompileStatic
interface I {
static java.util.function.Function<String, String> f() { String::trim }
}
I.f() // ClassFormatError: Method gstring$String$trim$1 in class I has
illegal modifiers: 0x101A
```
GROOVY-12536 (#3056) adds a synthetic adapter that converts a `GString`
argument to `String`, created `private static final`. The JVM rejects
`ACC_FINAL` on an interface method (JVMS 4.6). The other helper methods of
method references leave it out in interfaces since GROOVY-12488 (#3022); the
adapter now does the same.
`testMethodReferencesInStaticAndDefaultMethodsOfInterface` also lists the
helper methods of the interface, and now expects the `gstring` adapters there.
## Tests
`MethodReferenceTest.testMethodReferenceTakingStringInInterface` (a
`GString` element through `String::length` in a static interface method and
`String::trim` in a default method) and
`testMethodReferencesInStaticAndDefaultMethodsOfInterface` fail without the
change; `MethodReferenceTest` passes. The Checkstyle and CodeNarc gates pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]