1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 19:35:36 +02:00

bug 319512: Missing type arguments on managedbuilder.core

This commit is contained in:
Andrew Gvozdev 2010-10-03 02:21:11 +00:00
parent 0d54e0ef9a
commit dcd77391c3
3 changed files with 37 additions and 41 deletions

View file

@ -18,6 +18,7 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
@ -57,7 +58,7 @@ public class TcModificationUtil {
tc = ManagedBuildManager.getRealToolChain(tc); tc = ManagedBuildManager.getRealToolChain(tc);
if(tc == rtc){ if(tc == rtc){
if(addSkipInfo && tcMap != null){ if(addSkipInfo && tcMap != null){
Set set = getPathTreeSet(tcMap, tc); Set<IPath> set = getPathTreeSet(tcMap, (ToolChain)tc);
set.add(childFoInfo.getPath()); set.add(childFoInfo.getPath());
} }
processFolderInfoChildren(childFoInfo, storage, tc, tcMap, toolMap, addSkipInfo); processFolderInfoChildren(childFoInfo, storage, tc, tcMap, toolMap, addSkipInfo);
@ -96,7 +97,7 @@ public class TcModificationUtil {
IBuilder realBuilder = ManagedBuildManager.getRealBuilder(cfg.getBuilder()); IBuilder realBuilder = ManagedBuildManager.getRealBuilder(cfg.getBuilder());
Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true); Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
TreeSet pathSet = new TreeSet(PathComparator.INSTANCE); Set<IPath> pathSet = new TreeSet<IPath>(PathComparator.INSTANCE);
pathSet.add(p); pathSet.add(p);
map.put(realBuilder, pathSet); map.put(realBuilder, pathSet);
@ -147,12 +148,12 @@ public class TcModificationUtil {
IBuilder realBuilder = ManagedBuildManager.getRealBuilder(cfg.getBuilder()); IBuilder realBuilder = ManagedBuildManager.getRealBuilder(cfg.getBuilder());
if(skipMap != null && skipMap.containsKey(realBuilder)){ if(skipMap != null && skipMap.containsKey(realBuilder)){
if(addSkipPaths){ if(addSkipPaths){
Set set = getPathTreeSet(skipMap, realBuilder); Set<IPath> set = getPathTreeSet(skipMap, (Builder)realBuilder);
set.add(p); set.add(p);
} }
} else { } else {
Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true); Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
TreeSet pathSet = new TreeSet(PathComparator.INSTANCE); Set<IPath> pathSet = new TreeSet<IPath>(PathComparator.INSTANCE);
pathSet.add(p); pathSet.add(p);
map.put(realBuilder, pathSet); map.put(realBuilder, pathSet);
} }
@ -161,12 +162,12 @@ public class TcModificationUtil {
IRealBuildObjectAssociation realCfg = ((Configuration)cfg).getRealBuildObject(); IRealBuildObjectAssociation realCfg = ((Configuration)cfg).getRealBuildObject();
if(skipMap != null && skipMap.containsKey(realCfg)){ if(skipMap != null && skipMap.containsKey(realCfg)){
if(addSkipPaths){ if(addSkipPaths){
Set set = getPathTreeSet(skipMap, realCfg); Set<IPath> set = getPathTreeSet(skipMap, realCfg);
set.add(p); set.add(p);
} }
} else { } else {
Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_CONFIGURATION, true); Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_CONFIGURATION, true);
TreeSet pathSet = new TreeSet(PathComparator.INSTANCE); Set<IPath> pathSet = new TreeSet<IPath>(PathComparator.INSTANCE);
pathSet.add(p); pathSet.add(p);
map.put(realCfg, pathSet); map.put(realCfg, pathSet);
} }
@ -332,12 +333,12 @@ public class TcModificationUtil {
Map skipMap = skipMapStorage != null ? skipMapStorage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false) : null; Map skipMap = skipMapStorage != null ? skipMapStorage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false) : null;
if(skipMap != null && skipMap.containsKey(rtc)){ if(skipMap != null && skipMap.containsKey(rtc)){
if(addSkipPaths){ if(addSkipPaths){
TreeSet set = getPathTreeSet(skipMap, rtc); Set<IPath> set = getPathTreeSet(skipMap, (ToolChain)rtc);
set.add(p); set.add(p);
} }
} else { } else {
Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, true); Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, true);
TreeSet set = getPathTreeSet(map, rtc); Set<IPath> set = getPathTreeSet(map, (ToolChain)rtc);
set.add(p); set.add(p);
} }
@ -390,30 +391,30 @@ public class TcModificationUtil {
ITool rt = ManagedBuildManager.getRealTool(tools[i]); ITool rt = ManagedBuildManager.getRealTool(tools[i]);
if(skipMap != null && skipMap.containsKey(rt)){ if(skipMap != null && skipMap.containsKey(rt)){
if(addSkipPaths){ if(addSkipPaths){
TreeSet set = getPathTreeSet(skipMap, rt); Set<IPath> set = getPathTreeSet(skipMap, (Tool)rt);
set.add(path); set.add(path);
} }
} else { } else {
TreeSet set = getPathTreeSet(storageMap, rt); Set<IPath> set = getPathTreeSet(storageMap, (Tool)rt);
set.add(path); set.add(path);
} }
} }
} }
public static TreeSet getPathTreeSet(Map map, Object obj){ public static Set<IPath> getPathTreeSet(Map<IRealBuildObjectAssociation, Set<IPath>> map, IRealBuildObjectAssociation bo){
TreeSet set = (TreeSet)map.get(obj); Set<IPath> set = map.get(bo);
if(set == null){ if(set == null){
set = new TreeSet(PathComparator.INSTANCE); set = new TreeSet<IPath>(PathComparator.INSTANCE);
map.put(obj, set); map.put(bo, set);
} }
return set; return set;
} }
public static ArrayList getArrayList(Map map, Object obj){ public static <K, V> List<V> getArrayList(Map<K, List<V>> map, K obj){
ArrayList list = (ArrayList)map.get(obj); List<V> list = map.get(obj);
if(list == null){ if(list == null){
list = new ArrayList(); list = new ArrayList<V>();
map.put(obj, list); map.put(obj, list);
} }
return list; return list;
@ -424,7 +425,7 @@ public class TcModificationUtil {
} }
public static void restoreBuilderInfo(PerTypeMapStorage storage, IBuilder builder, Object obj){ public static void restoreBuilderInfo(PerTypeMapStorage storage, IBuilder builder, Object obj){
storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true).put((Builder) builder, obj); storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true).put(builder, obj);
} }
// public static boolean removeToolInfo(PerTypeMapStorage storage, IPath path, ITool tool){ // public static boolean removeToolInfo(PerTypeMapStorage storage, IPath path, ITool tool){
@ -468,34 +469,34 @@ public class TcModificationUtil {
// set.addAll(restoreSet); // set.addAll(restoreSet);
// } // }
public static void removePaths(Map map, IRealBuildObjectAssociation obj, Set paths){ public static <T extends IRealBuildObjectAssociation> void removePaths(Map<T, Set<IPath>> map, T bo, Set<IPath> paths){
Set objPaths = (Set)map.get(obj); Set<IPath> objPaths = map.get(bo);
if(objPaths == null) if(objPaths == null)
return; return;
objPaths.removeAll(paths); objPaths.removeAll(paths);
if(objPaths.size() == 0) if(objPaths.size() == 0)
map.remove(obj); map.remove(bo);
} }
public static void addPaths(Map map, IRealBuildObjectAssociation obj, Set paths){ public static <T extends IRealBuildObjectAssociation> void addPaths(Map<T, Set<IPath>> map, T bo, Set<IPath> paths){
if(paths.size() == 0) if(paths.size() == 0)
return; return;
Set objPaths = (Set)map.get(obj); Set<IPath> objPaths = map.get(bo);
if(objPaths == null){ if(objPaths == null){
objPaths = new TreeSet(PathComparator.INSTANCE); objPaths = new TreeSet<IPath>(PathComparator.INSTANCE);
map.put(obj, objPaths); map.put(bo, objPaths);
} }
objPaths.addAll(paths); objPaths.addAll(paths);
} }
public static void addPath(Map map, IRealBuildObjectAssociation obj, IPath path){ public static <T extends IRealBuildObjectAssociation> void addPath(Map<T, Set<IPath>> map, T bo, IPath path){
Set objPaths = (Set)map.get(obj); Set<IPath> objPaths = map.get(bo);
if(objPaths == null){ if(objPaths == null){
objPaths = new TreeSet(PathComparator.INSTANCE); objPaths = new TreeSet<IPath>(PathComparator.INSTANCE);
map.put(obj, objPaths); map.put(bo, objPaths);
} }
objPaths.add(path); objPaths.add(path);
@ -505,7 +506,7 @@ public class TcModificationUtil {
Map bMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true); Map bMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true);
bMap.clear(); bMap.clear();
IBuilder realBuilder = ManagedBuildManager.getRealBuilder(builder); IBuilder realBuilder = ManagedBuildManager.getRealBuilder(builder);
TreeSet set = getPathTreeSet(bMap, realBuilder); Set<IPath> set = getPathTreeSet(bMap, (Builder)realBuilder);
set.add(path); set.add(path);
} }
@ -544,7 +545,7 @@ public class TcModificationUtil {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Set<IRealBuildObjectAssociation> set = (Set<IRealBuildObjectAssociation>) oset.getSet(type, true); Set<IRealBuildObjectAssociation> set = oset.getSet(type, true);
set.add(pathKey); set.add(pathKey);
} }
} }

