### Eclipse Workspace Patch 1.0
#P org.eclipse.jdt.core
Index: model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java,v
retrieving revision 1.46
diff -u -r1.46 JavaCorePreferenceInitializer.java
--- model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java 26 Oct 2009 17:20:03 -0000 1.46
+++ model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java 13 Sep 2010 15:58:46 -0000
@@ -101,5 +101,31 @@
defaultPreferences.put(optionName, (String)entry.getValue());
optionNames.add(optionName);
}
+
+ // Initialize deprecated options
+ initializeDeprecatedOptions();
+ }
+
+ /**
+ * @deprecated As using deprecated options
+ */
+ private void initializeDeprecatedOptions() {
+ Map deprecatedOptions = JavaModelManager.getJavaModelManager().deprecatedOptions;
+ deprecatedOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER,
+ new String[] {
+ DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD,
+ DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD,
+ DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE,
+ DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE
+ });
+ deprecatedOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION,
+ new String[] {
+ DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD,
+ DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD,
+ DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE,
+ DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE,
+ DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE,
+ DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER
+ });
}
}
Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v
retrieving revision 1.457
diff -u -r1.457 JavaModelManager.java
--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 9 Sep 2010 06:18:23 -0000 1.457
+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 13 Sep 2010 15:58:47 -0000
@@ -267,10 +267,15 @@
public final static ICompilationUnit[] NO_WORKING_COPY = new ICompilationUnit[0];
- // Preferences
+ // Options
+ private final static int UNKNOWN_OPTION = 0;
+ private final static int DEPRECATED_OPTION = 1;
+ private final static int VALID_OPTION = 2;
HashSet optionNames = new HashSet(20);
+ Map deprecatedOptions = new HashMap();
Hashtable optionsCache;
+ // Preferences
public final IEclipsePreferences[] preferencesLookup = new IEclipsePreferences[2];
static final int PREF_INSTANCE = 0;
static final int PREF_DEFAULT = 1;
@@ -2038,15 +2043,91 @@
if (isDeprecatedOption(optionName)) {
return JavaCore.ERROR;
}
- String propertyName = optionName;
- if (this.optionNames.contains(propertyName)){
+ int optionLevel = getOptionLevel(optionName);
+ if (optionLevel != UNKNOWN_OPTION){
IPreferencesService service = Platform.getPreferencesService();
- String value = service.get(optionName, null, this.preferencesLookup);
+ String value = service.get(optionName, null, this.preferencesLookup);
+ if (value == null && optionLevel == DEPRECATED_OPTION) {
+ // May be a deprecated option, retrieve the new value in compatible options
+ String[] compatibleOptions = (String[]) this.deprecatedOptions.get(optionName);
+ value = service.get(compatibleOptions[0], null, this.preferencesLookup);
+ }
return value==null ? null : value.trim();
}
return null;
}
+ /**
+ * Returns the value of the given option for the given Eclipse preferences.
+ * If no value was already set, then inherits from the global options if specified.
+ *
+ * @param optionName The name of the option
+ * @param inheritJavaCoreOptions Tells whether the value can be inherited from global JavaCore options
+ * @param projectPreferences The eclipse preferences from which to get the value
+ * @return The value of the option. May be null
+ */
+ public String getOption(String optionName, boolean inheritJavaCoreOptions, IEclipsePreferences projectPreferences) {
+ // Return the option value depending on its level
+ switch (getOptionLevel(optionName)) {
+ case VALID_OPTION:
+ // Valid option, return the preference value
+ String javaCoreDefault = inheritJavaCoreOptions ? JavaCore.getOption(optionName) : null;
+ if (projectPreferences == null) return javaCoreDefault;
+ String value = projectPreferences.get(optionName, javaCoreDefault);
+ return value == null ? null : value.trim();
+ case DEPRECATED_OPTION:
+ // Return the deprecated option value if it was already set
+ String oldValue = projectPreferences.get(optionName, null);
+ if (oldValue != null) {
+ return oldValue.trim();
+ }
+ // Get the new compatible value
+ String[] compatibleOptions = (String[]) this.deprecatedOptions.get(optionName);
+ String newDefault = inheritJavaCoreOptions ? JavaCore.getOption(compatibleOptions[0]) : null;
+ String newValue = projectPreferences.get(compatibleOptions[0], newDefault);
+ return newValue == null ? null : newValue.trim();
+ }
+ return null;
+ }
+
+ /**
+ * Returns whether an option name is known or not.
+ *
+ * @param optionName The name of the option
+ * @return true
when the option name is either
+ * {@link #VALID_OPTION valid} or {@link #DEPRECATED_OPTION deprecated},
+ * false
otherwise.
+ */
+ public boolean knowsOption(String optionName) {
+ boolean knownOption = this.optionNames.contains(optionName);
+ if (!knownOption) {
+ knownOption = this.deprecatedOptions.get(optionName) != null;
+ }
+ return knownOption;
+ }
+
+ /**
+ * Returns the level of the given option.
+ *
+ * @param optionName The name of the option
+ * @return The level of the option as an int which may have the following
+ * values:
+ *
- * Currently, migration is only done for formatter options. - *
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=308000" - * - * @param options The options map to update - * @param optionName The old option name to update - * @param optionValue The value of the old option name - */ - public void migrateObsoleteOption(Map options, String optionName, String optionValue) { - - // Migrate formatter options - String[] compatibleConstants = getFormatterCompatibleConstants(optionName); - if (compatibleConstants != null) { - for (int i=0, length=compatibleConstants.length; i < length; i++) { - options.put(compatibleConstants[i], optionValue); - } - return; - } - } - - /** - * Return an array of compatible constants for an obsolete constant. - * - * @param name The name of the obsolete constant - * @return The list as a non-empty array of the compatible constants or - *null
if the constant is not obsolete.
- * @deprecated As using deprecated formatter constants
- */
- private static String[] getFormatterCompatibleConstants(String name) {
- if (DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER.equals(name)) {
- return new String[] {
- DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD,
- DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD,
- DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE,
- DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE
- };
- }
- if (DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION.equals(name)) {
- return new String[] {
- DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD,
- DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD,
- DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE,
- DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE,
- DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE,
- DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER
- };
- }
- return null;
- }
-
// Do not modify without modifying getDefaultOptions()
private Hashtable getDefaultOptionsNoInitialization() {
Map defaultOptionsMap = new CompilerOptions().getMap(); // compiler defaults
@@ -4692,6 +4721,47 @@
}
}
+ /**
+ * Store the preferences value for the given option name.
+ *
+ * @param optionName The name of the option
+ * @param optionValue The value of the option. If null
, then
+ * the option will be removed from the preferences instead.
+ * @param eclipsePreferences The eclipse preferences to be updated
+ * @return true
if the preferences have been changed,
+ * false
otherwise.
+ */
+ public boolean storePreference(String optionName, String optionValue, IEclipsePreferences eclipsePreferences) {
+ int optionLevel = this.getOptionLevel(optionName);
+ if (optionLevel == UNKNOWN_OPTION) return false; // unrecognized option
+
+ // Store option value
+ switch (optionLevel) {
+ case JavaModelManager.VALID_OPTION:
+ if (optionValue == null) {
+ eclipsePreferences.remove(optionName);
+ } else {
+ eclipsePreferences.put(optionName, optionValue);
+ }
+ break;
+ case JavaModelManager.DEPRECATED_OPTION:
+ // Try to migrate deprecated option
+ eclipsePreferences.remove(optionName); // get rid off old preference
+ String[] compatibleOptions = (String[]) this.deprecatedOptions.get(optionName);
+ for (int co=0, length=compatibleOptions.length; co < length; co++) {
+ if (optionValue == null) {
+ eclipsePreferences.remove(compatibleOptions[co]);
+ } else {
+ eclipsePreferences.put(compatibleOptions[co], optionValue);
+ }
+ }
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+
public void setOptions(Hashtable newOptions) {
if (DEBUG_302850) {
@@ -4718,20 +4788,21 @@
Enumeration keys = newOptions.keys();
while (keys.hasMoreElements()){
String key = (String)keys.nextElement();
- if (!this.optionNames.contains(key)) continue; // unrecognized option
+ int optionLevel = getOptionLevel(key);
+ if (optionLevel == UNKNOWN_OPTION) continue; // unrecognized option
if (key.equals(JavaCore.CORE_ENCODING)) {
if (cachedValue != null) {
cachedValue.put(key, JavaCore.getEncoding());
}
continue; // skipped, contributed by resource prefs
}
- String value = (String)newOptions.get(key);
+ String value = (String) newOptions.get(key);
String defaultValue = defaultPreferences.get(key, null);
+ // Store value in preferences
if (defaultValue != null && defaultValue.equals(value)) {
- instancePreferences.remove(key);
- } else {
- instancePreferences.put(key, value);
+ value = null;
}
+ storePreference(key, value, instancePreferences);
}
try {
// persist options
Index: model/org/eclipse/jdt/internal/core/JavaProject.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java,v
retrieving revision 1.435
diff -u -r1.435 JavaProject.java
--- model/org/eclipse/jdt/internal/core/JavaProject.java 3 Sep 2010 15:44:26 -0000 1.435
+++ model/org/eclipse/jdt/internal/core/JavaProject.java 13 Sep 2010 15:58:47 -0000
@@ -1616,14 +1616,7 @@
* @see org.eclipse.jdt.core.IJavaProject#getOption(String, boolean)
*/
public String getOption(String optionName, boolean inheritJavaCoreOptions) {
- if (JavaModelManager.getJavaModelManager().optionNames.contains(optionName)){
- IEclipsePreferences projectPreferences = getEclipsePreferences();
- String javaCoreDefault = inheritJavaCoreOptions ? JavaCore.getOption(optionName) : null;
- if (projectPreferences == null) return javaCoreDefault;
- String value = projectPreferences.get(optionName, javaCoreDefault);
- return value == null ? null : value.trim();
- }
- return null;
+ return JavaModelManager.getJavaModelManager().getOption(optionName, inheritJavaCoreOptions, getEclipsePreferences());
}
/**
@@ -1653,11 +1646,18 @@
String propertyName = propertyNames[i];
String value = projectPreferences.get(propertyName, null);
if (value != null) {
- if (optionNames.contains(propertyName)){
- projectOptions.put(propertyName, value.trim());
- } else {
- // Maybe an obsolete preference, try to migrate it...
- javaModelManager.migrateObsoleteOption(projectOptions, propertyName, value.trim());
+ value = value.trim();
+ // Keep the option value, even if it's deprecated
+ // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=324987
+ projectOptions.put(propertyName, value);
+ if (!optionNames.contains(propertyName)) {
+ // try to migrate deprecated options
+ String[] compatibleOptions = (String[]) javaModelManager.deprecatedOptions.get(propertyName);
+ if (compatibleOptions != null) {
+ for (int co=0, length=compatibleOptions.length; co < length; co++) {
+ projectOptions.put(compatibleOptions[co], value);
+ }
+ }
}
}
}
@@ -1677,7 +1677,7 @@
Map.Entry entry = (Map.Entry) propertyNames.next();
String propertyName = (String) entry.getKey();
String propertyValue = (String) entry.getValue();
- if (propertyValue != null && optionNames.contains(propertyName)){
+ if (propertyValue != null && javaModelManager.knowsOption(propertyName)){
options.put(propertyName, propertyValue.trim());
}
}
@@ -2878,20 +2878,17 @@
* @see org.eclipse.jdt.core.IJavaProject#setOption(java.lang.String, java.lang.String)
*/
public void setOption(String optionName, String optionValue) {
- if (!JavaModelManager.getJavaModelManager().optionNames.contains(optionName)) return; // unrecognized option
+ // Store option value
IEclipsePreferences projectPreferences = getEclipsePreferences();
- if (optionValue == null) {
- // remove preference
- projectPreferences.remove(optionName);
- } else {
- projectPreferences.put(optionName, optionValue);
- }
+ boolean modified = JavaModelManager.getJavaModelManager().storePreference(optionName, optionValue, projectPreferences);
- // Dump changes
- try {
- projectPreferences.flush();
- } catch (BackingStoreException e) {
- // problem with pref store - quietly ignore
+ // Write changes
+ if (modified) {
+ try {
+ projectPreferences.flush();
+ } catch (BackingStoreException e) {
+ // problem with pref store - quietly ignore
+ }
}
}
@@ -2907,12 +2904,12 @@
projectPreferences.clear();
} else {
Iterator entries = newOptions.entrySet().iterator();
+ JavaModelManager javaModelManager = JavaModelManager.getJavaModelManager();
while (entries.hasNext()){
Map.Entry entry = (Map.Entry) entries.next();
String key = (String) entry.getKey();
- if (!JavaModelManager.getJavaModelManager().optionNames.contains(key)) continue; // unrecognized option
- // no filtering for encoding (custom encoding for project is allowed)
- projectPreferences.put(key, (String) entry.getValue());
+ String value = (String) entry.getValue();
+ javaModelManager.storePreference(key, value, projectPreferences);
}
// reset to default all options not in new map
#P org.eclipse.jdt.core.tests.model
Index: src/org/eclipse/jdt/core/tests/model/OptionTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/OptionTests.java,v
retrieving revision 1.28
diff -u -r1.28 OptionTests.java
--- src/org/eclipse/jdt/core/tests/model/OptionTests.java 27 Aug 2009 15:26:53 -0000 1.28
+++ src/org/eclipse/jdt/core/tests/model/OptionTests.java 13 Sep 2010 15:58:48 -0000
@@ -23,6 +23,7 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.JavaProject;
@@ -701,4 +702,141 @@
JavaCore.setOptions(wkspOptions);
}
}
+
+/**
+ * @bug 324987: [formatter] API compatibility problem with Annotation Newline options
+ * @test Verify that a deprecated option is well preserved when a client use it
+ * through the IJavaProject.setOption(String, String) API
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=324987"
+ * @deprecated As using deprecated constants
+ */
+public void testBug324987_Project01() throws CoreException {
+ try {
+ // Set the obsolete option using the IJavaProject API
+ JavaProject project = (JavaProject) createJavaProject("P");
+ final String obsoleteOption = DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER;
+ project.setOption(obsoleteOption, JavaCore.DO_NOT_INSERT);
+ // Verify that obsolete preference is not stored
+ assertNull(
+ "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'",
+ project.getEclipsePreferences().get(obsoleteOption, null));
+ // Verify that project obsolete option is well retrieved
+ assertEquals(
+ "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'",
+ JavaCore.DO_NOT_INSERT,
+ project.getOption(obsoleteOption, true));
+ } finally {
+ deleteProject("P");
+ }
+}
+/**
+ * @bug 324987: [formatter] API compatibility problem with Annotation Newline options
+ * @test Verify that a deprecated option is well preserved when a client use it
+ * through the IJavaProject#setOptions(Map) API
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=324987"
+ * @deprecated As using deprecated constants
+ */
+public void testBug324987_Project02() throws CoreException {
+ try {
+ // Set the obsolete option using the IJavaProject API
+ JavaProject project = (JavaProject) createJavaProject("P");
+ final String obsoleteOption = DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER;
+ Map testOptions = project.getOptions(true);
+ testOptions.put(obsoleteOption, JavaCore.DO_NOT_INSERT);
+ project.setOptions(testOptions);
+ // Verify that obsolete preference is not stored
+ assertNull(
+ "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'",
+ project.getEclipsePreferences().get(obsoleteOption, null));
+ // Verify that project obsolete option is well retrieved
+ assertEquals(
+ "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'",
+ JavaCore.DO_NOT_INSERT,
+ project.getOption(obsoleteOption, true));
+ } finally {
+ deleteProject("P");
+ }
+}
+/**
+ * @bug 324987: [formatter] API compatibility problem with Annotation Newline options
+ * @test Verify that a deprecated option is well preserved when read through
+ * the IEclipsePreferences (i.e. simulate reading project preferences of a project
+ * coming from an older workspace)
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=324987"
+ * @deprecated As using deprecated constants
+ */
+public void testBug324987_Project03() throws CoreException {
+ try {
+ // Set the obsolete preference simulating a project coming from an older version workspace
+ JavaProject project = (JavaProject) createJavaProject("P");
+ final String obsoleteOption = DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER;
+ project.getEclipsePreferences().put(obsoleteOption, JavaCore.DO_NOT_INSERT);
+ // Verify that obsolete preference is stored
+ assertEquals(
+ "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'",
+ JavaCore.DO_NOT_INSERT,
+ project.getEclipsePreferences().get(obsoleteOption, null));
+ // Verify that project obsolete option is well retrieved
+ assertEquals(
+ "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'",
+ JavaCore.DO_NOT_INSERT,
+ project.getOption(obsoleteOption, true));
+ } finally {
+ deleteProject("P");
+ }
+}
+/**
+ * @bug 324987: [formatter] API compatibility problem with Annotation Newline options
+ * @test Verify that a deprecated option is well preserved when a client use it
+ * through the JavaCore.setOptions(Hashtable) API
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=324987"
+ * @deprecated As using deprecated constants
+ */
+public void testBug324987_Workspace01() throws CoreException {
+ try {
+ // Set the obsolete option using the JavaCore API
+ final String obsoleteOption = DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER;
+ Hashtable testOptions = JavaCore.getOptions();
+ testOptions.put(obsoleteOption, JavaCore.DO_NOT_INSERT);
+ JavaCore.setOptions(testOptions);
+ // Verify that obsolete preference is not stored
+ assertNull(
+ "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'",
+ JavaModelManager.getJavaModelManager().getInstancePreferences().get(obsoleteOption, null));
+ // Verify that workspace obsolete option is well retrieved
+ assertEquals(
+ "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'",
+ JavaCore.DO_NOT_INSERT,
+ JavaCore.getOption(obsoleteOption));
+ } finally {
+ JavaCore.setOptions(JavaCore.getDefaultOptions());
+ }
+}
+/**
+ * @bug 324987: [formatter] API compatibility problem with Annotation Newline options
+ * @test Verify that a deprecated option is well preserved when read through
+ * the IEclipsePreferences (i.e. simulate reading an older workspace)
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=324987"
+ * @deprecated As using deprecated constants
+ */
+public void testBug324987_Workspace02() throws CoreException {
+ try {
+ // Set the obsolete preference simulating an older version workspace
+ final String obsoleteOption = DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER;
+ IEclipsePreferences instancePreferences = JavaModelManager.getJavaModelManager().getInstancePreferences();
+ instancePreferences.put(obsoleteOption, JavaCore.DO_NOT_INSERT);
+ // Verify that obsolete preference is stored
+ assertEquals(
+ "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'",
+ JavaCore.DO_NOT_INSERT,
+ instancePreferences.get(obsoleteOption, null));
+ // Verify that project obsolete option is well retrieved
+ assertEquals(
+ "Unexpected value for formatter deprecated option 'org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member'",
+ JavaCore.DO_NOT_INSERT,
+ JavaCore.getOption(obsoleteOption));
+ } finally {
+ deleteProject("P");
+ }
+}
}