Patching does not respect the encoding attribute of maven-compiler-plugin
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
Running error-prone with the -XepPatchChecks compiler option on a codebase using en encoding other than UTF-8 results in corrupted characters.
It appears that the patch logic hardcodes the UTF_8 Charset when reading (and writing?) the source files, e.g. [here](https://github.com/google/error-prone/blob/b6e7a9d3c7638f395807eb5ec7050b2c1d643d6a/check_api/src/main/java/com/google/errorprone/apply/PatchFileDestination.java#L56), thus ignoring the 'encoding' attribute of the maven-compiler-plugin (which defaults to project.build.sourceEncoding)
I don't know if this is necessarily something to fix. We only noticed it in an older codebase that is not yet migrated to UTF-8 and our workaround is to disable errorprone until we migrate. Perhaps just a warning in the documentation would suffice.
Contributor guide
Assessment
This issue has not been assessed yet.