1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

cleanup: java generics - parameterized this class

This commit is contained in:
Andrew Gvozdev 2009-10-03 04:45:15 +00:00
parent db7a537b36
commit 6348536f9f

View file

@ -27,7 +27,7 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry;
* @see ICSettingEntry#SOURCE_PATH * @see ICSettingEntry#SOURCE_PATH
* *
*/ */
public class KindBasedStore implements Cloneable { public class KindBasedStore<TypeStored> implements Cloneable {
private static final int INDEX_INCLUDE_PATH = 0; private static final int INDEX_INCLUDE_PATH = 0;
private static final int INDEX_INCLUDE_FILE = 1; private static final int INDEX_INCLUDE_FILE = 1;
private static final int INDEX_MACRO = 2; private static final int INDEX_MACRO = 2;
@ -148,13 +148,15 @@ public class KindBasedStore implements Cloneable {
} }
throw new IllegalArgumentException(UtilMessages.getString("KindBasedStore.1")); //$NON-NLS-1$ throw new IllegalArgumentException(UtilMessages.getString("KindBasedStore.1")); //$NON-NLS-1$
} }
public Object get(int kind){ @SuppressWarnings("unchecked")
return fEntryStorage[kindToIndex(kind)]; public TypeStored get(int kind){
return (TypeStored) fEntryStorage[kindToIndex(kind)];
} }
public Object put(int kind, Object object){ @SuppressWarnings("unchecked")
public TypeStored put(int kind, TypeStored object){
int index = kindToIndex(kind); int index = kindToIndex(kind);
Object old = fEntryStorage[index]; TypeStored old = (TypeStored) fEntryStorage[index];
fEntryStorage[index] = object; fEntryStorage[index] = object;
return old; return old;
} }
@ -210,7 +212,8 @@ public class KindBasedStore implements Cloneable {
@Override @Override
public Object clone() { public Object clone() {
try { try {
KindBasedStore clone = (KindBasedStore)super.clone(); @SuppressWarnings("unchecked")
KindBasedStore<TypeStored> clone = (KindBasedStore<TypeStored>)super.clone();
clone.fEntryStorage = fEntryStorage.clone(); clone.fEntryStorage = fEntryStorage.clone();
return clone; return clone;
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {