Bug 152578 - [prefs] IJavaProject.setOption(Object,Object) wrongly removes key when value is equals to JavaCore one
Summary: [prefs] IJavaProject.setOption(Object,Object) wrongly removes key when value ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-02 07:27 EDT by Frederic Fusier CLA
Modified: 2007-09-18 04:23 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 Frederic Fusier CLA 2006-08-02 07:27:52 EDT
Follow-up of bug 152562.

JavaProject.setOption(Object,Object) method should remove key only if given value is equals to default one. JavaCore.getOption(optionName) is not the default value but the inherited one.
Comment 1 Martin Aeschlimann CLA 2006-08-02 08:11:56 EDT
With this bug suggestion, for default= "1.1", workspace="1.2", project="1.3"
after 'project.setOption(SETTING1, "1.1")', 'project.getOption(SETTING1)' would result in "1.2"

I think the user expects to read the value he just wrote...
Comment 2 Frederic Fusier CLA 2006-08-02 09:18:48 EDT
You're right, I missed this point!

In fact JavaCore options still behave like org.eclipse.core.runtime.Preferences and not as org.eclipse.core.runtime.preferences.IEclipsePreferences...
As our options rely on IEclipsePreferences since 3.0 it should be good to make them behaving the same.

So, that means that:
1) setOption should never remove any key, just set given value to given key
   (this bug)
2) user should have we should have an API to remove an option
   (bug 15252)

Does it make more sense?
Comment 3 Frederic Fusier CLA 2006-08-02 09:20:33 EDT
I have some problems with bug references... :-(
Previous comment should obviously read bug 152562...
Comment 4 Martin Aeschlimann CLA 2006-08-02 09:27:15 EDT
That makes sense! But as said, I'm not so much for a new API but just using 'null' in setOptions.
Comment 5 Frederic Fusier CLA 2007-05-02 05:31:11 EDT
Unfortunately work on performances didn't let me enough time to finalize a fix for this bug. Not sure if I can put it in 3.3 or if I'd have to defer it to next version...
Comment 6 Frederic Fusier CLA 2007-08-20 10:58:33 EDT
Released for 3.4M2 in HEAD stream.
Comment 7 Maxime Daniel CLA 2007-09-18 04:23:09 EDT
Test case is OptionTests#testBug152578.
Verified for 3.4 M2 using build I20070917-0010.