From 76163a477c6d225b6f768585b3b84775524d3941 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Wed, 4 Jan 2012 17:44:54 -0500 Subject: [PATCH] bug 290631: Scanner Discovery Challenge. ICSettingEntry & ICDescriptionDelta as @noextend-@noimplement. --- .../model/CProjectDescriptionDeltaTests.java | 6 +-- .../.settings/.api_filters | 17 +++++++ .../settings/model/ICDescriptionDelta.java | 51 +++++++++++-------- .../core/settings/model/ICSettingEntry.java | 20 ++++++++ .../model/CProjectDescriptionDelta.java | 3 +- .../model/CProjectDescriptionManager.java | 2 +- 6 files changed, 73 insertions(+), 26 deletions(-) create mode 100644 core/org.eclipse.cdt.core/.settings/.api_filters diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/CProjectDescriptionDeltaTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/CProjectDescriptionDeltaTests.java index ff562be920b..be8bd6cf0e0 100644 --- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/CProjectDescriptionDeltaTests.java +++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/CProjectDescriptionDeltaTests.java @@ -339,7 +339,7 @@ public class CProjectDescriptionDeltaTests extends BaseTestCase{ ICConfigurationDescription cfgDescription = prjDescription.getConfigurations()[0]; assertNotNull(cfgDescription); - // Modification SOURCE_ENTENSIONS + // Modification SOURCE_EXTENSIONS ICLanguageSetting langSetting = cfgDescription.getLanguageSettingForFile(file.getProjectRelativePath(), false); final String testContentType = CCorePlugin.CONTENT_TYPE_ASMSOURCE; langSetting.setSourceContentTypeIds(new String[] {testContentType}); @@ -356,11 +356,11 @@ public class CProjectDescriptionDeltaTests extends BaseTestCase{ // Analyze delta ICDescriptionDelta rootDelta = listener.getDelta(); assertNotNull(rootDelta); - List deltas = findDeltas(rootDelta, ICDescriptionDelta.SOURCE_ENTENSIONS); + List deltas = findDeltas(rootDelta, ICDescriptionDelta.SOURCE_EXTENSIONS); assertEquals(1, deltas.size()); ICDescriptionDelta delta = deltas.get(0); assertNotNull(delta); -// assertEquals(ICDescriptionDelta.SOURCE_ENTENSIONS, delta.getChangeFlags()); +// assertEquals(ICDescriptionDelta.SOURCE_EXTENSIONS, delta.getChangeFlags()); // Check old setting assertTrue(delta.getOldSetting() instanceof ICLanguageSetting); diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters new file mode 100644 index 00000000000..10c87060341 --- /dev/null +++ b/core/org.eclipse.cdt.core/.settings/.api_filters @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICDescriptionDelta.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICDescriptionDelta.java index 8467c6966c9..a38e6595eca 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICDescriptionDelta.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICDescriptionDelta.java @@ -10,7 +10,10 @@ *******************************************************************************/ package org.eclipse.cdt.core.settings.model; - +/** + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ public interface ICDescriptionDelta { /* * delta kinds @@ -18,8 +21,8 @@ public interface ICDescriptionDelta { /** * kind specifying that the setting object returned by * the {@link #getSetting()} was removed - * the {@link #getNewSetting()} returns null - * the {@link #getOldSetting()} returns the same object as {@link #getSetting()} + * the {@link #getNewSetting()} returns null + * the {@link #getOldSetting()} returns the same object as {@link #getSetting()} */ int REMOVED = 1; @@ -27,29 +30,33 @@ public interface ICDescriptionDelta { * kind specifying that the setting object returned by * the {@link #getSetting()} was added * the {@link #getNewSetting()} returns the same object as {@link #getSetting()} - * the {@link #getOldSetting()} returns null + * the {@link #getOldSetting()} returns null */ int ADDED = 2; /** * kind specifying that the setting object was changed - * the {@link #getNewSetting()} returns new object - * the {@link #getOldSetting()} returns old object + * the {@link #getNewSetting()} returns new object + * the {@link #getOldSetting()} returns old object * the {@link #getSetting()} returns the same object as {@link #getNewSetting()} */ int CHANGED = 3; - + /* * delta change flags */ - + int ACTIVE_CFG = 1; int NAME = 1 << 1; int DESCRIPTION = 1 << 2; // int PATH = 1 << 3; int LANGUAGE_ID = 1 << 4; int SOURCE_CONTENT_TYPE = 1 << 5; - int SOURCE_ENTENSIONS = 1 << 6; + /** @since 5.4 */ + int SOURCE_EXTENSIONS = 1 << 6; + /** @deprecated Use ICDescriptionDelta.SOURCE_EXTENSIONS */ + @Deprecated + int SOURCE_ENTENSIONS = SOURCE_EXTENSIONS; // int HEADER_CONTENT_TYPE = 1 << 7; // int HEADER_ENTENSIONS = 1 << 8; int SETTING_ENTRIES = 1 << 9; @@ -66,17 +73,19 @@ public interface ICDescriptionDelta { int OWNER = 1 << 20; int INDEX_CFG = 1 << 21; int SETTING_CFG = INDEX_CFG; - + /** @since 5.4 */ + int LANGUAGE_SETTINGS_PROVIDERS = 1 << 22; + /** * specifies that the project "isCdtProjectCreating" state was set to false * the PROJECT_CREAION_COMPLETED delta gets notified ONLY in case - * the project previously contained the project description with + * the project previously contained the project description with * the true "isCdtProjectCreating" state - * + * * in case the initial project description does NOT contain the true "isCdtProjectCreating" - * the project is considered as initialized from the very beginning + * the project is considered as initialized from the very beginning * and the PROJECT_CREAION_COMPLETED delta is NOT notified - * + * * @see ICProjectDescription#isCdtProjectCreating() * @see ICProjectDescription#setCdtProjectCreated() * @see ICProjectDescriptionManager#createProjectDescription(org.eclipse.core.resources.IProject, boolean, boolean) @@ -85,19 +94,19 @@ public interface ICDescriptionDelta { /** * returns the kind - * @see #ADDED - * @see #REMOVED + * @see #ADDED + * @see #REMOVED * @see #CHANGED - * + * * @return int */ int getDeltaKind(); - + /** * @return ored delta flags */ int getChangeFlags(); - + int getSettingType(); int getAddedEntriesKinds(); @@ -111,8 +120,8 @@ public interface ICDescriptionDelta { ICSettingObject getNewSetting(); ICSettingObject getSetting(); - + ICSettingObject getOldSetting(); - + ICDescriptionDelta getParent(); } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICSettingEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICSettingEntry.java index 3adc824a568..af776d96bc0 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICSettingEntry.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICSettingEntry.java @@ -12,6 +12,10 @@ package org.eclipse.cdt.core.settings.model; import org.eclipse.cdt.core.model.IIncludeEntry; +/** + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ public interface ICSettingEntry { /** * Flag {@code BUILTIN} indicates settings built in a tool (compiler) itself. @@ -46,6 +50,22 @@ public interface ICSettingEntry { */ int RESOLVED = 1 << 4; + /** + * Flag {@code UNDEFINED} indicates that the entry should not be defined. + * It's main purpose to provide the means to negate entries defined elsewhere. + * + * @since 5.4 + */ + int UNDEFINED = 1 << 5; + + /** + * Flag {@code FRAMEWORKS_MAC} applies for path entries. Such a path entry will be treated + * in a special way to imitate resolving paths by Apple's version of gcc, see bug 69529. + * + * @since 5.4 + */ + int FRAMEWORKS_MAC = 1 << 6; + int INCLUDE_PATH = 1; int INCLUDE_FILE = 1 << 1; int MACRO = 1 << 2; diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionDelta.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionDelta.java index 45bd1fb3b02..588d18bac0d 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionDelta.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionDelta.java @@ -168,7 +168,7 @@ public class CProjectDescriptionDelta implements ICDescriptionDelta { if ((flags&DESCRIPTION)!=0) str.append("DESCRIPTION|"); if ((flags&LANGUAGE_ID)!=0) str.append("LANGUAGE_ID|"); if ((flags&SOURCE_CONTENT_TYPE)!=0) str.append("SOURCE_CONTENT_TYPE|"); - if ((flags&SOURCE_ENTENSIONS)!=0) str.append("SOURCE_ENTENSIONS|"); + if ((flags&SOURCE_EXTENSIONS)!=0) str.append("SOURCE_EXTENSIONS|"); if ((flags&SETTING_ENTRIES)!=0) str.append("SETTING_ENTRIES|"); if ((flags&BINARY_PARSER_IDS)!=0) str.append("BINARY_PARSER_IDS|"); if ((flags&ERROR_PARSER_IDS)!=0) str.append("ERROR_PARSER_IDS|"); @@ -182,6 +182,7 @@ public class CProjectDescriptionDelta implements ICDescriptionDelta { if ((flags&EXT_REF)!=0) str.append("EXT_REF|"); if ((flags&OWNER)!=0) str.append("OWNER|"); if ((flags&INDEX_CFG)!=0) str.append("INDEX_CFG|"); + if ((flags&LANGUAGE_SETTINGS_PROVIDERS)!=0) str.append("LANGUAGE_SETTINGS_PROVIDERS|"); if (str.charAt(str.length()-1)=='|') str.deleteCharAt(str.length()-1); return str.toString(); diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java index 2143b5e9488..25bf638b9c1 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java @@ -1845,7 +1845,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager { String[] newExts = newLs.getSourceExtensions(); String[] oldExts = oldLs.getSourceExtensions(); if(!Arrays.equals(newExts, oldExts)) - delta.addChangeFlags(ICDescriptionDelta.SOURCE_ENTENSIONS); + delta.addChangeFlags(ICDescriptionDelta.SOURCE_EXTENSIONS); // newCt = newLs.getHeaderContentType();