1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

bug 319512: Missing type arguments on managedbuilder.core

This commit is contained in:
Andrew Gvozdev 2010-10-02 03:27:59 +00:00
parent 519a818008
commit 786416e2fc
7 changed files with 89 additions and 72 deletions

View file

@ -130,7 +130,7 @@ public class ConfigurationModification extends FolderInfoModification implements
fInCompatibleBuilders = new HashMap<IBuilder, BuilderCompatibilityInfoElement>(); fInCompatibleBuilders = new HashMap<IBuilder, BuilderCompatibilityInfoElement>();
ConflictMatchSet conflicts = getParentConflictMatchSet(); ConflictMatchSet conflicts = getParentConflictMatchSet();
IBuilder sysBs[] = getAllSysBuilders(); IBuilder sysBs[] = getAllSysBuilders();
Map<IBuilder, List<ConflictMatch>> conflictMap = conflicts.fObjToConflictListMap; Map<Builder, List<ConflictMatch>> conflictMap = conflicts.fObjToConflictListMap;
for(int i = 0; i < sysBs.length; i++){ for(int i = 0; i < sysBs.length; i++){
Builder b = (Builder) sysBs[i]; Builder b = (Builder) sysBs[i];
List<ConflictMatch> l = conflictMap.get(b); List<ConflictMatch> l = conflictMap.get(b);

View file

@ -23,7 +23,6 @@ import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IFolderInfo; import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedProject; import org.eclipse.cdt.managedbuilder.core.IManagedProject;
@ -175,7 +174,7 @@ public class FolderInfoModification extends ToolListModification implements IFol
ConflictMatchSet parentConflicts = getParentConflictMatchSet(); ConflictMatchSet parentConflicts = getParentConflictMatchSet();
ToolChain sysTCs[] = (ToolChain[])getAllSysToolChains(); ToolChain sysTCs[] = (ToolChain[])getAllSysToolChains();
Map<IBuilder, List<ConflictMatch>> conflictMap = parentConflicts.fObjToConflictListMap; Map<ToolChain, List<ConflictMatch>> conflictMap = parentConflicts.fObjToConflictListMap;
for (ToolChain tc : sysTCs) { for (ToolChain tc : sysTCs) {
List<ConflictMatch> l = conflictMap.get(tc); List<ConflictMatch> l = conflictMap.get(tc);
ToolChainCompatibilityInfoElement info = new ToolChainCompatibilityInfoElement(tc, l); ToolChainCompatibilityInfoElement info = new ToolChainCompatibilityInfoElement(tc, l);
@ -311,9 +310,9 @@ public class FolderInfoModification extends ToolListModification implements IFol
PerTypeSetStorage oSet = pathMap.get(path); PerTypeSetStorage oSet = pathMap.get(path);
Set<Tool> toolSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false); Set<Tool> toolSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false);
Set<IPath> tcSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false); Set<ToolChain> tcSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
ToolChain curTc = (ToolChain)tcSet.iterator().next(); ToolChain curTc = tcSet.iterator().next();
Set<IPath> foInfoPaths = tcApplicabilityPaths.fFolderInfoPaths; Set<IPath> foInfoPaths = tcApplicabilityPaths.fFolderInfoPaths;
Set<IPath> fileInfoPaths = tcApplicabilityPaths.fFileInfoPaths; Set<IPath> fileInfoPaths = tcApplicabilityPaths.fFileInfoPaths;
@ -322,7 +321,8 @@ public class FolderInfoModification extends ToolListModification implements IFol
Map<Tool, Set<IPath>> toolPathsMap = tcApplicabilityPaths.fToolPathMap; Map<Tool, Set<IPath>> toolPathsMap = tcApplicabilityPaths.fToolPathMap;
if(toolSet != null){ if(toolSet != null){
for (Tool tool : toolSet) { for (IRealBuildObjectAssociation oa : toolSet) {
Tool tool = (Tool) oa;
Set<IPath> set = new HashSet<IPath>(); Set<IPath> set = new HashSet<IPath>();
toolPathsMap.put(tool, set); toolPathsMap.put(tool, set);
set.add(path); set.add(path);
@ -359,8 +359,8 @@ public class FolderInfoModification extends ToolListModification implements IFol
for (Entry<IPath, PerTypeSetStorage> entry : entrySet) { for (Entry<IPath, PerTypeSetStorage> entry : entrySet) {
PerTypeSetStorage cst = entry.getValue(); PerTypeSetStorage cst = entry.getValue();
Set<ToolChain> ctc = cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false); Set<ToolChain> ctc = (Set<ToolChain>) cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
Set<Tool> ct = cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false); Set<Tool> ct = (Set<Tool>) cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false);
if(ctc == null || ctc.size() == 0){ if(ctc == null || ctc.size() == 0){
@ -384,8 +384,8 @@ public class FolderInfoModification extends ToolListModification implements IFol
ToolChainApplicabilityPaths tcApplicability = getToolChainApplicabilityPaths(); ToolChainApplicabilityPaths tcApplicability = getToolChainApplicabilityPaths();
PerTypeMapStorage storage = getCompleteObjectStore(); PerTypeMapStorage storage = getCompleteObjectStore();
Map<ToolChain, Set<IPath>> tcMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false); Map<ToolChain, Set> tcMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
Map<Tool, Set<IPath>> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false); Map<Tool, Set> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false);
TcModificationUtil.removePaths(tcMap, fRealToolChain, tcApplicability.fFolderInfoPaths); TcModificationUtil.removePaths(tcMap, fRealToolChain, tcApplicability.fFolderInfoPaths);

View file

@ -12,12 +12,15 @@ 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 implements Cloneable { public class PerTypeMapStorage implements Cloneable {
private ObjectTypeBasedStorage fStorage = new ObjectTypeBasedStorage(); private ObjectTypeBasedStorage fStorage = new ObjectTypeBasedStorage();
public Map getMap(int type, boolean create){ public Map getMap(int type, boolean create){
Map map = (Map)fStorage.get(type); Map<IRealBuildObjectAssociation, Set> map = (Map<IRealBuildObjectAssociation, Set>)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);
@ -25,10 +28,13 @@ public class PerTypeMapStorage implements Cloneable {
return map; return map;
} }
protected Map createMap(Map map){ protected Map<IRealBuildObjectAssociation, Set> createMap(Map<IRealBuildObjectAssociation, Set> map){
if(map == null) if(map == null) {
return new HashMap(); return new HashMap<IRealBuildObjectAssociation, Set>();
return (Map)((HashMap)map).clone(); }
@SuppressWarnings("unchecked")
Map<IRealBuildObjectAssociation, Set> clone = (Map<IRealBuildObjectAssociation, Set>)((HashMap<IRealBuildObjectAssociation, Set>)map).clone();
return clone;
} }
@Override @Override
@ -37,9 +43,10 @@ public class PerTypeMapStorage implements Cloneable {
PerTypeMapStorage clone = (PerTypeMapStorage)super.clone(); PerTypeMapStorage clone = (PerTypeMapStorage)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++){
Object o = clone.fStorage.get(types[i]); @SuppressWarnings("unchecked")
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((Map)o)); clone.fStorage.set(types[i], clone.createMap(o));
} }
} }
return clone; return clone;

View file

@ -13,11 +13,13 @@ 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 implements Cloneable { public class PerTypeSetStorage implements Cloneable {
private ObjectTypeBasedStorage fStorage = new ObjectTypeBasedStorage(); private ObjectTypeBasedStorage fStorage = new ObjectTypeBasedStorage();
public Set getSet(int type, boolean create){ public Set getSet(int type, boolean create){
Set set = (Set)fStorage.get(type); Set<IRealBuildObjectAssociation> set = (Set<IRealBuildObjectAssociation>)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);
@ -25,10 +27,12 @@ public class PerTypeSetStorage implements Cloneable {
return set; return set;
} }
protected Set createSet(Set set){ protected Set<IRealBuildObjectAssociation> createSet(Set<IRealBuildObjectAssociation> set){
if(set == null) if(set == null)
return new LinkedHashSet(); return new LinkedHashSet<IRealBuildObjectAssociation>();
return (Set)((LinkedHashSet)set).clone(); @SuppressWarnings("unchecked")
Set<IRealBuildObjectAssociation> clone = (Set<IRealBuildObjectAssociation>)((LinkedHashSet<IRealBuildObjectAssociation>)set).clone();
return clone;
} }
@Override @Override
@ -38,9 +42,10 @@ public class PerTypeSetStorage implements Cloneable {
clone.fStorage = (ObjectTypeBasedStorage)fStorage.clone(); clone.fStorage = (ObjectTypeBasedStorage)fStorage.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++){
Object o = clone.fStorage.get(types[i]); @SuppressWarnings("unchecked")
Set<IRealBuildObjectAssociation> o = (Set<IRealBuildObjectAssociation>) clone.fStorage.get(types[i]);
if(o != null){ if(o != null){
clone.fStorage.set(types[i], createSet((Set)o)); clone.fStorage.set(types[i], createSet(o));
} }
} }
return clone; return clone;
@ -56,8 +61,9 @@ 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++){
Object o = fStorage.get(types[i]); @SuppressWarnings("unchecked")
if(o != null && !((Set)o).isEmpty()) Set<IRealBuildObjectAssociation> o = (Set<IRealBuildObjectAssociation>) fStorage.get(types[i]);
if(o != null && !((Set<IRealBuildObjectAssociation>)o).isEmpty())
return false; return false;
} }
return true; return true;

