Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.0, 4.0.1, 4.0.2, 4.0.4, 4.0.5
-
None
Description
I've observed some breaking behavior beginning with v4.0.0 and continuing through the latest 4.0.5-SNAPSHOT. All examples below pass in v3.0.12.
This is a simplification of errors seen when using the japicmp-gradle-plugin v3.0.0 inside the Gradle build; specifically its use of this template to create a HTML report.
There are three different error messages produced, illustrated by the three examples below: [mapLookup, nestedGString, noGString]
Here is a script to reproduce:
import groovy.text.markup.MarkupTemplateEngine; import groovy.text.markup.TemplateConfiguration; def tryTemplate(name, template) { TemplateConfiguration templateConfiguration = new TemplateConfiguration(); templateConfiguration.setAutoNewLine(true); // Removing this fixes nestedGString MarkupTemplateEngine engine = new MarkupTemplateEngine(templateConfiguration); try { println("Trying $name") engine.createTemplate(template) } catch (Throwable e) { println(e.message) } } tryTemplate('mapLookup', ''' def severityMappings = [:] String err = "" // 1. these two lines fail // produces a java.lang.ArrayIndexOutOfBoundsException: size==0 def foo = severityMappings[err] span(class: "label label-${foo}") ''') tryTemplate('nestedGString', ''' def severityMappings = [:] String err = "" // 2. just the span line fails // throws groovy.lang.GroovyRuntimeException: ASM reporting processing error for GeneratedMarkupTemplate121$_run_closure1#doCall with signature java.lang.Object doCall(java.lang.Object) in GeneratedMarkupTemplate121:12. GeneratedMarkupTemplate121 html { span(class: "label label-${severityMappings[err]}") } ''') tryTemplate('noGString', ''' def severityMappings = [:] String err = "" // 3. no GString interpolation fails // BUG! exception in phase 'class generation' in source unit 'GeneratedMarkupTemplate82' Error while popping argument from operand stack tracker in class def foo = "label label-" + severityMappings[err] span(class: foo) ''')
Attachments
Issue Links
- is related to
-
GROOVY-6939 Calling "each" on an untyped model variable with two arguments causes doCall error
- Closed