New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid using non-ASCII Unicode characters outside of comments and literals #3092
Comments
I think I've seen this a couple of times and hadn't got to the bottom of it yet. To make it easier to debug, maybe we should improve the diagnostic to mention which non-unicode characters it thinks it's seeing. |
AFAICT, because 99.9% of Java code is plain ASCII, the check is rather "dumb" and doesn't try to only flag problematic chars. |
I think it's a bug which appears when running in IntelliJ Using a file which fails in IntelliJ (2021.3.2 (Ultimate Edition)) the following test using the command line from the installation docs works. In addition a
I've also copied the failing file to one side and done a diff to see it's the same as the failing one. Played about with the file a few times (adding and removing the last line) until it works and done a diff again. The diff shows no difference in the files. |
I wonder if IntelliJ is adding a unicode character to the buffer for some reason. I'm going to update the diagnostic message to print the character it's seeing, which might help debug this. |
To help debug #3092 PiperOrigin-RevId: 441567288
To help debug #3092 PiperOrigin-RevId: 442071506
FYI, there is an issue filed on the IntelliJ side, too -- https://youtrack.jetbrains.com/issue/IDEA-288257 |
I've found the cause: Javac modifies content of file passed to it as |
I'm not sure how we can fix this on intellij side. We implement |
…ffer #3092 PiperOrigin-RevId: 467537488
…ffer #3092 PiperOrigin-RevId: 467666418
@chashnikov FWIW, I still have this issue in Java 18 (Zulu) in Intellij. |
Since this has been merged but is still open, can someone update this with the version where the fix will appear? |
This should have been included in the recent 2.16.0 release |
FYI, I still see this on occasion in 2.16. Seems to be less common. |
In error-prone 2.11.0 I've started getting the following error when building within IntelliJ
When I view the file in VIM or HexDump there I can't see any non-unicode characters.
Line 17 is the end of the file, I can't supply the whole file due to work constraints. But below is a screenshot of the end of the file from hexedit
Within IntelliJ the formatter is doing
If I down grade error-prone to 2.10.0 it works fine on the offending file
The text was updated successfully, but these errors were encountered: