-
Notifications
You must be signed in to change notification settings - Fork 870
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
Different formatting of block line comments with openjdk 23+37-2369 #1153
Comments
I toyed a bit with debugging this and there's a difference in how these line comments appear to JavaCommentsHelper.wrapLineComments. With JDK21, it receives that comment line-by-line. With JDK23, it receives a concatenation of all lines, with lines 2 and on having a whitespace prefix:
this triggers the difference because the split condition now sees different line length for those subsequent lines.
Hope this helps somehow. |
For what it's worth, core tests pass when I do this:
but I'm not sure whether this is the right fix. Perhaps it'd be good to find out why the token text is different with jdk 23 (as it's the primary cause of the problem). |
Thanks for the bug and the investigation! Presumably the difference in JDK 23 is due to the new support for markdown doc comments. |
I think you're right - that's a spot-on observation. Interestingly, this comment appears inline with the code, not as a javadoc of anything in particular [1]. Could be a regression in the comment parser worth reporting to openjdk. |
I think it's probably a deliberate change on the javac side, to be able to process the entire Are you interested in sending a PR? |
#1153 PiperOrigin-RevId: 673553329
#1153 PiperOrigin-RevId: 673574143
Thank you for adding the regression test. I've created a PR with the basic workaround I suggested, hope it helps. |
Applies to: 1.23.0
I came across this oddity - this file from Apache Lucene:
SandboxFacetsExample.txt
doesn't need any changes with jdk17-jdk22:
but will result in reformatting under jdk 23 (ea, 23+37-2369):
Fully reproducible on Windows and Linux. The diff is:
The text was updated successfully, but these errors were encountered: