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