View file

@ -228,7 +228,7 @@ public class ToolChainModificationManager implements
ConflictMatch conflict = new ConflictMatch(objType, rtToPathMap, type, matchingObjects); ConflictMatch conflict = new ConflictMatch(objType, rtToPathMap, type, matchingObjects);
for (IRealBuildObjectAssociation bo : matchingObjects) { for (IRealBuildObjectAssociation bo : matchingObjects) {
ArrayList<ConflictMatch> list = TcModificationUtil.getArrayList(objToConflictMatchMap, bo); List<ConflictMatch> list = TcModificationUtil.getArrayList(objToConflictMatchMap, bo);
list.add(conflict); list.add(conflict);
} }

View file

@ -167,9 +167,10 @@ public abstract class ToolListModification implements IToolListModification {
PerTypeMapStorage storage = getCompleteObjectStore(); PerTypeMapStorage storage = getCompleteObjectStore();
Tool tool = fRealTool; Tool tool = fRealTool;
Set<IPath> rmSet = getToolApplicabilityPathSet(tool, true); Set<IPath> rmSet = getToolApplicabilityPathSet(tool, true);
Map<Tool, Set<IPath>> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false);
try { try {
if(rmSet != null && rmSet.size() != 0) if(rmSet != null && rmSet.size() != 0)
TcModificationUtil.removePaths(storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false), tool, rmSet); TcModificationUtil.removePaths(toolMap, tool, rmSet);
if(DbgTcmUtil.DEBUG) if(DbgTcmUtil.DEBUG)
DbgTcmUtil.dumpStorage(storage); DbgTcmUtil.dumpStorage(storage);
@ -179,7 +180,6 @@ public abstract class ToolListModification implements IToolListModification {
fCompatibleTools = new HashMap<Tool, ToolCompatibilityInfoElement>(); fCompatibleTools = new HashMap<Tool, ToolCompatibilityInfoElement>();
fInCompatibleTools = new HashMap<Tool, ToolCompatibilityInfoElement>(); fInCompatibleTools = new HashMap<Tool, ToolCompatibilityInfoElement>();
Tool sysTools[] = getTools(false, true); Tool sysTools[] = getTools(false, true);
@SuppressWarnings("unchecked")
Map<Tool, List<ConflictMatch>> conflictMap = (Map<Tool, List<ConflictMatch>>) conflicts.fObjToConflictListMap; Map<Tool, List<ConflictMatch>> conflictMap = (Map<Tool, List<ConflictMatch>>) conflicts.fObjToConflictListMap;
for(int i = 0; i < sysTools.length; i++){ for(int i = 0; i < sysTools.length; i++){
Tool t = sysTools[i]; Tool t = sysTools[i];
@ -197,7 +197,7 @@ public abstract class ToolListModification implements IToolListModification {
fCurrentElement = new ToolCompatibilityInfoElement(this, t, l); fCurrentElement = new ToolCompatibilityInfoElement(this, t, l);
} finally { } finally {
if(rmSet != null && rmSet.size() != 0) if(rmSet != null && rmSet.size() != 0)
TcModificationUtil.addPaths(storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false), tool, rmSet); TcModificationUtil.addPaths(toolMap, tool, rmSet);
} }
fInited = true; fInited = true;
} }
@ -383,10 +383,8 @@ public abstract class ToolListModification implements IToolListModification {
public ToolListModification(ResourceInfo rcInfo, ToolListModification base){ public ToolListModification(ResourceInfo rcInfo, ToolListModification base){
fRcInfo = rcInfo; fRcInfo = rcInfo;
Tool[] initialTools = (Tool[])rcInfo.getTools(); Tool[] initialTools = (Tool[])rcInfo.getTools();
@SuppressWarnings("unchecked")
Map<Tool, Tool> initRealToToolMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(initialTools, null); Map<Tool, Tool> initRealToToolMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(initialTools, null);
Tool[] updatedTools = base.getTools(true, false); Tool[] updatedTools = base.getTools(true, false);
@SuppressWarnings("unchecked")
Map<Tool, Tool> updatedRealToToolMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(updatedTools, null); Map<Tool, Tool> updatedRealToToolMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(updatedTools, null);
Set<Entry<Tool, Tool>> entrySet = updatedRealToToolMap.entrySet(); Set<Entry<Tool, Tool>> entrySet = updatedRealToToolMap.entrySet();
for (Entry<Tool, Tool> entry : entrySet) { for (Entry<Tool, Tool> entry : entrySet) {
@ -657,8 +655,7 @@ public abstract class ToolListModification implements IToolListModification {
clearToolInfo(map.values().toArray(new Tool[map.size()])); clearToolInfo(map.values().toArray(new Tool[map.size()]));
PerTypeMapStorage storage = getCompleteObjectStore(); PerTypeMapStorage storage = getCompleteObjectStore();
@SuppressWarnings("unchecked") Map<Tool, Set<IPath>> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, true);
Map<Tool, Tool> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, true);
if(rmSet != null) if(rmSet != null)
TcModificationUtil.removePaths(toolMap, realRemoved, rmSet); TcModificationUtil.removePaths(toolMap, realRemoved, rmSet);
if(addSet != null) if(addSet != null)
@ -703,9 +700,7 @@ public abstract class ToolListModification implements IToolListModification {
} }
filteredTools = filterTools(allTools); filteredTools = filterTools(allTools);
@SuppressWarnings("unchecked")
Map<Tool, Tool> filteredMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(filteredTools, null); Map<Tool, Tool> filteredMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(filteredTools, null);
@SuppressWarnings("unchecked")
Map<Tool, Tool> allMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(allTools, null); Map<Tool, Tool> allMap = (Map<Tool, Tool>) TcModificationUtil.getRealToObjectsMap(allTools, null);
allMap.keySet().removeAll(filteredMap.keySet()); allMap.keySet().removeAll(filteredMap.keySet());
fFilteredOutTools = allMap; fFilteredOutTools = allMap;