You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (JIRA)" <ji...@apache.org> on 2019/07/15 15:37:00 UTC
[jira] [Created] (GROOVY-9193) SC: Script method with default
arguments throws IncompatibleClassChangeError
Eric Milles created GROOVY-9193:
-----------------------------------
Summary: SC: Script method with default arguments throws IncompatibleClassChangeError
Key: GROOVY-9193
URL: https://issues.apache.org/jira/browse/GROOVY-9193
Project: Groovy
Issue Type: Bug
Reporter: Eric Milles
Follow up from GROOVY-9151. Consider the following Groovy script:
{code:groovy}
@groovy.transform.CompileStatic
void greet(Object o = 'world', String s = o.toString()) {
print "hello $s"
}
greet()
{code}
NOTE: If the first parameter is changed to any type besides {{Object}}, the script runs as expected. So there must be some special handling for the dynamic parameter type.
When executed this script throws the following exception:
{code}
Exception in thread "main" java.lang.IncompatibleClassChangeError: Expected static method java.lang.Object.toString()Ljava/lang/String;
at Transient.greet(Transient.groovy:13)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:234)
at Transient.run(Transient.groovy:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:123)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1280)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1045)
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:1030)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:1013)
at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:442)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:234)
at script.main(script.groovy)
{code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)