View file

@ -19,6 +19,7 @@ import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
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.SortedSet;
import java.util.TreeMap; import java.util.TreeMap;
@ -30,6 +31,7 @@ import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain; import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.Builder;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration; import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo; import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation; import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
@ -183,22 +185,23 @@ public class TcModificationUtil {
return storage; return storage;
} }
public static TreeMap createResultingChangesMap(TreeMap resultingMap, TreeMap initialMap){ public static TreeMap<IPath, PerTypeSetStorage> createResultingChangesMap(TreeMap<IPath, PerTypeSetStorage> resultingMap, TreeMap<IPath, PerTypeSetStorage> initialMap){
int[] types = new int []{ int[] types = new int []{
IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, IRealBuildObjectAssociation.OBJECT_TOOLCHAIN,
IRealBuildObjectAssociation.OBJECT_BUILDER, IRealBuildObjectAssociation.OBJECT_BUILDER,
IRealBuildObjectAssociation.OBJECT_TOOL, IRealBuildObjectAssociation.OBJECT_TOOL,
}; };
TreeMap result = new TreeMap(PathComparator.INSTANCE); TreeMap<IPath, PerTypeSetStorage> result = new TreeMap<IPath, PerTypeSetStorage>(PathComparator.INSTANCE);
initialMap = (TreeMap)initialMap.clone(); @SuppressWarnings("unchecked")
TreeMap<IPath, PerTypeSetStorage> clone = (TreeMap<IPath, PerTypeSetStorage>)initialMap.clone();
initialMap = clone;
for(Iterator iter = resultingMap.entrySet().iterator(); iter.hasNext();){ for (Entry<IPath, PerTypeSetStorage> entry : resultingMap.entrySet()) {
Map.Entry entry = (Map.Entry)iter.next(); IPath oPath = entry.getKey();
Object oPath = entry.getKey();
PerTypeSetStorage resStorage = (PerTypeSetStorage)entry.getValue(); PerTypeSetStorage resStorage = entry.getValue();
PerTypeSetStorage initStorage = (PerTypeSetStorage)initialMap.remove(oPath); PerTypeSetStorage initStorage = initialMap.remove(oPath);
PerTypeSetStorage storage; PerTypeSetStorage storage;
if(initStorage == null || initStorage.isEmpty(true)){ if(initStorage == null || initStorage.isEmpty(true)){
@ -233,7 +236,7 @@ public class TcModificationUtil {
ToolChain tc = setToStore.size() != 0 ? ToolChain tc = setToStore.size() != 0 ?
(ToolChain)setToStore.iterator().next() : null; (ToolChain)setToStore.iterator().next() : null;
IPath path = (IPath)oPath; IPath path = oPath;
if(tc != null){ if(tc != null){
tInitSet = new LinkedHashSet(); tInitSet = new LinkedHashSet();
TcModificationUtil.getRealObjectsSet((Tool[])tc.getTools(), tInitSet); TcModificationUtil.getRealObjectsSet((Tool[])tc.getTools(), tInitSet);
@ -279,7 +282,7 @@ public class TcModificationUtil {
if(initialMap.size() != 0){ if(initialMap.size() != 0){
for(Iterator iter = initialMap.entrySet().iterator(); iter.hasNext(); ){ for(Iterator iter = initialMap.entrySet().iterator(); iter.hasNext(); ){
Map.Entry entry = (Map.Entry)iter.next(); Map.Entry entry = (Map.Entry)iter.next();
Object oPath = entry.getKey(); IPath oPath = (IPath) entry.getKey();
PerTypeSetStorage initStorage = (PerTypeSetStorage)entry.getValue(); PerTypeSetStorage initStorage = (PerTypeSetStorage)entry.getValue();
@ -360,9 +363,9 @@ public class TcModificationUtil {
return set; return set;
} }
public static Map getRealToObjectsMap(IRealBuildObjectAssociation[] objs, Map map){ public static Map<IRealBuildObjectAssociation, IRealBuildObjectAssociation> getRealToObjectsMap(IRealBuildObjectAssociation[] objs, Map<IRealBuildObjectAssociation, IRealBuildObjectAssociation> map){
if(map == null) if(map == null)
map = new LinkedHashMap(); map = new LinkedHashMap<IRealBuildObjectAssociation, IRealBuildObjectAssociation>();
for(int i = 0; i < objs.length; i++){ for(int i = 0; i < objs.length; i++){
map.put(objs[i].getRealBuildObject(), objs[i]); map.put(objs[i].getRealBuildObject(), objs[i]);
} }
@ -421,7 +424,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, obj); storage.getMap(IRealBuildObjectAssociation.OBJECT_BUILDER, true).put((Builder) builder, obj);
} }
// public static boolean removeToolInfo(PerTypeMapStorage storage, IPath path, ITool tool){ // public static boolean removeToolInfo(PerTypeMapStorage storage, IPath path, ITool tool){
@ -514,13 +517,13 @@ public class TcModificationUtil {
set.add(realBuilder); set.add(realBuilder);
} }
public static TreeMap createPathMap(IConfiguration cfg){ public static TreeMap<IPath, PerTypeSetStorage> createPathMap(IConfiguration cfg){
//TODO: optimize to calculate the map directly //TODO: optimize to calculate the map directly
PerTypeMapStorage storage = createRealToolToPathSet(cfg, null, false); PerTypeMapStorage storage = createRealToolToPathSet(cfg, null, false);
return createPathMap(storage); return createPathMap(storage);
} }
public static TreeMap createPathMap(PerTypeMapStorage storage){ public static TreeMap<IPath,PerTypeSetStorage> createPathMap(PerTypeMapStorage storage){
int[] types = ObjectTypeBasedStorage.getSupportedObjectTypes(); int[] types = ObjectTypeBasedStorage.getSupportedObjectTypes();
TreeMap result = new TreeMap(PathComparator.INSTANCE); TreeMap result = new TreeMap(PathComparator.INSTANCE);
for(int i = 0; i < types.length; i++){ for(int i = 0; i < types.length; i++){

View file

@ -39,6 +39,7 @@ import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain; import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
import org.eclipse.cdt.managedbuilder.internal.core.ToolChainModificationHelper; import org.eclipse.cdt.managedbuilder.internal.core.ToolChainModificationHelper;
import org.eclipse.cdt.managedbuilder.internal.core.ToolListModificationInfo; import org.eclipse.cdt.managedbuilder.internal.core.ToolListModificationInfo;
import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificationManager.ConflictMatch;
import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificationManager.ConflictMatchSet; import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificationManager.ConflictMatchSet;
import org.eclipse.cdt.managedbuilder.tcmodification.CompatibilityStatus; import org.eclipse.cdt.managedbuilder.tcmodification.CompatibilityStatus;
import org.eclipse.cdt.managedbuilder.tcmodification.IModificationOperation; import org.eclipse.cdt.managedbuilder.tcmodification.IModificationOperation;
@ -60,9 +61,9 @@ public abstract class ToolListModification implements IToolListModification {
// private LinkedHashMap fRealToToolMap = new LinkedHashMap(); // private LinkedHashMap fRealToToolMap = new LinkedHashMap();
// private boolean fSysInfoMapInited; // private boolean fSysInfoMapInited;
private PerTypeMapStorage fCompleteObjectStorage; private PerTypeMapStorage fCompleteObjectStorage;
protected TreeMap fCompletePathMapStorage; protected TreeMap<IPath, PerTypeSetStorage> fCompletePathMapStorage;
private HashSet<Tool> fAddCapableTools; private HashSet<Tool> fAddCapableTools;
private Map fFilteredOutTools; private Map<Tool, Tool> fFilteredOutTools;
private ToolListModificationInfo fModificationInfo; private ToolListModificationInfo fModificationInfo;
@ -128,7 +129,7 @@ public abstract class ToolListModification implements IToolListModification {
private Tool fSelectedTool; private Tool fSelectedTool;
private Tool fRealTool; private Tool fRealTool;
private boolean fInited; private boolean fInited;
private Set fExtConflictTools; private Set<Tool> fExtConflictTools;
ProjToolCompatibilityStatusInfo(Tool tool){ ProjToolCompatibilityStatusInfo(Tool tool){
fSelectedTool = tool; fSelectedTool = tool;
@ -166,7 +167,7 @@ public abstract class ToolListModification implements IToolListModification {
PerTypeMapStorage storage = getCompleteObjectStore(); PerTypeMapStorage storage = getCompleteObjectStore();
Tool tool = fRealTool; Tool tool = fRealTool;
Set rmSet = getToolApplicabilityPathSet(tool, true); Set<IPath> rmSet = getToolApplicabilityPathSet(tool, true);
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(storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false), tool, rmSet);
@ -179,10 +180,10 @@ 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);
Map conflictMap = conflicts.fObjToConflictListMap; Map<Tool, List<ConflictMatch>> conflictMap = 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];
List l = (List)conflictMap.get(t); List<ConflictMatch> l = conflictMap.get(t);
ToolCompatibilityInfoElement el = new ToolCompatibilityInfoElement(this, t, l); ToolCompatibilityInfoElement el = new ToolCompatibilityInfoElement(this, t, l);
if(el.isCompatible()){ if(el.isCompatible()){
fCompatibleTools.put(t, el); fCompatibleTools.put(t, el);
@ -192,7 +193,7 @@ public abstract class ToolListModification implements IToolListModification {
} }
Tool t = fRealTool; Tool t = fRealTool;
List l = (List)conflictMap.get(t); List<ConflictMatch> l = conflictMap.get(t);
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)
@ -201,13 +202,13 @@ public abstract class ToolListModification implements IToolListModification {
fInited = true; fInited = true;
} }
private Set getConflictingTools(){ private Set<Tool> getConflictingTools(){
if(fExtConflictTools == null){ if(fExtConflictTools == null){
Tool[] tmp = new Tool[1]; Tool[] tmp = new Tool[1];
tmp[0] = fSelectedTool; tmp[0] = fSelectedTool;
tmp = filterTools(tmp); tmp = filterTools(tmp);
if(tmp.length == 0) if(tmp.length == 0)
fExtConflictTools = Collections.EMPTY_SET; fExtConflictTools = Collections.emptySet();
else else
fExtConflictTools = getExtensionConflictToolSet(fSelectedTool, filterTools(getTools(true, false))); fExtConflictTools = getExtensionConflictToolSet(fSelectedTool, filterTools(getTools(true, false)));
} }
@ -441,19 +442,19 @@ public abstract class ToolListModification implements IToolListModification {
protected abstract boolean canAdd(Tool tool); protected abstract boolean canAdd(Tool tool);
protected abstract Set getToolApplicabilityPathSet(Tool realTool, boolean isProject); protected abstract Set<IPath> getToolApplicabilityPathSet(Tool realTool, boolean isProject);
protected abstract Set getExtensionConflictToolSet(Tool tool, Tool[] toos); protected abstract Set<Tool> getExtensionConflictToolSet(Tool tool, Tool[] toos);
protected abstract Tool[] filterTools(Tool[] tools); protected abstract Tool[] filterTools(Tool[] tools);
public class ToolCompatibilityInfoElement { public class ToolCompatibilityInfoElement {
private Tool fRealTool; private Tool fRealTool;
private List fErrComflictMatchList; private List<ConflictMatch> fErrComflictMatchList;
private CompatibilityStatus fStatus; private CompatibilityStatus fStatus;
private ProjToolCompatibilityStatusInfo fStatusInfo; private ProjToolCompatibilityStatusInfo fStatusInfo;
ToolCompatibilityInfoElement(ProjToolCompatibilityStatusInfo statusInfo, Tool realTool, List errConflictList){ ToolCompatibilityInfoElement(ProjToolCompatibilityStatusInfo statusInfo, Tool realTool, List<ConflictMatch> errConflictList){
fStatusInfo = statusInfo; fStatusInfo = statusInfo;
fRealTool = realTool; fRealTool = realTool;
if(errConflictList != null && errConflictList.size() != 0) if(errConflictList != null && errConflictList.size() != 0)
@ -501,13 +502,13 @@ public abstract class ToolListModification implements IToolListModification {
} }
public final void apply() throws CoreException { public final void apply() throws CoreException {
TreeMap initialMap = TcModificationUtil.createPathMap(fRcInfo.getParent()); TreeMap<IPath, PerTypeSetStorage> initialMap = TcModificationUtil.createPathMap(fRcInfo.getParent());
TreeMap cur = getCompletePathMapStorage(); TreeMap<IPath, PerTypeSetStorage> cur = getCompletePathMapStorage();
TreeMap result = TcModificationUtil.createResultingChangesMap(cur, initialMap); TreeMap<IPath, PerTypeSetStorage> result = TcModificationUtil.createResultingChangesMap(cur, initialMap);
apply(result); apply(result);
} }
private void apply(TreeMap resultingChangeMap) throws CoreException { private void apply(TreeMap<IPath, PerTypeSetStorage> resultingChangeMap) throws CoreException {
//the order matters here: we first should process tool-chain than a builder and then tools //the order matters here: we first should process tool-chain than a builder and then tools
int types[] = new int[]{ int types[] = new int[]{
IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, IRealBuildObjectAssociation.OBJECT_TOOLCHAIN,
@ -517,17 +518,17 @@ public abstract class ToolListModification implements IToolListModification {
int type; int type;
IConfiguration cfg = fRcInfo.getParent(); IConfiguration cfg = fRcInfo.getParent();
for(Iterator iter = resultingChangeMap.entrySet().iterator(); iter.hasNext(); ){ Set<Entry<IPath, PerTypeSetStorage>> entrySet = resultingChangeMap.entrySet();
Map.Entry entry = (Map.Entry)iter.next(); for (Entry<IPath, PerTypeSetStorage> entry : entrySet) {
IPath path = (IPath)entry.getKey(); IPath path = entry.getKey();
ResourceInfo rcInfo = (ResourceInfo)cfg.getResourceInfo(path, true); ResourceInfo rcInfo = (ResourceInfo)cfg.getResourceInfo(path, true);
if(rcInfo == null){ if(rcInfo == null){
rcInfo = (FolderInfo)cfg.createFolderInfo(path); rcInfo = (FolderInfo)cfg.createFolderInfo(path);
} }
PerTypeSetStorage storage = (PerTypeSetStorage)entry.getValue(); PerTypeSetStorage storage = entry.getValue();
for(int i = 0; i < types.length; i++){ for(int i = 0; i < types.length; i++){
type = types[i]; type = types[i];
Set set = storage.getSet(type, false); Set<IRealBuildObjectAssociation> set = storage.getSet(type, false);
if(set != null){ if(set != null){
apply(rcInfo, type, set); apply(rcInfo, type, set);
} }
@ -589,8 +590,8 @@ public abstract class ToolListModification implements IToolListModification {
public IToolModification getToolModification(ITool tool) { public IToolModification getToolModification(ITool tool) {
Tool rt = (Tool)ManagedBuildManager.getRealTool(tool); Tool rt = (Tool)ManagedBuildManager.getRealTool(tool);
boolean isProj = isProjectTool(rt); boolean isProj = isProjectTool(rt);
Map map = getMap(isProj); Map<Tool, IToolModification> map = getMap(isProj);
IToolModification m = (IToolModification)map.get(rt); IToolModification m = map.get(rt);
if(m == null){ if(m == null){
ITool realTool = ManagedBuildManager.getRealTool(tool); ITool realTool = ManagedBuildManager.getRealTool(tool);
boolean projFiltered = fFilteredOutTools.keySet().contains(realTool); boolean projFiltered = fFilteredOutTools.keySet().contains(realTool);
@ -637,8 +638,8 @@ public abstract class ToolListModification implements IToolListModification {
if(!added && !removed) if(!added && !removed)
return; return;
Set rmSet = null; Set<IPath> rmSet = null;
Set addSet = null; Set<IPath> addSet = null;
if(removed){ if(removed){
rmSet = getToolApplicabilityPathSet(realRemoved, true); rmSet = getToolApplicabilityPathSet(realRemoved, true);
} }
@ -649,7 +650,7 @@ public abstract class ToolListModification implements IToolListModification {
addSet = rmSet; addSet = rmSet;
} }
List list = new ArrayList(); List<ITool> list = new ArrayList<ITool>();
list.addAll(map.values()); list.addAll(map.values());
clearToolInfo(map.values().toArray(new Tool[map.size()])); clearToolInfo(map.values().toArray(new Tool[map.size()]));
@ -710,8 +711,8 @@ public abstract class ToolListModification implements IToolListModification {
fProjCompInfoMap.clear(); fProjCompInfoMap.clear();
for(int i = 0; i < tools.length; i++){ for(int i = 0; i < tools.length; i++){
ITool tool = tools[i]; ITool tool = tools[i];
ITool realTool = ManagedBuildManager.getRealTool(tool); Tool realTool = (Tool)ManagedBuildManager.getRealTool(tool);
fProjCompInfoMap.put((Tool) realTool, new ProjToolCompatibilityStatusInfo((Tool)tool)); fProjCompInfoMap.put(realTool, new ProjToolCompatibilityStatusInfo((Tool)tool));
if(!fFilteredOutTools.containsKey(realTool)) if(!fFilteredOutTools.containsKey(realTool))
fInputExtsSet.addAll(Arrays.asList(tool.getPrimaryInputExtensions())); fInputExtsSet.addAll(Arrays.asList(tool.getPrimaryInputExtensions()));
} }
@ -738,7 +739,7 @@ public abstract class ToolListModification implements IToolListModification {
return fCompleteObjectStorage; return fCompleteObjectStorage;
} }
protected TreeMap getCompletePathMapStorage(){ protected TreeMap<IPath, PerTypeSetStorage> getCompletePathMapStorage(){
if(fCompletePathMapStorage == null){ if(fCompletePathMapStorage == null){
fCompletePathMapStorage = TcModificationUtil.createPathMap(getCompleteObjectStore()); fCompletePathMapStorage = TcModificationUtil.createPathMap(getCompleteObjectStore());
} }

View file

@ -237,8 +237,8 @@ public class RulesManager {
if(all == null) if(all == null)
all = TcModificationUtil.getExtensionObjects(obj.getType()); all = TcModificationUtil.getExtensionObjects(obj.getType());
Map<IRealBuildObjectAssociation, Set<IRealBuildObjectAssociation>> map = fObjToChildSuperClassMap.getMap(obj.getType(), true); Map<IRealBuildObjectAssociation, Set> map = fObjToChildSuperClassMap.getMap(obj.getType(), true);
Set<IRealBuildObjectAssociation> set = map.get(obj); Set 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);