Scott Murphy Heiberg created GROOVY-12591:
---------------------------------------------
Summary: SC: a method reference in an interface fails to load with
ClassFormatError: the GString adapter method is final
Key: GROOVY-12591
URL: https://issues.apache.org/jira/browse/GROOVY-12591
Project: Groovy
Issue Type: Bug
Reporter: Scott Murphy Heiberg
On master, a statically compiled method or constructor reference with a String
parameter inside an interface makes the interface fail to load:
{code:groovy}
@groovy.transform.CompileStatic
interface I {
static java.util.function.Function<String, String> f() { String::trim }
}
I.f()
{code}
{noformat}
java.lang.ClassFormatError: Method gstring$... in class I has illegal
modifiers: 0x101A
{noformat}
GROOVY-12536 adds a synthetic adapter method that converts a GString argument
to String, and creates it {{private static final}}. The JVM rejects
{{ACC_FINAL}} on an interface method (JVMS 4.6). The other helper methods of
method references leave out {{ACC_FINAL}} in interfaces since GROOVY-12488;
each change passed on its own, and together they fail
{{MethodReferenceTest.testMethodReferencesInStaticAndDefaultMethodsOfInterface}}
on master, on every JDK.
Affects master only (7.0.0-SNAPSHOT); no release has both changes.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)