ice
ice copied to clipboard
Escape sequences in doc comments
// Slice
const string ss3 = "\\\\U\\u\\"; /* \\U\u\ */
const string ss4 = "\\\u0041\\"; /* \A\ */
const string ss5 = "\\u0041\\"; /* \u0041\ */
This results in invalid Java-generated code, I didn't check other mappings.
java-compat/test/build/generated-src/test/Ice/operations/AMD/Test/ss3.java:19: error: illegal unicode escape
2023-12-19T10:37:11.1730511Z * \\U\u\
2023-12-19T10:37:11.1732024Z ^
Should Slice do as Java and reject \u in this case?
We already reject these in string literals:
/* Matches a universal character code that isn't the correct size, or uses incorrect characters. */
<STRING_LITERAL>"\\u"{hex}{0,3}[g-zG-Z]* ... report an error
But I'm not sure we should bother checking doc comments. Right now the parser performs no inspection of comments, we just read a raw string and forward it along for the most part. I suspect there's lots of ways to generate bad code through putting weird things in doc comments.
If multiple languages fail to handle to \u, then maybe we should start performing comment validation, but if it's just
Java, or one other language, I wouldn't.