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 IConflict[] EMPTY_CONFLICT_ARRAY = new IConflict[0];
|
||||||
public static final IBuildObject[] EMPTY_BO_ARRAY = new IBuildObject[0];
|
public static final IBuildObject[] EMPTY_BO_ARRAY = new IBuildObject[0];
|
||||||
|
|
||||||
private PerTypeMapStorage fConflictStorage;
|
private PerTypeMapStorage<IRealBuildObjectAssociation, Conflict> fConflictStorage;
|
||||||
private List<ConflictMatch> fConflictMatchList;
|
private List<ConflictMatch> fConflictMatchList;
|
||||||
private Set<? extends IRealBuildObjectAssociation> fExtConflictSet;
|
private Set<? extends IRealBuildObjectAssociation> fExtConflictSet;
|
||||||
private IRealBuildObjectAssociation fRealObj;
|
private IRealBuildObjectAssociation fRealObj;
|
||||||
|
@ -41,10 +41,10 @@ public class ConflictSet {
|
||||||
|
|
||||||
private void init(){
|
private void init(){
|
||||||
if(fConflictStorage == null){
|
if(fConflictStorage == null){
|
||||||
fConflictStorage = new PerTypeMapStorage();
|
fConflictStorage = new PerTypeMapStorage<IRealBuildObjectAssociation, Conflict>();
|
||||||
if(fConflictMatchList != null && fConflictMatchList.size() != 0){
|
if(fConflictMatchList != null && fConflictMatchList.size() != 0){
|
||||||
int size = fConflictMatchList.size();
|
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++){
|
for(int i = 0; i < size; i++){
|
||||||
ConflictMatch match = fConflictMatchList.get(i);
|
ConflictMatch match = fConflictMatchList.get(i);
|
||||||
int objType = match.fMatchType;
|
int objType = match.fMatchType;
|
||||||
|
|
|
@ -12,7 +12,7 @@ package org.eclipse.cdt.managedbuilder.internal.tcmodification;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
|
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 TOOL_INDEX = 0;
|
||||||
private static final int TOOLCHAIN_INDEX = 1;
|
private static final int TOOLCHAIN_INDEX = 1;
|
||||||
private static final int BUILDER_INDEX = 2;
|
private static final int BUILDER_INDEX = 2;
|
||||||
|
@ -26,7 +26,8 @@ public final class ObjectTypeBasedStorage implements Cloneable {
|
||||||
IRealBuildObjectAssociation.OBJECT_CONFIGURATION,
|
IRealBuildObjectAssociation.OBJECT_CONFIGURATION,
|
||||||
};
|
};
|
||||||
|
|
||||||
private Object fStorage[] = new Object[SIZE];
|
@SuppressWarnings("unchecked")
|
||||||
|
private T fStorage[] = (T[]) new Object[SIZE];
|
||||||
|
|
||||||
public static int[] getSupportedObjectTypes(){
|
public static int[] getSupportedObjectTypes(){
|
||||||
return OBJECT_TYPES.clone();
|
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)];
|
return fStorage[getIndex(type)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object set(int type, Object value){
|
public T set(int type, T value){
|
||||||
int index = getIndex(type);
|
int index = getIndex(type);
|
||||||
Object oldValue = fStorage[index];
|
T oldValue = fStorage[index];
|
||||||
fStorage[index] = value;
|
fStorage[index] = value;
|
||||||
return oldValue;
|
return oldValue;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +77,8 @@ public final class ObjectTypeBasedStorage implements Cloneable {
|
||||||
@Override
|
@Override
|
||||||
public Object clone(){
|
public Object clone(){
|
||||||
try {
|
try {
|
||||||
ObjectTypeBasedStorage clone = (ObjectTypeBasedStorage)super.clone();
|
@SuppressWarnings("unchecked")
|
||||||
|
ObjectTypeBasedStorage<T> clone = (ObjectTypeBasedStorage<T>)super.clone();
|
||||||
clone.fStorage = fStorage.clone();
|
clone.fStorage = fStorage.clone();
|
||||||
return clone;
|
return clone;
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
|
|
|
@ -12,15 +12,12 @@ package org.eclipse.cdt.managedbuilder.internal.tcmodification;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
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 {
|
public Map<K, V> getMap(int type, boolean create){
|
||||||
private ObjectTypeBasedStorage fStorage = new ObjectTypeBasedStorage();
|
Map<K, V> map = fStorage.get(type);
|
||||||
|
|
||||||
public Map/*<IRealBuildObjectAssociation, ?>*/ getMap(int type, boolean create){
|
|
||||||
Map<IRealBuildObjectAssociation, ?> map = (Map<IRealBuildObjectAssociation, ?>)fStorage.get(type);
|
|
||||||
if(map == null && create){
|
if(map == null && create){
|
||||||
map = createMap(null);
|
map = createMap(null);
|
||||||
fStorage.set(type, map);
|
fStorage.set(type, map);
|
||||||
|
@ -28,23 +25,23 @@ public class PerTypeMapStorage implements Cloneable {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<IRealBuildObjectAssociation, Set> createMap(Map<IRealBuildObjectAssociation, Set> map){
|
protected Map<K, V> createMap(Map<K, V> map){
|
||||||
if(map == null) {
|
if(map == null) {
|
||||||
return new HashMap<IRealBuildObjectAssociation, Set>();
|
return new HashMap<K, V>();
|
||||||
}
|
}
|
||||||
@SuppressWarnings("unchecked")
|
@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;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone(){
|
public Object clone(){
|
||||||
try {
|
try {
|
||||||
PerTypeMapStorage clone = (PerTypeMapStorage)super.clone();
|
@SuppressWarnings("unchecked")
|
||||||
|
PerTypeMapStorage<K, V> clone = (PerTypeMapStorage<K, V>)super.clone();
|
||||||
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||||
for(int i = 0; i < types.length; i++){
|
for(int i = 0; i < types.length; i++){
|
||||||
@SuppressWarnings("unchecked")
|
Map<K, V> o = clone.fStorage.get(types[i]);
|
||||||
Map<IRealBuildObjectAssociation, Set> o = (Map<IRealBuildObjectAssociation, Set>) clone.fStorage.get(types[i]);
|
|
||||||
if(o != null){
|
if(o != null){
|
||||||
clone.fStorage.set(types[i], clone.createMap(o));
|
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.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
|
public class PerTypeSetStorage<T> implements Cloneable {
|
||||||
|
private ObjectTypeBasedStorage<Set<T>> fStorage = new ObjectTypeBasedStorage<Set<T>>();
|
||||||
public class PerTypeSetStorage implements Cloneable {
|
|
||||||
private ObjectTypeBasedStorage fStorage = new ObjectTypeBasedStorage();
|
|
||||||
|
|
||||||
public Set<? extends IRealBuildObjectAssociation> getSet(int type, boolean create){
|
public Set<T> getSet(int type, boolean create){
|
||||||
Set<IRealBuildObjectAssociation> set = (Set<IRealBuildObjectAssociation>)fStorage.get(type);
|
Set<T> set = fStorage.get(type);
|
||||||
if(set == null && create){
|
if(set == null && create){
|
||||||
set = createSet(null);
|
set = createSet(null);
|
||||||
fStorage.set(type, set);
|
fStorage.set(type, set);
|
||||||
|
@ -27,23 +25,25 @@ public class PerTypeSetStorage implements Cloneable {
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Set<IRealBuildObjectAssociation> createSet(Set<IRealBuildObjectAssociation> set){
|
protected Set<T> createSet(Set<T> set){
|
||||||
if(set == null)
|
if(set == null)
|
||||||
return new LinkedHashSet<IRealBuildObjectAssociation>();
|
return new LinkedHashSet<T>();
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Set<IRealBuildObjectAssociation> clone = (Set<IRealBuildObjectAssociation>)((LinkedHashSet<IRealBuildObjectAssociation>)set).clone();
|
Set<T> clone = (Set<T>)((LinkedHashSet<T>)set).clone();
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone(){
|
public Object clone(){
|
||||||
try {
|
try {
|
||||||
PerTypeSetStorage clone = (PerTypeSetStorage)super.clone();
|
@SuppressWarnings("unchecked")
|
||||||
clone.fStorage = (ObjectTypeBasedStorage)fStorage.clone();
|
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();
|
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||||
for(int i = 0; i < types.length; i++){
|
for(int i = 0; i < types.length; i++){
|
||||||
@SuppressWarnings("unchecked")
|
Set<T> o = clone.fStorage.get(types[i]);
|
||||||
Set<IRealBuildObjectAssociation> o = (Set<IRealBuildObjectAssociation>) clone.fStorage.get(types[i]);
|
|
||||||
if(o != null){
|
if(o != null){
|
||||||
clone.fStorage.set(types[i], createSet(o));
|
clone.fStorage.set(types[i], createSet(o));
|
||||||
}
|
}
|
||||||
|
@ -61,8 +61,7 @@ public class PerTypeSetStorage implements Cloneable {
|
||||||
if(emptySetAsNull){
|
if(emptySetAsNull){
|
||||||
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||||
for(int i = 0; i < types.length; i++){
|
for(int i = 0; i < types.length; i++){
|
||||||
@SuppressWarnings("unchecked")
|
Set<T> o = fStorage.get(types[i]);
|
||||||
Set<IRealBuildObjectAssociation> o = (Set<IRealBuildObjectAssociation>) fStorage.get(types[i]);
|
|
||||||
if(o != null && !o.isEmpty())
|
if(o != null && !o.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class MatchObjectElement {
|
||||||
public static class TypeToStringAssociation {
|
public static class TypeToStringAssociation {
|
||||||
private int fType;
|
private int fType;
|
||||||
private String fString;
|
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>();
|
private static Map<String, TypeToStringAssociation> fStringAssociationStorage = new HashMap<String, TypeToStringAssociation>();
|
||||||
|
|
||||||
public static TypeToStringAssociation TOOL = new TypeToStringAssociation(IRealBuildObjectAssociation.OBJECT_TOOL, "tool"); //$NON-NLS-1$
|
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){
|
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 ConflictDefinition[] fConflictDefinitions;
|
||||||
|
|
||||||
private Map<MatchObjectElement, IObjectSet> fMatchObjectMap = new HashMap<MatchObjectElement, IObjectSet>();
|
private Map<MatchObjectElement, IObjectSet> fMatchObjectMap = new HashMap<MatchObjectElement, IObjectSet>();
|
||||||
private PerTypeMapStorage fObjToChildSuperClassMap;
|
private PerTypeMapStorage<IRealBuildObjectAssociation, Set<IRealBuildObjectAssociation>> fObjToChildSuperClassMap;
|
||||||
private StarterJob fStarter;
|
private StarterJob fStarter;
|
||||||
private boolean fIsStartInited;
|
private boolean fIsStartInited;
|
||||||
|
|
||||||
|
@ -232,13 +232,13 @@ public class RulesManager {
|
||||||
|
|
||||||
private Set<IRealBuildObjectAssociation> getChildSuperClassRealSet(IRealBuildObjectAssociation obj, IRealBuildObjectAssociation[] all){
|
private Set<IRealBuildObjectAssociation> getChildSuperClassRealSet(IRealBuildObjectAssociation obj, IRealBuildObjectAssociation[] all){
|
||||||
if(fObjToChildSuperClassMap == null)
|
if(fObjToChildSuperClassMap == null)
|
||||||
fObjToChildSuperClassMap = new PerTypeMapStorage();
|
fObjToChildSuperClassMap = new PerTypeMapStorage<IRealBuildObjectAssociation, Set<IRealBuildObjectAssociation>>();
|
||||||
|
|
||||||
if(all == null)
|
if(all == null)
|
||||||
all = TcModificationUtil.getExtensionObjects(obj.getType());
|
all = TcModificationUtil.getExtensionObjects(obj.getType());
|
||||||
|
|
||||||
Map<IRealBuildObjectAssociation, Set> map = fObjToChildSuperClassMap.getMap(obj.getType(), true);
|
Map<IRealBuildObjectAssociation, Set<IRealBuildObjectAssociation>> map = fObjToChildSuperClassMap.getMap(obj.getType(), true);
|
||||||
Set set = map.get(obj);
|
Set<IRealBuildObjectAssociation> set = map.get(obj);
|
||||||
if(set == null){
|
if(set == null){
|
||||||
set = createChildSuperClassRealSet(obj, all, null);
|
set = createChildSuperClassRealSet(obj, all, null);
|
||||||
map.put(obj, set);
|
map.put(obj, set);
|
||||||
|
|
Loading…
Add table
Reference in a new issue