mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
bug 319512: Missing type arguments on managedbuilder.core
This commit is contained in:
parent
a5fd16d96c
commit
7c2075b39a
2 changed files with 64 additions and 74 deletions
|
@ -12,11 +12,10 @@ package org.eclipse.cdt.managedbuilder.internal.tcmodification;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
|
@ -30,11 +29,11 @@ public class ConflictSet {
|
|||
public static final IBuildObject[] EMPTY_BO_ARRAY = new IBuildObject[0];
|
||||
|
||||
private PerTypeMapStorage fConflictStorage;
|
||||
private List fConflictMatchList;
|
||||
private Set fExtConflictSet;
|
||||
private List<ConflictMatch> fConflictMatchList;
|
||||
private Set<? extends IRealBuildObjectAssociation> fExtConflictSet;
|
||||
private IRealBuildObjectAssociation fRealObj;
|
||||
|
||||
public ConflictSet(IRealBuildObjectAssociation realObj, List conflictMatchList, Set extConflictSet){
|
||||
public ConflictSet(IRealBuildObjectAssociation realObj, List<ConflictMatch> conflictMatchList, Set<? extends IRealBuildObjectAssociation> extConflictSet){
|
||||
fConflictMatchList = conflictMatchList;
|
||||
fExtConflictSet = extConflictSet;
|
||||
fRealObj = realObj;
|
||||
|
@ -47,43 +46,42 @@ public class ConflictSet {
|
|||
int size = fConflictMatchList.size();
|
||||
PerTypeMapStorage result = new PerTypeMapStorage();
|
||||
for(int i = 0; i < size; i++){
|
||||
ConflictMatch match = (ConflictMatch)fConflictMatchList.get(i);
|
||||
ConflictMatch match = fConflictMatchList.get(i);
|
||||
int objType = match.fMatchType;
|
||||
Map cm = match.fRObjToPathMap;
|
||||
Map cur = result.getMap(objType, true);
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> cm = match.fRObjToPathMap;
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> cur = result.getMap(objType, true);
|
||||
|
||||
for(Iterator iter = cm.entrySet().iterator(); iter.hasNext(); ){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
Object obj = entry.getKey();
|
||||
Set<Entry<IRealBuildObjectAssociation, Set<IPath>>> entrySet = cm.entrySet();
|
||||
for (Entry<IRealBuildObjectAssociation, Set<IPath>> entry : entrySet) {
|
||||
IRealBuildObjectAssociation bo = entry.getKey();
|
||||
if(DbgTcmUtil.DEBUG){
|
||||
if(((IRealBuildObjectAssociation)obj).getType() != objType)
|
||||
if((bo).getType() != objType)
|
||||
DbgTcmUtil.fail();
|
||||
}
|
||||
|
||||
TreeSet set = (TreeSet)cur.get(obj);
|
||||
Set<IPath> set = cur.get(bo);
|
||||
if(set == null){
|
||||
set = new TreeSet(PathComparator.INSTANCE);
|
||||
cur.put(obj, set);
|
||||
set = new TreeSet<IPath>(PathComparator.INSTANCE);
|
||||
cur.put(bo, set);
|
||||
}
|
||||
|
||||
set.addAll((Set)entry.getValue());
|
||||
set.addAll(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
int type = types[i];
|
||||
Map map = result.getMap(type, false);
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> map = result.getMap(type, false);
|
||||
if(map == null)
|
||||
continue;
|
||||
|
||||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext(); ){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
Set<Entry<IRealBuildObjectAssociation, Set<IPath>>> entrySet = map.entrySet();
|
||||
for (Entry<IRealBuildObjectAssociation, Set<IPath>> entry : entrySet) {
|
||||
IRealBuildObjectAssociation obj = entry.getKey();
|
||||
Set<IPath> set = entry.getValue();
|
||||
|
||||
IRealBuildObjectAssociation obj = (IRealBuildObjectAssociation)entry.getKey();
|
||||
TreeSet set = (TreeSet)entry.getValue();
|
||||
|
||||
Map cMap = fConflictStorage.getMap(type, true);
|
||||
Map<IRealBuildObjectAssociation, Conflict> cMap = fConflictStorage.getMap(type, true);
|
||||
cMap.put(obj, new Conflict(IConflict.INCOMPATIBLE, obj, set));
|
||||
}
|
||||
}
|
||||
|
@ -94,10 +92,10 @@ public class ConflictSet {
|
|||
|
||||
private static class Conflict implements IConflict {
|
||||
private IRealBuildObjectAssociation fObj;
|
||||
private SortedSet fPathSet;
|
||||
private Set<IPath> fPathSet;
|
||||
private int fType;
|
||||
|
||||
Conflict(int type, IRealBuildObjectAssociation obj, SortedSet paths){
|
||||
Conflict(int type, IRealBuildObjectAssociation obj, Set<IPath> paths){
|
||||
fType = type;
|
||||
fObj = obj;
|
||||
fPathSet = paths;
|
||||
|
@ -116,16 +114,16 @@ public class ConflictSet {
|
|||
}
|
||||
|
||||
public IPath[] getPaths() {
|
||||
return (IPath[])fPathSet.toArray(new IPath[fPathSet.size()]);
|
||||
return fPathSet.toArray(new IPath[fPathSet.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
public IConflict[] getConflicts(){
|
||||
init();
|
||||
int types[] = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||
List list = new ArrayList();
|
||||
List<Conflict> list = new ArrayList<Conflict>();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
Map map = fConflictStorage.getMap(types[i], false);
|
||||
Map<IRealBuildObjectAssociation, Conflict> map = fConflictStorage.getMap(types[i], false);
|
||||
if(map == null)
|
||||
continue;
|
||||
|
||||
|
@ -135,28 +133,29 @@ public class ConflictSet {
|
|||
return conflictArray(list);
|
||||
}
|
||||
|
||||
private static List getConflicts(Map map, List list){
|
||||
private static List<Conflict> getConflicts(Map<IRealBuildObjectAssociation, Conflict> map, List<Conflict> list){
|
||||
if(list == null)
|
||||
list = new ArrayList();
|
||||
list = new ArrayList<Conflict>();
|
||||
|
||||
for(Iterator iter = map.values().iterator(); iter.hasNext(); ){
|
||||
list.add(iter.next());
|
||||
Collection<Conflict> conflicts = map.values();
|
||||
for (Conflict conflict : conflicts) {
|
||||
list.add(conflict);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static Conflict[] conflictArray(Collection list){
|
||||
return (Conflict[])list.toArray(new Conflict[list.size()]);
|
||||
private static Conflict[] conflictArray(Collection<Conflict> list){
|
||||
return list.toArray(new Conflict[list.size()]);
|
||||
}
|
||||
|
||||
private static IRealBuildObjectAssociation[] objArray(Collection list){
|
||||
return (IRealBuildObjectAssociation[])list.toArray(new IRealBuildObjectAssociation[list.size()]);
|
||||
private static IRealBuildObjectAssociation[] objArray(Collection<IRealBuildObjectAssociation> list){
|
||||
return list.toArray(new IRealBuildObjectAssociation[list.size()]);
|
||||
}
|
||||
|
||||
public IConflict[] getConflictsWith(int objectType){
|
||||
init();
|
||||
Map map = fConflictStorage.getMap(objectType, false);
|
||||
Map<IRealBuildObjectAssociation, Conflict> map = fConflictStorage.getMap(objectType, false);
|
||||
if(map == null)
|
||||
return EMPTY_CONFLICT_ARRAY;
|
||||
|
||||
|
@ -166,7 +165,7 @@ public class ConflictSet {
|
|||
|
||||
public IBuildObject[] getConflictingObjects(int objectType){
|
||||
init();
|
||||
Map map = fConflictStorage.getMap(objectType, false);
|
||||
Map<IRealBuildObjectAssociation, Conflict> map = fConflictStorage.getMap(objectType, false);
|
||||
if(map == null)
|
||||
return EMPTY_BO_ARRAY;
|
||||
|
||||
|
@ -179,10 +178,10 @@ public class ConflictSet {
|
|||
return null;
|
||||
|
||||
IRealBuildObjectAssociation obj = (IRealBuildObjectAssociation)bo;
|
||||
Map map = fConflictStorage.getMap(obj.getType(), false);
|
||||
Map<IRealBuildObjectAssociation, Conflict> map = fConflictStorage.getMap(obj.getType(), false);
|
||||
if(map == null)
|
||||
return null;
|
||||
|
||||
return (IConflict)map.get(obj);
|
||||
return map.get(obj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -120,17 +119,16 @@ public class ToolChainModificationManager implements
|
|||
return flags &= (~value);
|
||||
}
|
||||
|
||||
private boolean getMatchingObjects(int type, IObjectSet[] oSets, Set skipSet, IRealBuildObjectAssociation additionalSkip, Set result){
|
||||
Set tmp = null;
|
||||
private boolean getMatchingObjects(int type, IObjectSet[] oSets, Set<IRealBuildObjectAssociation> skipSet, IRealBuildObjectAssociation additionalSkip, Set<IRealBuildObjectAssociation> result){
|
||||
Set<IRealBuildObjectAssociation> tmp = null;
|
||||
boolean added = false;
|
||||
for(int i = 0; i < oSets.length; i++){
|
||||
IObjectSet os = oSets[i];
|
||||
for (IObjectSet os : oSets) {
|
||||
int setType = os.getObjectType();
|
||||
if(setType != type)
|
||||
continue;
|
||||
|
||||
if(tmp == null)
|
||||
tmp = new HashSet();
|
||||
tmp = new HashSet<IRealBuildObjectAssociation>();
|
||||
else
|
||||
tmp.clear();
|
||||
|
||||
|
@ -160,14 +158,13 @@ public class ToolChainModificationManager implements
|
|||
|
||||
public static class ConflictMatch {
|
||||
final int fMatchType;
|
||||
final Map fRObjToPathMap;
|
||||
final Map<IRealBuildObjectAssociation, Set<IPath>> fRObjToPathMap;
|
||||
final int fConflictType;
|
||||
final Set fConflicts;
|
||||
final Set<IRealBuildObjectAssociation> fConflicts;
|
||||
|
||||
ConflictMatch(int matchType, Map robjToPathMap,
|
||||
int conflictType, Set conflicts){
|
||||
ConflictMatch(int matchType, Map<IRealBuildObjectAssociation, Set<IPath>> rtToPathMap, int conflictType, Set<IRealBuildObjectAssociation> conflicts){
|
||||
fMatchType = matchType;
|
||||
fRObjToPathMap = Collections.unmodifiableMap(robjToPathMap);
|
||||
fRObjToPathMap = Collections.unmodifiableMap(rtToPathMap);
|
||||
fConflictType = conflictType;
|
||||
fConflicts = Collections.unmodifiableSet(conflicts);
|
||||
}
|
||||
|
@ -192,8 +189,8 @@ public class ToolChainModificationManager implements
|
|||
//2. get variants for applicable ones
|
||||
|
||||
//1.first filter applicable to not-this
|
||||
List conflictList = new ArrayList();
|
||||
Map objToConflictMatchMap = new HashMap();
|
||||
List<ConflictMatch> conflictList = new ArrayList<ConflictMatch>();
|
||||
Map<IRealBuildObjectAssociation, List<ConflictMatch>> objToConflictMatchMap = new HashMap<IRealBuildObjectAssociation, List<ConflictMatch>>();
|
||||
|
||||
ObjectSetListBasedDefinition[] defs = RulesManager.getInstance().getRules(ObjectSetListBasedDefinition.CONFLICT);
|
||||
for(int i = 0; i < defs.length; i++){
|
||||
|
@ -203,13 +200,14 @@ public class ToolChainModificationManager implements
|
|||
for(int k = 0; k < oss.length; k++){
|
||||
IObjectSet os = oss[k];
|
||||
int objType = os.getObjectType();
|
||||
Map rtToPathMap = rtToPath.getMap(objType, false);
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> rtToPathMap = rtToPath.getMap(objType, false);
|
||||
if(rtToPathMap == null)
|
||||
continue;
|
||||
|
||||
rtToPathMap = (Map)((HashMap)rtToPathMap).clone();
|
||||
Set skipSet = skip != null ? skip.getSet(objType, false) : null;
|
||||
Set objSet = rtToPathMap.keySet();
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> clone = (Map<IRealBuildObjectAssociation, Set<IPath>>)((HashMap<IRealBuildObjectAssociation, Set<IPath>>)rtToPathMap).clone();
|
||||
rtToPathMap = clone;
|
||||
Set<IRealBuildObjectAssociation> skipSet = skip != null ? (Set<IRealBuildObjectAssociation>)skip.getSet(objType, false) : null;
|
||||
Set<IRealBuildObjectAssociation> objSet = rtToPathMap.keySet();
|
||||
|
||||
if(skipSet != null)
|
||||
objSet.removeAll(skipSet);
|
||||
|
@ -217,25 +215,20 @@ public class ToolChainModificationManager implements
|
|||
os.retainMatches(objSet);
|
||||
|
||||
if(objSet.size() != 0){
|
||||
List remainingList = new ArrayList(Arrays.asList(oss));
|
||||
List<IObjectSet> remainingList = new ArrayList<IObjectSet>(Arrays.asList(oss));
|
||||
remainingList.remove(os);
|
||||
|
||||
IObjectSet[] remaining = (IObjectSet[])remainingList.toArray(new IObjectSet[remainingList.size()]);
|
||||
IObjectSet[] remaining = remainingList.toArray(new IObjectSet[remainingList.size()]);
|
||||
//get objects matching remaining
|
||||
skipSet = skip != null ? skip.getSet(type, false) : null;
|
||||
Set matchingObjects = new HashSet();
|
||||
getMatchingObjects(type, remaining, skipSet,
|
||||
null,
|
||||
matchingObjects);
|
||||
Set<IRealBuildObjectAssociation> skipSet2 = skip != null ? (Set<IRealBuildObjectAssociation>)skip.getSet(type, false) : null;
|
||||
Set<IRealBuildObjectAssociation> matchingObjects = new HashSet<IRealBuildObjectAssociation>();
|
||||
getMatchingObjects(type, remaining, skipSet2, null, matchingObjects);
|
||||
if(matchingObjects.size() != 0){
|
||||
ConflictMatch conflict = new ConflictMatch(
|
||||
objType,
|
||||
rtToPathMap,
|
||||
type,
|
||||
matchingObjects);
|
||||
ConflictMatch conflict = new ConflictMatch(objType, rtToPathMap, type, matchingObjects);
|
||||
|
||||
for(Iterator iter = matchingObjects.iterator(); iter.hasNext(); ){
|
||||
TcModificationUtil.getArrayList(objToConflictMatchMap, iter.next()).add(conflict);
|
||||
for (IRealBuildObjectAssociation bo : matchingObjects) {
|
||||
ArrayList<ConflictMatch> list = TcModificationUtil.getArrayList(objToConflictMatchMap, bo);
|
||||
list.add(conflict);
|
||||
}
|
||||
|
||||
conflictList.add(conflict);
|
||||
|
@ -245,8 +238,6 @@ public class ToolChainModificationManager implements
|
|||
}
|
||||
}
|
||||
|
||||
return new ConflictMatchSet(
|
||||
(ConflictMatch[])conflictList.toArray(new ConflictMatch[conflictList.size()]),
|
||||
objToConflictMatchMap);
|
||||
return new ConflictMatchSet(conflictList.toArray(new ConflictMatch[conflictList.size()]), objToConflictMatchMap);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue