eclipse-jdt / eclipse-jdt/eclipse.jdt.core
DefaultCodeFormatter.createParser sets an inconsistent combination of preview/source/release/compliance
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 47
Description
DefaultCodeFormatter.createParser sets some options in an inconsistent way (compared to Javac specification):
* it forces ENABLED_PREVIEWS even if source/compliance version is not latest => this can lead to some errors
* It sets SOURCE according to project, but doesn't set COMPLIANCE, sticking to workspace default (which can be different from project one)
* Even when RELEASE is set, project SOURCE is used, but COMPLIANCE is ignored
This can lead to combination where the formatter is not using the expected version, and that can cause further issues down the road.
Some things to fix:
* check RELEASE to decide whether to use SOURCE or COMPLIANCE
* Set PREVIEW only according to project settings, and maybe even ensure that source/compliance is latest before setting preview
Contributor guide
Assessment
This issue has not been assessed yet.