Bug 570333 - Workspace Java Compiler Settings Not Retained After Restart
Summary: Workspace Java Compiler Settings Not Retained After Restart
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.18   Edit
Hardware: PC Linux
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2021-01-13 11:50 EST by Philip Hachey CLA
Modified: 2021-01-13 13:34 EST (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 Philip Hachey CLA 2021-01-13 11:50:23 EST
When changing the default Java compiler compliance to 1.8, then next time Eclipse starts, it is set to 1.4.

Environment: Eclipse 2020-12 (Eclipse IDE for Enterprise Java Developers); Linux Mint 20.1

# Steps to recreate

- Create a new workspace for Eclipse 2020-12
- Open Window=>Preferences=>Java=>Compiler
- Change the compliance level from 11 to 1.8.
- (Note that the 1.8 setting remains in effect while Eclipse remains open)
- Restart Eclipse
- The same setting now shows 1.4 instead of 1.8
- Changing it again to 1.8 still results in a setting of 1.4 on the next restart.

# Impact

Unfortunately, some of the projects I work on use a shared .project file which I have no control over.  In these cases, the Java compiler compliance level must be set at the workspace level rather than the project level.  To work, I must now remember to change the workspace compliance level to 1.8 every single time I start Eclipse.

# Other things I tried

In monitoring `.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs`, I can see that the correct settings are set when I hit the "Apply" button in the preferences window:

```
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=1.8
```


These remain as above when I close Eclipse.  Upon restarting Eclipse, `org.eclipse.jdt.core.prefs` changes to the following:

```
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.4
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=1.3
```
Comment 1 Andrey Loskutov CLA 2021-01-13 12:03:33 EST
Are you using Oomph?
Comment 2 Philip Hachey CLA 2021-01-13 13:34:31 EST
It's a new workspace, so I did not imagine there to be any Oomph settings, but I appear to have been mistaken.  The Oomph recorder is disabled.  I signed out of Eclipse User Storage, disabled "Synchronize with Eclipse.org" under Preference Synchronizer, and both cleared caches and cleaned up the Bundle Pools.  None of these made any difference.  However, enabling "Skip automatic task execution at startup time" under the Oomph Setup Tasks appears to have solved the problem.  In the end, I wiped my .eclipse directory and that was effective in solving the problem for all newly created workspaces as well.

I must have toyed with Oomph in the past without having a good understanding of exactly what it is doing.  I do not find it to be either intuitive or obvious.  Apologies for this not-a-bug.