Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.4, 2.4.0-rc-1
-
None
-
None
Description
With the following code, the markup builder will recognize a call to the each method, but at runtime, it throws an error:
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)
The error is:
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)
Attachments
Issue Links
- relates to
-
GROOVY-8247 AIOOBE in StaticTypeCheckingVisitor with SAM and explicit closure parameter
- Closed
-
GROOVY-8499 Glitch with native lambda support when supplied with incorrect arity lambda
- Closed
-
GROOVY-10731 Exceptions thrown from MarkupTemplateEngine when map accessors and GString interpolation are used
- Closed
-
GROOVY-11089 STC: closure param type inference for array and list
- Closed
-
GROOVY-8816 NPE in inferClosureParameterTypes with CompileStatic and incorrect zero-arg closure
- Closed
-
GROOVY-9854 STC doesn't consider switch-expression type for closure cases
- Closed