Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 162818 - [preferences] Updating a 3.1 project does not observe compiler settings
Summary: [preferences] Updating a 3.1 project does not observe compiler settings
Status: CLOSED DUPLICATE of bug 202384
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Szymon Ptaszkiewicz CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-30 19:48 EST by Jess Garms CLA
Modified: 2011-01-10 06:43 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jess Garms CLA 2006-10-30 19:48:26 EST
1. Open Eclipse 3.1.2 with a new workspace.
2. Create a java project.
3. Set the Java Compiler settings to be project-specific and select java 5.0.
4. Create a java source file that uses any annotation (such as @Override).
5. Verify that you are not seeing any problem markers.
6. Close the project in the workspace.
7. Close Eclipse 3.1.2.
8. Open the same workspace in Eclipse 3.3.
9. Open the project.
10. Open the source file with the annotation.
11. The annotation should be flagged as a problem now.
12. Go into the project properties -> Java Compiler and notice that the panel is not registered to use the project preferences.
13. Touch the org.eclipse.jst.core.prefs file without making any actual content changes. The problem goes away and the Java Compiler project properties panel displays the correct information.
Comment 1 Konstantin Komissarchik CLA 2006-10-30 20:11:29 EST
My guess is that this is more a jdt-core (rather than jdt-ui) issue, since problem markers are placed on the annotation...
Comment 2 Martin Aeschlimann CLA 2006-11-16 06:29:23 EST
I followed the steps and everything seems to work fine for me. On step 11, I don't get an error on the opened file. Opening the property page as in step 12 shows that the settings are project settings.

Do you have more input here?
Comment 3 Jess Garms CLA 2006-11-16 13:13:30 EST
This repros for me in 3.3M3. Note that you need to manually close the project (step #6) in 3.1.2. Otherwise the problem does not occur.
Comment 4 Martin Aeschlimann CLA 2006-11-17 10:36:12 EST
Ok, now I got it, I forgot to close/open the project.

I think the bug is in core.resources. The .settings file seems to be there, but when programatically accessing these project settings, null is returned.
Comment 5 Jeff McAffer CLA 2006-11-17 11:14:13 EST
Moving to resources as the bug appears to be in resources.
Comment 6 Szymon Ptaszkiewicz CLA 2011-01-07 09:24:36 EST
It works since 3.7M2a. I found that 3.7M2a with jdt.ui plugin from 3.7M1 does not work so the problems was fixed somewhere in jdt.ui plug-in. Moving back to JDT/UI to comment and possible closure.
Comment 7 Markus Keller CLA 2011-01-07 12:45:03 EST
(In reply to comment #4)
> I think the bug is in core.resources. The .settings file seems to be there, but
> when programatically accessing these project settings, null is returned.

That's exactly the point. The "fix" is the removal of a few lines in org.eclipse.jdt.internal.ui.preferences.formatter.FormatterProfileStore#checkCurrentOptionsVersion() rev. 1.4 (but that change has been released for other reasons, see bug 324995).

Concretely, we used to call ...

    IEclipsePreferences preferences= new ProjectScope(project)
        .getNode("org.eclipse.jdt.core");

... on the *closed* project. That returns an IEclipsePreferences that does not contain the initial values from the file on disk. Later on, when user has opened the project, this preferences node apparently doesn't get updated and still returns no values, although the opened project has stored preferences.

Moving back to Platform/Resources to make sure the preferences object gets updated when a project is opened. To reproduce, check out FormatterProfileStore rev. 1.3.
Comment 8 Szymon Ptaszkiewicz CLA 2011-01-07 14:22:57 EST
Thanks for clarification Markus. We already have bug 202384 to handle re-initialization of ProjectPreferences when project is opened. I will test on Monday if patch for bug 202384 fixes also this problem with FormatterProfileStore rev. 1.3.
Comment 9 Szymon Ptaszkiewicz CLA 2011-01-10 06:43:46 EST

*** This bug has been marked as a duplicate of bug 202384 ***