google / google/closure-templates
"source" comment in generated code can produce files that don't compile
- Dominant language
- Java
- Stars
- 700
- Forks
- 199
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 26
Description
This line https://github.com/google/closure-templates/blob/5aef0db2fdecb92cb1e3d2e926cacb5dc3923a00/java/src/com/google/template/soy/parseinfo/passes/GenerateParseInfoVisitor.java#L349
can lead to files that don't compile on windows because they'll have an illegal unicode escape.
For example, if you have a file called `utils.soy` and run `SoyParseInfoGenerator` on it, it generates code like this:
```java
// This file was automatically generated by the Soy compiler.
// Please don't edit this file by hand.
// source: C:\XXXXX\src\main\resources\soy\utils.soy
package xxx;
```
You can put a unicode escape anywhere in a java file, including comments. So trying to compile the above leads to:
```
UtilsSoyInfo.java:3: error: illegal unicode escape
// source: C:\XXXXX\src\main\resources\soy\utils.soy
^
1 error
```
Introduced via b0b39f9af2fed78333ddb7963266e9d2db3df094
This would affect any soy file with a path segment that starts with a `u` on Windows.
Contributor guide
Assessment
This issue has not been assessed yet.