Describe the bug
PR #7262 (#7241) routes the four message families the issue named (checks, guards, unique, refuse) through JavaLiterals.escape, and its body says: "Every other authored string the templates write into a Java string literal was still interpolated verbatim". That sentence is still true after the PR for these sites (all verified on origin/master):
| authored source |
template site |
entity label: pattern literal segments (EdmIntentGenerator.java:3164) |
template-application-dao-java/data/Repository.java.template:1356 label.append("${part.text}"); (+ :1359,1365 "${part.format}") |
setField step value: (GlueIntentGenerator.java:5008) |
template-application-events-java/events/SetField.java.template:44 updateProperty(..., "${field}", "${value}") |
report parameter initial: (ReportIntentGenerator.java:1154) |
data/reportFileEntity.java.template:199 value(filter, "${parameter.name}", "${parameter.initial}") |
field description: (EdmIntentGenerator.java:1233) |
data/Entity.java.template:38 @Documentation("${property.description}") |
number: { series: ... } name (free text, no shape check) |
Repository.java.template:409,411 DocumentNumbers.next("${property.numberSeries}", ...); events/Numbering.java.template:49,52,56 |
seeded status names joined id=name, (EdmIntentGenerator.java:2538) |
Repository.java.template:942 "${lifecycleStatusNames}".split(",") - a ", \ or , in a status name breaks the literal or the split |
cron, destination, path (authored, identifier-ish but unvalidated) |
Job.java.template:47, InboundFile.java.template:63, InboundMessage.java.template:44, Outbound.java.template:85, Webhook.java.template:48 |
A description: Customer's "trade" name, a setField value with a quote, a report initial: O'Neil or a label pattern literal " each fail javac for the whole generated module with the message #7241 described - or, for the status-name join, silently mis-parse.
And the helper itself keeps multiplying instead of being shared: JavaLiterals.escape now has three template-facing callers while the identical loop is hand-rolled in PostSetSupport.escape (#7268), ModelParameterProcessor.java:1331 (widgetPatternJava), GlueIntentGenerator.java:3008/3375/3485/2746, IntegrationSupport.java:74, NotificationSupport.java:345, ScheduleSupport, plus JsonLiterals / JsLiterals (#7254, #7255).
Expected
- The sites above render through the one escape (or, for
cron / destination / path / series, are shape-checked at parse so they can never contain a quote).
- One
escape for Java string literals, reachable from ide-template and engine-intent; the hand-rolled copies replaced.
IntentEmissionCoverageIT's fixture carries a quote in a description, a setField value and a report initial, so the generated module is compiled with them.
Describe the bug
PR #7262 (#7241) routes the four message families the issue named (
checks, guards,unique,refuse) throughJavaLiterals.escape, and its body says: "Every other authored string the templates write into a Java string literal was still interpolated verbatim". That sentence is still true after the PR for these sites (all verified on origin/master):label:pattern literal segments (EdmIntentGenerator.java:3164)template-application-dao-java/data/Repository.java.template:1356label.append("${part.text}");(+:1359,1365"${part.format}")setFieldstepvalue:(GlueIntentGenerator.java:5008)template-application-events-java/events/SetField.java.template:44updateProperty(..., "${field}", "${value}")initial:(ReportIntentGenerator.java:1154)data/reportFileEntity.java.template:199value(filter, "${parameter.name}", "${parameter.initial}")description:(EdmIntentGenerator.java:1233)data/Entity.java.template:38@Documentation("${property.description}")number: { series: ... }name (free text, no shape check)Repository.java.template:409,411DocumentNumbers.next("${property.numberSeries}", ...);events/Numbering.java.template:49,52,56id=name,(EdmIntentGenerator.java:2538)Repository.java.template:942"${lifecycleStatusNames}".split(",")- a",\or,in a status name breaks the literal or the splitcron,destination,path(authored, identifier-ish but unvalidated)Job.java.template:47,InboundFile.java.template:63,InboundMessage.java.template:44,Outbound.java.template:85,Webhook.java.template:48A
description: Customer's "trade" name, asetFieldvalue with a quote, a reportinitial: O'Neilor a label pattern literal"each failjavacfor the whole generated module with the message #7241 described - or, for the status-name join, silently mis-parse.And the helper itself keeps multiplying instead of being shared:
JavaLiterals.escapenow has three template-facing callers while the identical loop is hand-rolled inPostSetSupport.escape(#7268),ModelParameterProcessor.java:1331(widgetPatternJava),GlueIntentGenerator.java:3008/3375/3485/2746,IntegrationSupport.java:74,NotificationSupport.java:345,ScheduleSupport, plusJsonLiterals/JsLiterals(#7254, #7255).Expected
cron/destination/path/series, are shape-checked at parse so they can never contain a quote).escapefor Java string literals, reachable from ide-template and engine-intent; the hand-rolled copies replaced.IntentEmissionCoverageIT's fixture carries a quote in adescription, asetFieldvalue and a reportinitial, so the generated module is compiled with them.