diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CLibraryFileEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CLibraryFileEntry.java index 9ebe581e650..d7ec4873b20 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CLibraryFileEntry.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CLibraryFileEntry.java @@ -92,6 +92,18 @@ public final class CLibraryFileEntry extends ACPathEntry implements return fSourceAttachmentRootPath; } + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((fSourceAttachmentPath == null) ? 0 : fSourceAttachmentPath.hashCode()); + result = prime * result + + ((fSourceAttachmentPrefixMapping == null) ? 0 : fSourceAttachmentPrefixMapping.hashCode()); + result = prime * result + + ((fSourceAttachmentRootPath == null) ? 0 : fSourceAttachmentRootPath.hashCode()); + return result; + } + @Override public boolean equals(Object other) { if(other == this) 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 e537251e6d4..2c1d9c1da22 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 @@ -1793,14 +1793,15 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager { newEntries = EMPTY_LANGUAGE_SETTINGS_ENTRIES_ARRAY; } + Set newEntrySet = new HashSet(Arrays.asList(newEntries)); + Set oldEntrySet = new HashSet(Arrays.asList(oldEntries)); + // Check the removed entries. - for (int i = 0; i < oldEntries.length; i++) { + for (ICLanguageSettingEntry oldEntry : oldEntries) { boolean found = false; - for (int j = 0; j < newEntries.length; j++) { - if (oldEntries[i].equals(newEntries[j])) { - found = true; - break; - } + if (newEntrySet.contains(oldEntry)) { + found = true; + break; } if(!found){ result[1] = true; @@ -1809,13 +1810,11 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager { } // Check the new entries. - for (int i = 0; i < newEntries.length; i++) { + for (ICLanguageSettingEntry newEntry : newEntries) { boolean found = false; - for (int j = 0; j < oldEntries.length; j++) { - if (newEntries[i].equals(oldEntries[j])) { - found = true; - break; - } + if (oldEntrySet.contains(newEntry)) { + found = true; + break; } if(!found){ result[0] = true;