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 2023/06/09 15:29:00 UTC
[jira] [Updated] (GROOVY-6939) Calling "each" on an untyped model variable with two arguments causes doCall error
[ https://issues.apache.org/jira/browse/GROOVY-6939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-6939:
--------------------------------
Priority: Major (was: Minor)
> Calling "each" on an untyped model variable with two arguments causes doCall error
> ----------------------------------------------------------------------------------
>
> Key: GROOVY-6939
> URL: https://issues.apache.org/jira/browse/GROOVY-6939
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.3.4, 2.4.0-rc-1
> Reporter: Cédric Champeau
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-alpha-1
>
>
> With the following code, the markup builder will recognize a call to the {{each}} method, but at runtime, it throws an error:
> {code}
> MarkupTemplateEngine engine = new MarkupTemplateEngine(new TemplateConfiguration())
> def template = engine.createTemplate '''
> groups.each { k, v -> li(k) }
> '''
> def model = [groups:[a:'Group a',b:'Group b']]
> String rendered = template.make(model)
> {code}
> The error is:
> {noformat}
> groovy.lang.MissingMethodException: No signature of method: GeneratedMarkupTemplate0$_run_closure1.doCall() is applicable for argument types: (java.util.LinkedHashMap$Entry) values: [a=Group a]
> Possible solutions: doCall(java.lang.Object, java.lang.Object), findAll(), findAll(), isCase(java.lang.Object), isCase(java.lang.Object)
> at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:270)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
> at groovy.lang.Closure.call(Closure.java:423)
> at groovy.lang.Closure.call(Closure.java:439)
> at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1380)
> at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1311)
> at GeneratedMarkupTemplate0.run(GeneratedMarkupTemplate0:2)
> at groovy.text.markup.BaseTemplate.writeTo(BaseTemplate.java:468)
> at groovy.lang.Writable$writeTo.call(Unknown Source)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)