Class DoubleQuotedInterpolation
${ - for every editing tool. Use this; do
not re-derive the rewrite: it is BacktickString's, the very spelling the compiler's message
names.
A double-quoted String is never interpolated, so "${count} items" never compiles (E07901)
and rewriting it cannot change which code runs - the original never runs at all. Of its two readings
the INTERPOLATION is applied: it is what the writer almost always meant (16 of the 19 such Strings in
this repository, and every harness run that wrote one), and the note names the other reading with its
exact spelling, so undoing it is one edit.
🔑 The evidence is the compiler's own resolution. This only proposes; the caller re-verifies,
and an interpolation of a name that is not in scope - a regular-expression template naming a group,
"${day}", or a typo - does not compile, so the rewrite is discarded and the refusal stands
with both spellings in its message. A String whose every ${ is already escaped (\${)
has only the literal reading and is left to that message; so is one that spans lines.
Measured (cycles 11-13): qcoder T10 printed ${count} items and failed twice; one run spent
rounds 5-13 on it. It compiled then - this is the error that made it visible.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe rewritten text and one note per rewrite;notesempty means nothing moved. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanTrue whentextmay hold a double-quoted String with${- worth a probe compile.Rewrite every double-quoted String an E07901 diagnostic sits on as the interpolating backtick String.
-
Method Details
-
mayApply
True whentextmay hold a double-quoted String with${- worth a probe compile. -
repair
public static DoubleQuotedInterpolation.Result repair(String text, List<Map<String, Object>> diagnostics) Rewrite every double-quoted String an E07901 diagnostic sits on as the interpolating backtick String. Driven entirely by the diagnostics: the code must be E07901 and its column must sit exactly on the opening quote of a String that closes on the same line. Anything less certain is skipped and the caller's refusal stands for it. Rewrites within one line (right to left, so two on a line keep their columns), so the receipts can follow (SourceRepairs).
-