mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 09:45:39 +02:00
bug 319512: Missing type arguments on managedbuilder.core
This commit is contained in:
parent
7c2075b39a
commit
6a4302eb01
6 changed files with 41 additions and 43 deletions
|
@ -28,7 +28,7 @@ public class ConflictSet {
|
|||
public static final IConflict[] EMPTY_CONFLICT_ARRAY = new IConflict[0];
|
||||
public static final IBuildObject[] EMPTY_BO_ARRAY = new IBuildObject[0];
|
||||
|
||||
private PerTypeMapStorage fConflictStorage;
|
||||
private PerTypeMapStorage<IRealBuildObjectAssociation, Conflict> fConflictStorage;
|
||||
private List<ConflictMatch> fConflictMatchList;
|
||||
private Set<? extends IRealBuildObjectAssociation> fExtConflictSet;
|
||||
private IRealBuildObjectAssociation fRealObj;
|
||||
|
@ -41,10 +41,10 @@ public class ConflictSet {
|
|||
|
||||
private void init(){
|
||||
if(fConflictStorage == null){
|
||||
fConflictStorage = new PerTypeMapStorage();
|
||||
fConflictStorage = new PerTypeMapStorage<IRealBuildObjectAssociation, Conflict>();
|
||||
if(fConflictMatchList != null && fConflictMatchList.size() != 0){
|
||||
int size = fConflictMatchList.size();
|
||||
PerTypeMapStorage result = new PerTypeMapStorage();
|
||||
PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> result = new PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>>();
|
||||
for(int i = 0; i < size; i++){
|
||||
ConflictMatch match = fConflictMatchList.get(i);
|
||||
int objType = match.fMatchType;
|
||||
|
|
|
@ -12,7 +12,7 @@ package org.eclipse.cdt.managedbuilder.internal.tcmodification;
|
|||
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
|
||||
|
||||
public final class ObjectTypeBasedStorage implements Cloneable {
|
||||
public final class ObjectTypeBasedStorage<T> implements Cloneable {
|
||||
private static final int TOOL_INDEX = 0;
|
||||
private static final int TOOLCHAIN_INDEX = 1;
|
||||
private static final int BUILDER_INDEX = 2;
|
||||
|
@ -26,7 +26,8 @@ public final class ObjectTypeBasedStorage implements Cloneable {
|
|||
IRealBuildObjectAssociation.OBJECT_CONFIGURATION,
|
||||
};
|
||||
|
||||
private Object fStorage[] = new Object[SIZE];
|
||||
@SuppressWarnings("unchecked")
|
||||
private T fStorage[] = (T[]) new Object[SIZE];
|
||||
|
||||
public static int[] getSupportedObjectTypes(){
|
||||
return OBJECT_TYPES.clone();
|
||||
|
@ -62,13 +63,13 @@ public final class ObjectTypeBasedStorage implements Cloneable {
|
|||
// }
|
||||
// }
|
||||
|
||||
public Object get(int type){
|
||||
public T get(int type){
|
||||
return fStorage[getIndex(type)];
|
||||
}
|
||||
|
||||
public Object set(int type, Object value){
|
||||
public T set(int type, T value){
|
||||
int index = getIndex(type);
|
||||
Object oldValue = fStorage[index];
|
||||
T oldValue = fStorage[index];
|
||||
fStorage[index] = value;
|
||||
return oldValue;
|
||||
}
|
||||
|
@ -76,7 +77,8 @@ public final class ObjectTypeBasedStorage implements Cloneable {
|
|||
@Override
|
||||
public Object clone(){
|
||||
try {
|
||||
ObjectTypeBasedStorage clone = (ObjectTypeBasedStorage)super.clone();
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectTypeBasedStorage<T> clone = (ObjectTypeBasedStorage<T>)super.clone();
|
||||
clone.fStorage = fStorage.clone();
|
||||
return clone;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
|
|
|
@ -12,15 +12,12 @@ package org.eclipse.cdt.managedbuilder.internal.tcmodification;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
|
||||
public class PerTypeMapStorage<K, V> implements Cloneable {
|
||||
private ObjectTypeBasedStorage<Map<K, V>> fStorage = new ObjectTypeBasedStorage<Map<K, V>>();
|
||||
|
||||
public class PerTypeMapStorage implements Cloneable {
|
||||
private ObjectTypeBasedStorage fStorage = new ObjectTypeBasedStorage();
|
||||
|
||||
public Map/*<IRealBuildObjectAssociation, ?>*/ getMap(int type, boolean create){
|
||||
Map<IRealBuildObjectAssociation, ?> map = (Map<IRealBuildObjectAssociation, ?>)fStorage.get(type);
|
||||
public Map<K, V> getMap(int type, boolean create){
|
||||
Map<K, V> map = fStorage.get(type);
|
||||
if(map == null && create){
|
||||
map = createMap(null);
|
||||
fStorage.set(type, map);
|
||||
|
@ -28,23 +25,23 @@ public class PerTypeMapStorage implements Cloneable {
|
|||
return map;
|
||||
}
|
||||
|
||||
protected Map<IRealBuildObjectAssociation, Set> createMap(Map<IRealBuildObjectAssociation, Set> map){
|
||||
protected Map<K, V> createMap(Map<K, V> map){
|
||||
if(map == null) {
|
||||
return new HashMap<IRealBuildObjectAssociation, Set>();
|
||||
return new HashMap<K, V>();
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<IRealBuildObjectAssociation, Set> clone = (Map<IRealBuildObjectAssociation, Set>)((HashMap<IRealBuildObjectAssociation, Set>)map).clone();
|
||||
Map<K, V> clone = (Map<K, V>)((HashMap<K, V>)map).clone();
|
||||
return clone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone(){
|
||||
try {
|
||||
PerTypeMapStorage clone = (PerTypeMapStorage)super.clone();
|
||||
@SuppressWarnings("unchecked")
|
||||
PerTypeMapStorage<K, V> clone = (PerTypeMapStorage<K, V>)super.clone();
|
||||
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<IRealBuildObjectAssociation, Set> o = (Map<IRealBuildObjectAssociation, Set>) clone.fStorage.get(types[i]);
|
||||
Map<K, V> o = clone.fStorage.get(types[i]);
|
||||
if(o != null){
|
||||
clone.fStorage.set(types[i], clone.createMap(o));
|
||||
}
|
||||
|
|
|
@ -13,13 +13,11 @@ package org.eclipse.cdt.managedbuilder.internal.tcmodification;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
|
||||
|
||||
public class PerTypeSetStorage implements Cloneable {
|
||||
private ObjectTypeBasedStorage fStorage = new ObjectTypeBasedStorage();
|
||||
public class PerTypeSetStorage<T> implements Cloneable {
|
||||
private ObjectTypeBasedStorage<Set<T>> fStorage = new ObjectTypeBasedStorage<Set<T>>();
|
||||
|
||||
public Set<? extends IRealBuildObjectAssociation> getSet(int type, boolean create){
|
||||
Set<IRealBuildObjectAssociation> set = (Set<IRealBuildObjectAssociation>)fStorage.get(type);
|
||||
public Set<T> getSet(int type, boolean create){
|
||||
Set<T> set = fStorage.get(type);
|
||||
if(set == null && create){
|
||||
set = createSet(null);
|
||||
fStorage.set(type, set);
|
||||
|
@ -27,23 +25,25 @@ public class PerTypeSetStorage implements Cloneable {
|
|||
return set;
|
||||
}
|
||||
|
||||
protected Set<IRealBuildObjectAssociation> createSet(Set<IRealBuildObjectAssociation> set){
|
||||
protected Set<T> createSet(Set<T> set){
|
||||
if(set == null)
|
||||
return new LinkedHashSet<IRealBuildObjectAssociation>();
|
||||
return new LinkedHashSet<T>();
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<IRealBuildObjectAssociation> clone = (Set<IRealBuildObjectAssociation>)((LinkedHashSet<IRealBuildObjectAssociation>)set).clone();
|
||||
Set<T> clone = (Set<T>)((LinkedHashSet<T>)set).clone();
|
||||
return clone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone(){
|
||||
try {
|
||||
PerTypeSetStorage clone = (PerTypeSetStorage)super.clone();
|
||||
clone.fStorage = (ObjectTypeBasedStorage)fStorage.clone();
|
||||
@SuppressWarnings("unchecked")
|
||||
PerTypeSetStorage<T> clone = (PerTypeSetStorage<T>)super.clone();
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectTypeBasedStorage<Set<T>> storageClone = (ObjectTypeBasedStorage<Set<T>>)fStorage.clone();
|
||||
clone.fStorage = storageClone;
|
||||
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<IRealBuildObjectAssociation> o = (Set<IRealBuildObjectAssociation>) clone.fStorage.get(types[i]);
|
||||
Set<T> o = clone.fStorage.get(types[i]);
|
||||
if(o != null){
|
||||
clone.fStorage.set(types[i], createSet(o));
|
||||
}
|
||||
|
@ -61,8 +61,7 @@ public class PerTypeSetStorage implements Cloneable {
|
|||
if(emptySetAsNull){
|
||||
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<IRealBuildObjectAssociation> o = (Set<IRealBuildObjectAssociation>) fStorage.get(types[i]);
|
||||
Set<T> o = fStorage.get(types[i]);
|
||||
if(o != null && !o.isEmpty())
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class MatchObjectElement {
|
|||
public static class TypeToStringAssociation {
|
||||
private int fType;
|
||||
private String fString;
|
||||
private static ObjectTypeBasedStorage fTypeAssociationStorage = new ObjectTypeBasedStorage();
|
||||
private static ObjectTypeBasedStorage<TypeToStringAssociation> fTypeAssociationStorage = new ObjectTypeBasedStorage<TypeToStringAssociation>();
|
||||
private static Map<String, TypeToStringAssociation> fStringAssociationStorage = new HashMap<String, TypeToStringAssociation>();
|
||||
|
||||
public static TypeToStringAssociation TOOL = new TypeToStringAssociation(IRealBuildObjectAssociation.OBJECT_TOOL, "tool"); //$NON-NLS-1$
|
||||
|
@ -65,7 +65,7 @@ public class MatchObjectElement {
|
|||
}
|
||||
|
||||
public static TypeToStringAssociation getAssociation(int type){
|
||||
return (TypeToStringAssociation)fTypeAssociationStorage.get(type);
|
||||
return fTypeAssociationStorage.get(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class RulesManager {
|
|||
private ConflictDefinition[] fConflictDefinitions;
|
||||
|
||||
private Map<MatchObjectElement, IObjectSet> fMatchObjectMap = new HashMap<MatchObjectElement, IObjectSet>();
|
||||
private PerTypeMapStorage fObjToChildSuperClassMap;
|
||||
private PerTypeMapStorage<IRealBuildObjectAssociation, Set<IRealBuildObjectAssociation>> fObjToChildSuperClassMap;
|
||||
private StarterJob fStarter;
|
||||
private boolean fIsStartInited;
|
||||
|
||||
|
@ -232,13 +232,13 @@ public class RulesManager {
|
|||
|
||||
private Set<IRealBuildObjectAssociation> getChildSuperClassRealSet(IRealBuildObjectAssociation obj, IRealBuildObjectAssociation[] all){
|
||||
if(fObjToChildSuperClassMap == null)
|
||||
fObjToChildSuperClassMap = new PerTypeMapStorage();
|
||||
fObjToChildSuperClassMap = new PerTypeMapStorage<IRealBuildObjectAssociation, Set<IRealBuildObjectAssociation>>();
|
||||
|
||||
if(all == null)
|
||||
all = TcModificationUtil.getExtensionObjects(obj.getType());
|
||||
|
||||
Map<IRealBuildObjectAssociation, Set> map = fObjToChildSuperClassMap.getMap(obj.getType(), true);
|
||||
Set set = map.get(obj);
|
||||
Map<IRealBuildObjectAssociation, Set<IRealBuildObjectAssociation>> map = fObjToChildSuperClassMap.getMap(obj.getType(), true);
|
||||
Set<IRealBuildObjectAssociation> set = map.get(obj);
|
||||
if(set == null){
|
||||
set = createChildSuperClassRealSet(obj, all, null);
|
||||
map.put(obj, set);
|
||||
|
|
Loading…
Add table
Reference in a new issue