LCM text literal operator improperly escapes quotation marks in text
The LCM text literal operator produces invalid java code when quotation marks are present in the input, for example a text operator with the content " will produce the string literal """ in the generated Java, causing the LCM rule to fail evaluation.
This is caused by the quote_ method that escapes single quotation marks (') instead of double quotation marks ("):
/**
* Encode a string as a properly escaped Java string, complete with
* quotes.
* @param {string} string Text to encode.
* @return {string} Java string.
* @private
*/
Blockly.Java.quote_ = function (s: string) {
// TODO: This is a quick hack. Replace with goog.string.quote
s = s.replace(/\\/g, '\\\\')
.replace(/\n/g, '\\\n')
.replace(/'/g, '\\\'');
return '"' + s + '"';
};