diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/KindBasedStore.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/KindBasedStore.java index fa8e73bf264..e7ada5c3714 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/KindBasedStore.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/KindBasedStore.java @@ -17,6 +17,8 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry; * A storage where stored data is organized by "kind". * In most cases kind is one of {@link ICLanguageSettingEntry}, i.e. include path, macro etc. * + * @param - stored type + * * @see ICSettingEntry#INCLUDE_PATH * @see ICSettingEntry#INCLUDE_FILE * @see ICSettingEntry#MACRO @@ -27,7 +29,7 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry; * @see ICSettingEntry#SOURCE_PATH * */ -public class KindBasedStore implements Cloneable { +public class KindBasedStore implements Cloneable { private static final int INDEX_INCLUDE_PATH = 0; private static final int INDEX_INCLUDE_FILE = 1; private static final int INDEX_MACRO = 2; @@ -149,19 +151,19 @@ public class KindBasedStore implements Cloneable { throw new IllegalArgumentException(UtilMessages.getString("KindBasedStore.1")); //$NON-NLS-1$ } @SuppressWarnings("unchecked") - public TypeStored get(int kind){ - return (TypeStored) fEntryStorage[kindToIndex(kind)]; + public T get(int kind){ + return (T) fEntryStorage[kindToIndex(kind)]; } - @SuppressWarnings("unchecked") - public TypeStored put(int kind, TypeStored object){ + public T put(int kind, T object){ int index = kindToIndex(kind); - TypeStored old = (TypeStored) fEntryStorage[index]; + @SuppressWarnings("unchecked") + T old = (T) fEntryStorage[index]; fEntryStorage[index] = object; return old; } - private class KindBasedInfo implements IKindBasedInfo { + private class KindBasedInfo implements IKindBasedInfo { int fIdex; int fKind; @@ -175,31 +177,35 @@ public class KindBasedStore implements Cloneable { } } - public Object getInfo() { - return fEntryStorage[fIdex]; + public T getInfo() { + @SuppressWarnings("unchecked") + T info = (T)fEntryStorage[fIdex]; + return info; } public int getKind() { return fKind; } - public Object setInfo(Object newInfo) { - Object old = fEntryStorage[fIdex]; + public T setInfo(T newInfo) { + @SuppressWarnings("unchecked") + T old = (T)fEntryStorage[fIdex]; fEntryStorage[fIdex] = newInfo; return old; } } - public IKindBasedInfo[] getContents(){ - IKindBasedInfo infos[] = new IKindBasedInfo[fEntryStorage.length]; + public IKindBasedInfo[] getContents(){ + @SuppressWarnings("unchecked") + IKindBasedInfo infos[] = new IKindBasedInfo[fEntryStorage.length]; for(int i = 0; i < fEntryStorage.length; i++){ infos[i] = new KindBasedInfo(i, false); } return infos; } - public IKindBasedInfo getInfo(int kind){ + public IKindBasedInfo getInfo(int kind){ return new KindBasedInfo(kind, true); } @@ -213,7 +219,7 @@ public class KindBasedStore implements Cloneable { public Object clone() { try { @SuppressWarnings("unchecked") - KindBasedStore clone = (KindBasedStore)super.clone(); + KindBasedStore clone = (KindBasedStore)super.clone(); clone.fEntryStorage = fEntryStorage.clone(); return clone; } catch (CloneNotSupportedException e) { diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryResolveInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryResolveInfo.java index e2fbfbf90e0..3c6ed82ac71 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryResolveInfo.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryResolveInfo.java @@ -15,15 +15,15 @@ import java.util.List; public class PathEntryResolveInfo { private PathEntryResolveInfoElement[] fElements; - public PathEntryResolveInfo(List list){ + public PathEntryResolveInfo(List list){ if(list != null){ - fElements = (PathEntryResolveInfoElement[])list.toArray(new PathEntryResolveInfoElement[list.size()]); + fElements = list.toArray(new PathEntryResolveInfoElement[list.size()]); } else { fElements = new PathEntryResolveInfoElement[0]; } } public PathEntryResolveInfoElement[] getElements(){ - return (PathEntryResolveInfoElement[])fElements.clone(); + return fElements.clone(); } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryResolveInfoElement.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryResolveInfoElement.java index 2f6dc612980..d848c0a90a7 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryResolveInfoElement.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryResolveInfoElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2010 Intel Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,7 +26,7 @@ public class PathEntryResolveInfoElement { fResolvedEntries = new IPathEntry[0]; } - public PathEntryResolveInfoElement(IPathEntry rawEntry, List resolvedList){ + public PathEntryResolveInfoElement(IPathEntry rawEntry, List resolvedList){ fRawEntry = rawEntry; if(resolvedList != null){ fResolvedEntries = new IPathEntry[resolvedList.size()]; @@ -41,6 +41,6 @@ public class PathEntryResolveInfoElement { public IPathEntry[] getResolvedEntries(){ if(fResolvedEntries == null) return new IPathEntry[0]; - return (IPathEntry[])fResolvedEntries.clone(); + return fResolvedEntries.clone(); } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CExternalSettingSerializer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CExternalSettingSerializer.java index 6b75778628d..048b2437ee2 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CExternalSettingSerializer.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CExternalSettingSerializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2010 Intel Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,8 +44,8 @@ public class CExternalSettingSerializer { if(tmp != null) exts = CDataUtil.stringToArray(tmp, SEPARATOR); - List entriesList = LanguageSettingEntriesSerializer.loadEntriesList(element, KindBasedStore.ORED_LANG_ENTRY_KINDS); - ICSettingEntry[] entries = (ICSettingEntry[])entriesList.toArray(new ICSettingEntry[entriesList.size()]); + List entriesList = LanguageSettingEntriesSerializer.loadEntriesList(element, KindBasedStore.ORED_LANG_ENTRY_KINDS); + ICSettingEntry[] entries = entriesList.toArray(new ICSettingEntry[entriesList.size()]); return new CExternalSetting(langIds, cTypeIds, exts, entries); } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectConverterDesciptor.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectConverterDesciptor.java index 4b7c5977110..c92d5a01675 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectConverterDesciptor.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectConverterDesciptor.java @@ -98,7 +98,7 @@ public class CProjectConverterDesciptor { if(supportedIds != null){ IProjectDescription eDes = project.getDescription(); String natures[] = eDes.getNatureIds(); - Set natureSet = new HashSet(Arrays.asList(natures)); + Set natureSet = new HashSet(Arrays.asList(natures)); natureSet.removeAll(Arrays.asList(supportedIds)); if(natureSet.size() == natures.length) return false; diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CfgProxyCache.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CfgProxyCache.java index aa6272a0b93..2d17bbe94ea 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CfgProxyCache.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CfgProxyCache.java @@ -40,7 +40,7 @@ public class CfgProxyCache implements IProxyCache { if(proxy != null) fProxyMap.put(proxy.getId(),proxy); else if(oldValue != null){ - fProxyMap.remove((CDataProxy)oldValue); + fProxyMap.remove(oldValue); } } @@ -82,6 +82,7 @@ public class CfgProxyCache implements IProxyCache { removeCachedProxy(proxy); } + @SuppressWarnings("unchecked") public Map getCachedProxiesMap() { return (Map)fProxyMap.clone(); } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ConfigBasedPathEntryContainer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ConfigBasedPathEntryContainer.java index abc613c016e..143f288b228 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ConfigBasedPathEntryContainer.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ConfigBasedPathEntryContainer.java @@ -21,12 +21,12 @@ public class ConfigBasedPathEntryContainer implements IPathEntryContainer { public static final IPath CONTAINER_PATH = new Path("org.eclipse.cdt.core.CFG_BASED_CONTAINER"); //$NON-NLS-1$ private IPathEntry[] fEntries; - public ConfigBasedPathEntryContainer(List list){ - this.fEntries = (IPathEntry[])list.toArray(new IPathEntry[list.size()]); + public ConfigBasedPathEntryContainer(List list){ + this.fEntries = list.toArray(new IPathEntry[list.size()]); } public ConfigBasedPathEntryContainer(IPathEntry entries[]){ - this.fEntries = (IPathEntry[])entries.clone(); + this.fEntries = entries.clone(); } public String getDescription() { @@ -38,7 +38,7 @@ public class ConfigBasedPathEntryContainer implements IPathEntryContainer { } public IPathEntry[] getPathEntries() { - return (IPathEntry[])fEntries.clone(); + return fEntries.clone(); } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/EntriesNamesContainer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/EntriesNamesContainer.java index 2a11c7802f6..11b917c8be6 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/EntriesNamesContainer.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/EntriesNamesContainer.java @@ -18,7 +18,7 @@ import org.eclipse.cdt.core.settings.model.util.KindBasedStore; class EntriesNamesContainer { // private String fLanguageSettingsId; - private KindBasedStore fRemovedEntryNamesStore = new KindBasedStore(); + private KindBasedStore> fRemovedEntryNamesStore = new KindBasedStore>(); // EntriesNamesContainer(ICLanguageSetting setting) { // fLanguageSettingsId = setting.getId(); @@ -30,11 +30,11 @@ class EntriesNamesContainer { public EntriesNamesContainer(EntriesNamesContainer base) { // fLanguageSettingsId = base.fLanguageSettingsId; - IKindBasedInfo infos[] = base.fRemovedEntryNamesStore.getContents(); + IKindBasedInfo> infos[] = base.fRemovedEntryNamesStore.getContents(); for(int i = 0; i < infos.length; i++){ - Set set = (Set)infos[i].getInfo(); + Set set = infos[i].getInfo(); if(set != null) - fRemovedEntryNamesStore.put(infos[i].getKind(), new HashSet(set)); + fRemovedEntryNamesStore.put(infos[i].getKind(), new HashSet(set)); } } @@ -42,10 +42,10 @@ class EntriesNamesContainer { // return fLanguageSettingsId; //o } - private Set getRemovedNamesSet(int kind, boolean create){ - Set set = (Set)fRemovedEntryNamesStore.get(kind); + private Set getRemovedNamesSet(int kind, boolean create){ + Set set = fRemovedEntryNamesStore.get(kind); if(set == null && create){ - set = new HashSet(); + set = new HashSet(); fRemovedEntryNamesStore.put(kind, set); } return set; @@ -60,7 +60,7 @@ class EntriesNamesContainer { } public boolean contains(int kind, String name){ - Set set = getRemovedNamesSet(kind, false); + Set set = getRemovedNamesSet(kind, false); if(set != null) return set.contains(name); return false; @@ -71,7 +71,7 @@ class EntriesNamesContainer { } public boolean remove(int kind, String name){ - Set set = getRemovedNamesSet(kind, false); + Set set = getRemovedNamesSet(kind, false); if(set != null) return set.remove(name); return false; @@ -81,13 +81,13 @@ class EntriesNamesContainer { if(names == null || names.length == 0) { clear(kind); } else { - Set set = getRemovedNamesSet(kind, true); + Set set = getRemovedNamesSet(kind, true); set.clear(); add(set, names); } } - private static void add(Set set, String names[]){ + private static void add(Set set, String names[]){ for(int i = 0; i < names.length; i++){ set.add(names[i]); } @@ -97,7 +97,7 @@ class EntriesNamesContainer { if(names == null || names.length == 0) { return; } else { - Set set = getRemovedNamesSet(kind, true); + Set set = getRemovedNamesSet(kind, true); add(set, names); } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/IProxyCache.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/IProxyCache.java index 000e665d7ca..595245623e8 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/IProxyCache.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/IProxyCache.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2010 Intel Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.eclipse.cdt.core.settings.model.extension.CDataObject; public interface IProxyCache { CDataProxy[] getCachedProxies(); - Map getCachedProxiesMap(); + Map getCachedProxiesMap(); CDataProxy getCachedProxy(String id); diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/PathEntryConfigurationDataProvider.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/PathEntryConfigurationDataProvider.java index f2e194a4768..941ff72854a 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/PathEntryConfigurationDataProvider.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/PathEntryConfigurationDataProvider.java @@ -255,7 +255,7 @@ public class PathEntryConfigurationDataProvider extends ICProject cproject = manager.create(project); IPathEntry[] curRawEntries = PathEntryManager.getDefault().getRawPathEntries(cproject); - List list = new ArrayList(); + List list = new ArrayList(); list.addAll(Arrays.asList(entries)); for(int i = 0; i < curRawEntries.length; i++){ if(curRawEntries[i].getEntryKind() == IPathEntry.CDT_CONTAINER){ @@ -263,7 +263,7 @@ public class PathEntryConfigurationDataProvider extends } } - IPathEntry[] newEntries = (IPathEntry[])list.toArray(new IPathEntry[list.size()]); + IPathEntry[] newEntries = list.toArray(new IPathEntry[list.size()]); PathEntryManager.getDefault().setRawPathEntries(cproject, newEntries, new NullProgressMonitor()); return createData(des, base, false, false); }