diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/TcModificationUtil.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/TcModificationUtil.java index 74046f68bd3..cdef57d4c5b 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/TcModificationUtil.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/TcModificationUtil.java @@ -18,6 +18,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -57,7 +58,7 @@ public class TcModificationUtil { tc = ManagedBuildManager.getRealToolChain(tc); if(tc == rtc){ if(addSkipInfo && tcMap != null){ - Set set = getPathTreeSet(tcMap, tc); + Set set = getPathTreeSet(tcMap, (ToolChain)tc); set.add(childFoInfo.getPath()); } processFolderInfoChildren(childFoInfo, storage, tc, tcMap, toolMap, addSkipInfo); @@ -96,7 +97,7 @@ public class TcModificationUtil { IBuilder realBuilder = ManagedBuildManager.getRealBuilder(cfg.getBuilder()); Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true); - TreeSet pathSet = new TreeSet(PathComparator.INSTANCE); + Set pathSet = new TreeSet(PathComparator.INSTANCE); pathSet.add(p); map.put(realBuilder, pathSet); @@ -147,12 +148,12 @@ public class TcModificationUtil { IBuilder realBuilder = ManagedBuildManager.getRealBuilder(cfg.getBuilder()); if(skipMap != null && skipMap.containsKey(realBuilder)){ if(addSkipPaths){ - Set set = getPathTreeSet(skipMap, realBuilder); + Set set = getPathTreeSet(skipMap, (Builder)realBuilder); set.add(p); } } else { Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true); - TreeSet pathSet = new TreeSet(PathComparator.INSTANCE); + Set pathSet = new TreeSet(PathComparator.INSTANCE); pathSet.add(p); map.put(realBuilder, pathSet); } @@ -161,12 +162,12 @@ public class TcModificationUtil { IRealBuildObjectAssociation realCfg = ((Configuration)cfg).getRealBuildObject(); if(skipMap != null && skipMap.containsKey(realCfg)){ if(addSkipPaths){ - Set set = getPathTreeSet(skipMap, realCfg); + Set set = getPathTreeSet(skipMap, realCfg); set.add(p); } } else { Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_CONFIGURATION, true); - TreeSet pathSet = new TreeSet(PathComparator.INSTANCE); + Set pathSet = new TreeSet(PathComparator.INSTANCE); pathSet.add(p); map.put(realCfg, pathSet); } @@ -332,12 +333,12 @@ public class TcModificationUtil { Map skipMap = skipMapStorage != null ? skipMapStorage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false) : null; if(skipMap != null && skipMap.containsKey(rtc)){ if(addSkipPaths){ - TreeSet set = getPathTreeSet(skipMap, rtc); + Set set = getPathTreeSet(skipMap, (ToolChain)rtc); set.add(p); } } else { Map map = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, true); - TreeSet set = getPathTreeSet(map, rtc); + Set set = getPathTreeSet(map, (ToolChain)rtc); set.add(p); } @@ -390,30 +391,30 @@ public class TcModificationUtil { ITool rt = ManagedBuildManager.getRealTool(tools[i]); if(skipMap != null && skipMap.containsKey(rt)){ if(addSkipPaths){ - TreeSet set = getPathTreeSet(skipMap, rt); + Set set = getPathTreeSet(skipMap, (Tool)rt); set.add(path); } } else { - TreeSet set = getPathTreeSet(storageMap, rt); + Set set = getPathTreeSet(storageMap, (Tool)rt); set.add(path); } } } - public static TreeSet getPathTreeSet(Map map, Object obj){ - TreeSet set = (TreeSet)map.get(obj); + public static Set getPathTreeSet(Map> map, IRealBuildObjectAssociation bo){ + Set set = map.get(bo); if(set == null){ - set = new TreeSet(PathComparator.INSTANCE); - map.put(obj, set); + set = new TreeSet(PathComparator.INSTANCE); + map.put(bo, set); } return set; } - public static ArrayList getArrayList(Map map, Object obj){ - ArrayList list = (ArrayList)map.get(obj); + public static List getArrayList(Map> map, K obj){ + List list = map.get(obj); if(list == null){ - list = new ArrayList(); + list = new ArrayList(); map.put(obj, list); } return list; @@ -424,7 +425,7 @@ public class TcModificationUtil { } 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){ @@ -468,34 +469,34 @@ public class TcModificationUtil { // set.addAll(restoreSet); // } - public static void removePaths(Map map, IRealBuildObjectAssociation obj, Set paths){ - Set objPaths = (Set)map.get(obj); + public static void removePaths(Map> map, T bo, Set paths){ + Set objPaths = map.get(bo); if(objPaths == null) return; objPaths.removeAll(paths); if(objPaths.size() == 0) - map.remove(obj); + map.remove(bo); } - public static void addPaths(Map map, IRealBuildObjectAssociation obj, Set paths){ + public static void addPaths(Map> map, T bo, Set paths){ if(paths.size() == 0) return; - Set objPaths = (Set)map.get(obj); + Set objPaths = map.get(bo); if(objPaths == null){ - objPaths = new TreeSet(PathComparator.INSTANCE); - map.put(obj, objPaths); + objPaths = new TreeSet(PathComparator.INSTANCE); + map.put(bo, objPaths); } objPaths.addAll(paths); } - public static void addPath(Map map, IRealBuildObjectAssociation obj, IPath path){ - Set objPaths = (Set)map.get(obj); + public static void addPath(Map> map, T bo, IPath path){ + Set objPaths = map.get(bo); if(objPaths == null){ - objPaths = new TreeSet(PathComparator.INSTANCE); - map.put(obj, objPaths); + objPaths = new TreeSet(PathComparator.INSTANCE); + map.put(bo, objPaths); } objPaths.add(path); @@ -505,7 +506,7 @@ public class TcModificationUtil { Map bMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true); bMap.clear(); IBuilder realBuilder = ManagedBuildManager.getRealBuilder(builder); - TreeSet set = getPathTreeSet(bMap, realBuilder); + Set set = getPathTreeSet(bMap, (Builder)realBuilder); set.add(path); } @@ -544,7 +545,7 @@ public class TcModificationUtil { } @SuppressWarnings("unchecked") - Set set = (Set) oset.getSet(type, true); + Set set = oset.getSet(type, true); set.add(pathKey); } } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ToolChainModificationManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ToolChainModificationManager.java index 928b6edd2d5..4646331102f 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ToolChainModificationManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ToolChainModificationManager.java @@ -228,7 +228,7 @@ public class ToolChainModificationManager implements ConflictMatch conflict = new ConflictMatch(objType, rtToPathMap, type, matchingObjects); for (IRealBuildObjectAssociation bo : matchingObjects) { - ArrayList list = TcModificationUtil.getArrayList(objToConflictMatchMap, bo); + List list = TcModificationUtil.getArrayList(objToConflictMatchMap, bo); list.add(conflict); } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ToolListModification.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ToolListModification.java index f564d29fdfa..d7c1c11f665 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ToolListModification.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ToolListModification.java @@ -167,9 +167,10 @@ public abstract class ToolListModification implements IToolListModification { PerTypeMapStorage storage = getCompleteObjectStore(); Tool tool = fRealTool; Set rmSet = getToolApplicabilityPathSet(tool, true); + Map> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false); try { if(rmSet != null && rmSet.size() != 0) - TcModificationUtil.removePaths(storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false), tool, rmSet); + TcModificationUtil.removePaths(toolMap, tool, rmSet); if(DbgTcmUtil.DEBUG) DbgTcmUtil.dumpStorage(storage); @@ -179,7 +180,6 @@ public abstract class ToolListModification implements IToolListModification { fCompatibleTools = new HashMap(); fInCompatibleTools = new HashMap(); Tool sysTools[] = getTools(false, true); - @SuppressWarnings("unchecked") Map> conflictMap = (Map>) conflicts.fObjToConflictListMap; for(int i = 0; i < sysTools.length; i++){ Tool t = sysTools[i]; @@ -197,7 +197,7 @@ public abstract class ToolListModification implements IToolListModification { fCurrentElement = new ToolCompatibilityInfoElement(this, t, l); } finally { if(rmSet != null && rmSet.size() != 0) - TcModificationUtil.addPaths(storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false), tool, rmSet); + TcModificationUtil.addPaths(toolMap, tool, rmSet); } fInited = true; } @@ -383,10 +383,8 @@ public abstract class ToolListModification implements IToolListModification { public ToolListModification(ResourceInfo rcInfo, ToolListModification base){ fRcInfo = rcInfo; Tool[] initialTools = (Tool[])rcInfo.getTools(); - @SuppressWarnings("unchecked") Map initRealToToolMap = (Map) TcModificationUtil.getRealToObjectsMap(initialTools, null); Tool[] updatedTools = base.getTools(true, false); - @SuppressWarnings("unchecked") Map updatedRealToToolMap = (Map) TcModificationUtil.getRealToObjectsMap(updatedTools, null); Set> entrySet = updatedRealToToolMap.entrySet(); for (Entry entry : entrySet) { @@ -657,8 +655,7 @@ public abstract class ToolListModification implements IToolListModification { clearToolInfo(map.values().toArray(new Tool[map.size()])); PerTypeMapStorage storage = getCompleteObjectStore(); - @SuppressWarnings("unchecked") - Map toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, true); + Map> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, true); if(rmSet != null) TcModificationUtil.removePaths(toolMap, realRemoved, rmSet); if(addSet != null) @@ -703,9 +700,7 @@ public abstract class ToolListModification implements IToolListModification { } filteredTools = filterTools(allTools); - @SuppressWarnings("unchecked") Map filteredMap = (Map) TcModificationUtil.getRealToObjectsMap(filteredTools, null); - @SuppressWarnings("unchecked") Map allMap = (Map) TcModificationUtil.getRealToObjectsMap(allTools, null); allMap.keySet().removeAll(filteredMap.keySet()); fFilteredOutTools = allMap;