diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/EntryStore.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/EntryStore.java index 4cf86de2ead..ae15cafb90d 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/EntryStore.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/EntryStore.java @@ -25,7 +25,7 @@ import org.eclipse.cdt.core.settings.model.ICMacroEntry; import org.eclipse.cdt.core.settings.model.ICMacroFileEntry; public class EntryStore { - private KindBasedStore fStore = new KindBasedStore(); + private KindBasedStore> fStore = new KindBasedStore>(); private boolean fPreserveReadOnly; public EntryStore(){ @@ -36,21 +36,21 @@ public class EntryStore { fPreserveReadOnly = preserveReadOnly; } + @SuppressWarnings("unchecked") public EntryStore(EntryStore base, boolean preserveReadOnly){ for(int kind : KindBasedStore.getLanguageEntryKinds()){ - ArrayList list = (ArrayList)fStore.get(kind); + ArrayList list = fStore.get(kind); if(list != null) - fStore.put(kind, (ArrayList)list.clone()); + fStore.put(kind, (ArrayList) list.clone()); } fPreserveReadOnly = preserveReadOnly; } - @SuppressWarnings("unchecked") public ICLanguageSettingEntry[] getEntries(){ List result = new ArrayList(); List list; for(int k: KindBasedStore.getLanguageEntryKinds()){ - list = (List)fStore.get(k); + list = fStore.get(k); if(list != null) result.addAll(list); } @@ -58,7 +58,7 @@ public class EntryStore { } public boolean containsEntriesList(int kind){ - List list = getEntriesList(kind, false); + List list = getEntriesList(kind, false); return list != null; } @@ -68,17 +68,17 @@ public class EntryStore { list = new ArrayList(0); switch(kind){ case ICLanguageSettingEntry.INCLUDE_PATH: - return (ICLanguageSettingEntry[])list.toArray(new ICIncludePathEntry[list.size()]); + return list.toArray(new ICIncludePathEntry[list.size()]); case ICLanguageSettingEntry.INCLUDE_FILE: - return (ICLanguageSettingEntry[])list.toArray(new ICIncludeFileEntry[list.size()]); + return list.toArray(new ICIncludeFileEntry[list.size()]); case ICLanguageSettingEntry.MACRO: - return (ICLanguageSettingEntry[])list.toArray(new ICMacroEntry[list.size()]); + return list.toArray(new ICMacroEntry[list.size()]); case ICLanguageSettingEntry.MACRO_FILE: - return (ICLanguageSettingEntry[])list.toArray(new ICMacroFileEntry[list.size()]); + return list.toArray(new ICMacroFileEntry[list.size()]); case ICLanguageSettingEntry.LIBRARY_PATH: - return (ICLanguageSettingEntry[])list.toArray(new ICLibraryPathEntry[list.size()]); + return list.toArray(new ICLibraryPathEntry[list.size()]); case ICLanguageSettingEntry.LIBRARY_FILE: - return (ICLanguageSettingEntry[])list.toArray(new ICLibraryFileEntry[list.size()]); + return list.toArray(new ICLibraryFileEntry[list.size()]); default: throw new IllegalArgumentException(); } @@ -91,13 +91,12 @@ public class EntryStore { return new ArrayList(0); } - private void setEntriesList(int kind, List list){ + private void setEntriesList(int kind, ArrayList list){ fStore.put(kind, list); } - @SuppressWarnings("unchecked") - private List getEntriesList(int kind, boolean create){ - List list = (List)fStore.get(kind); + private ArrayList getEntriesList(int kind, boolean create){ + ArrayList list = fStore.get(kind); if(list == null && create){ fStore.put(kind, list = new ArrayList()); } @@ -130,7 +129,7 @@ public class EntryStore { } public void storeEntries(int kind, List list){ - List newList = new ArrayList(list); + ArrayList newList = new ArrayList(list); // newList.addAll(Arrays.asList(entries)); if(fPreserveReadOnly){ List oldList = getEntriesList(kind, false); @@ -160,12 +159,10 @@ public class EntryStore { list.add(entry); } - @SuppressWarnings("unchecked") public void trimToSize(){ int kinds[] = KindBasedStore.getLanguageEntryKinds(); for(int i = 0; i < kinds.length; i++){ - ArrayList list = - (ArrayList)fStore.get(kinds[i]); + ArrayList list = fStore.get(kinds[i]); if(list != null) list.trimToSize(); }