Bug 551602 - --enable-preview setting of workspace is applied to new 1.8 projects with project specific settings
Summary: --enable-preview setting of workspace is applied to new 1.8 projects with pro...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.13   Edit
Hardware: PC Windows 10
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-29 04:01 EDT by Dieter Mai CLA
Modified: 2023-04-20 16:06 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dieter Mai CLA 2019-09-29 04:01:44 EDT
When --enable-preview is enabled in the workspace setting, then this setting is applied to new projects even if the project enables project specific settings and the compiler version is does not support --enable-preview

How to reproduce

[Preconditions]
[P1] newly created workspace

[Actions]
[A1] Start Eclipse
[A2] Open Preferences->Java->Compiler
[A3] Switch Compiler compliance level to 12 and check --enable-preview.
[A4] Hit "Apply and close" of the Preferences Dialog
[A5] Create a Java project with JRE 1.8 and a main class
[A6] Run the Java project 

[Observed]
[O1] (OK) Eclipse starts
[O2] (OK) Settings for the java compiler are displayed
[O3] (OK) -
[O4] (OK) Preferences Dialog closes
[O5] (OK) Project is created
[O6] (NOK) The projects fails to run. an error message is displayed that --enable-preview is an invalid compiler option

[Expected]
[E6] The Project runs normaly

[Heal]
[H1] Open the project Properties
[H2] go to Java Compiler
[H3] Un-check the setting "Use compliance from execution environment 1.8..."
[H5] Check the setting "Use compliance from execution environment 1.8..."
[H6] Hit Apply
[H7] Do A6


Issues
- The Compiler setting of the project uses its own settings and not Workspace settings. Still the some Workspace settings
- The project compiler setting tell the user that 1.8 compliance is used. --enable-preview is not compliant.
- Eclipse should always use the compiler settings the user has set. This is not the case here.


Note
- Video of the issue: https://youtu.be/h7tJ4YYl6wU
- Deleting .eclipse did not help

Environment
Windows 10
Eclipse Version: 2019-09 R (4.13.0)
Eclipse Build id: 20190917-1200
Comment 1 Dieter Mai CLA 2019-12-27 13:05:32 EST
Retested with Eclipse 2019-12
Now an error marker/annotation is displayed that hints the error. This is Better now because the user now sees the issue before hitting run. Still i think the situation could be improved. If a setting is invalid for a project, the setting should be ignored for the project.
Comment 2 Dieter Mai CLA 2021-03-24 16:19:03 EDT
Retested with 2021-03 (4.13). Issue is unchanged.
Comment 3 Eclipse Genie CLA 2023-04-20 16:06:46 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.