Skip to content

Preserve compliance level when formatter settings need version update - #3320

Open
jonahgraham wants to merge 1 commit into
eclipse-jdt:masterfrom
jonahgraham:fix-core-5792
Open

jonahgraham wants to merge 1 commit into
eclipse-jdt:masterfrom
jonahgraham:fix-core-5792

Conversation

@jonahgraham

Copy link
Copy Markdown
Contributor

What it does

Fixes case where opening a project in a newer version of JDT would lose compliance level when formatting. This means newer Java version is used for parsing the Java file. This leads to incorrect formatting in some cases, such as when /// comments are present in the source. For pre-java 23 these are just normal line comments, for Java 23+ these are markdown block comments.

Fixes #3321

How to test

Open project with older formatter_settings_version=19 (in org.eclipse.jdt.ui.prefs) and Java compliance level < 23 and format a file containing /// style comments. They get interpreted as Markdown block comments instead of Java line comments.

Author checklist

@jonahgraham

Copy link
Copy Markdown
Contributor Author

Fixes #3321

Feel free to move the issue from core to ui and I will update the commit message too.

@iloveeclipse

Copy link
Copy Markdown
Member

Fixes eclipse-jdt/eclipse.jdt.ui#3321

Feel free to move the issue from core to ui and I will update the commit message too.

#3321

@jonahgraham

Copy link
Copy Markdown
Contributor Author

Fixes eclipse-jdt/eclipse.jdt.ui#3321

Feel free to move the issue from core to ui and I will update the commit message too.

#3321

TIL that GitHub re-writes my previous comments with no edit history when issues are moved.

Fixes case where opening a project in a newer version of JDT would
lose compliance level when formatting. This means newer Java version
is used for parsing the Java file. This leads to incorrect formatting
in some cases, such as when `///` comments are present in the source.
For pre-java 23 these are just normal line comments, for Java 23+
these are markdown block comments.

Fixes eclipse-jdt#3321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Java Formatter discards compliance level when loading project settings that need upgrading from an older version

2 participants