1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 319512: Missing type arguments on managedbuilder.core

This commit is contained in:
Andrew Gvozdev 2010-07-31 04:36:34 +00:00
parent 563bdc57bc
commit 40b90fc643
3 changed files with 91 additions and 92 deletions

View file

@ -21,11 +21,12 @@ import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.tcmodification.IFileInfoModification;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
public class FileInfoModification extends
ToolListModification implements IFileInfoModification {
private String fFileExt;
private Set fApplPathSet;
private Set<IPath> fApplPathSet;
private IProject fProject;
public FileInfoModification(ResourceConfiguration rcInfo) {
@ -54,9 +55,9 @@ public class FileInfoModification extends
}
@Override
protected Set getToolApplicabilityPathSet(Tool realTool, boolean isProject) {
protected Set<IPath> getToolApplicabilityPathSet(Tool realTool, boolean isProject) {
if(fApplPathSet == null){
Set s = new HashSet(1);
Set<IPath> s = new HashSet<IPath>(1);
s.add(getResourceInfo().getPath());
fApplPathSet = Collections.unmodifiableSet(s);
}
@ -64,8 +65,8 @@ public class FileInfoModification extends
}
@Override
protected Set getExtensionConflictToolSet(Tool tool, Tool[] toos) {
return Collections.EMPTY_SET;
protected Set<Tool> getExtensionConflictToolSet(Tool tool, Tool[] toos) {
return Collections.emptySet();
}
@Override

View file

@ -18,6 +18,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
@ -29,12 +30,14 @@ import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.Builder;
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
import org.eclipse.cdt.managedbuilder.internal.core.ResourceInfo;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificationManager.ConflictMatch;
import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificationManager.ConflictMatchSet;
import org.eclipse.cdt.managedbuilder.tcmodification.CompatibilityStatus;
import org.eclipse.cdt.managedbuilder.tcmodification.IFolderInfoModification;
@ -47,8 +50,8 @@ public class FolderInfoModification extends ToolListModification implements IFol
private ToolChainCompatibilityInfoElement fCurrentCompatibilityInfo;
private ToolChain fSelectedToolChain;
private IToolChain[] fAllSysToolChains;
private Map fCompatibleToolChains;
private Map fInCompatibleToolChains;
private Map<ToolChain, ToolChainCompatibilityInfoElement> fCompatibleToolChains;
private Map<ToolChain, ToolChainCompatibilityInfoElement> fInCompatibleToolChains;
private PerTypeMapStorage fParentObjectStorage;
private ConflictMatchSet fParentConflicts;
// private PerTypeMapStorage fChildObjectStorage;
@ -93,18 +96,18 @@ public class FolderInfoModification extends ToolListModification implements IFol
}
private static class ToolChainApplicabilityPaths {
private Set fFileInfoPaths = new HashSet();
private Set fFolderInfoPaths = new HashSet();
private Map fToolPathMap = new HashMap();
private Set<IPath> fFileInfoPaths = new HashSet<IPath>();
private Set<IPath> fFolderInfoPaths = new HashSet<IPath>();
private Map<Tool, Set<IPath>> fToolPathMap = new HashMap<Tool, Set<IPath>>();
}
public static class ToolChainCompatibilityInfoElement {
private ToolChain fTc;
private List fErrComflictMatchList;
private List fWarningConflictMatchList;
private List<ConflictMatch> fErrComflictMatchList;
// private List fWarningConflictMatchList;
private CompatibilityStatus fStatus;
ToolChainCompatibilityInfoElement(ToolChain tc, List errConflictList){
ToolChainCompatibilityInfoElement(ToolChain tc, List<ConflictMatch> errConflictList){
fTc = tc;
if(errConflictList != null && errConflictList.size() != 0)
fErrComflictMatchList = errConflictList;
@ -135,14 +138,13 @@ public class FolderInfoModification extends ToolListModification implements IFol
initCompatibilityInfo();
FolderInfo foInfo = (FolderInfo)getResourceInfo();
List l = new ArrayList(fCompatibleToolChains.size());
for(Iterator iter = fCompatibleToolChains.keySet().iterator(); iter.hasNext(); ){
ToolChain tc = (ToolChain)iter.next();
List<ToolChain> l = new ArrayList<ToolChain>(fCompatibleToolChains.size());
Set<ToolChain> keySet = fCompatibleToolChains.keySet();
for (ToolChain tc : keySet) {
if(tc != fRealToolChain && foInfo.isToolChainCompatible(fRealToolChain, tc))
l.add(tc);
}
return (ToolChain[])l.toArray(new ToolChain[l.size()]);
return l.toArray(new ToolChain[l.size()]);
}
public CompatibilityStatus getToolChainCompatibilityStatus(){
@ -152,9 +154,9 @@ public class FolderInfoModification extends ToolListModification implements IFol
private ToolChainCompatibilityInfoElement getCurrentCompatibilityInfo(){
if(fCurrentCompatibilityInfo == null){
initCompatibilityInfo();
ToolChainCompatibilityInfoElement info = (ToolChainCompatibilityInfoElement)fCompatibleToolChains.get(fRealToolChain);
ToolChainCompatibilityInfoElement info = fCompatibleToolChains.get(fRealToolChain);
if(info == null)
info = (ToolChainCompatibilityInfoElement)fInCompatibleToolChains.get(fRealToolChain);
info = fInCompatibleToolChains.get(fRealToolChain);
fCurrentCompatibilityInfo = info;
}
return fCurrentCompatibilityInfo;
@ -168,15 +170,14 @@ public class FolderInfoModification extends ToolListModification implements IFol
if(fCompatibilityInfoInited)
return;
fCompatibleToolChains = new HashMap();
fInCompatibleToolChains = new HashMap();
fCompatibleToolChains = new HashMap<ToolChain, ToolChainCompatibilityInfoElement>();
fInCompatibleToolChains = new HashMap<ToolChain, ToolChainCompatibilityInfoElement>();
ConflictMatchSet parentConflicts = getParentConflictMatchSet();
ToolChain sysTCs[] = (ToolChain[])getAllSysToolChains();
Map conflictMap = parentConflicts.fObjToConflictListMap;
for(int i = 0; i < sysTCs.length; i++){
ToolChain tc = sysTCs[i];
List l = (List)conflictMap.get(tc);
Map<Builder, List<ConflictMatch>> conflictMap = parentConflicts.fObjToConflictListMap;
for (ToolChain tc : sysTCs) {
List<ConflictMatch> l = conflictMap.get(tc);
ToolChainCompatibilityInfoElement info = new ToolChainCompatibilityInfoElement(tc, l);
if(info.isCompatible()){
fCompatibleToolChains.put(tc, info);
@ -243,14 +244,14 @@ public class FolderInfoModification extends ToolListModification implements IFol
@Override
protected boolean canReplace(Tool fromTool, Tool toTool) {
String[] exts = toTool.getPrimaryInputExtensions();
Set curInputExts = null;
Set inputExts = getInputExtsSet();
for(int k = 0; k < exts.length; k++){
if(inputExts.contains(exts[k])){
Set<String> curInputExts = null;
Set<String> inputExts = getInputExtsSet();
for (String ext : exts) {
if(inputExts.contains(ext)){
if(curInputExts == null)
curInputExts = new HashSet(Arrays.asList(fromTool.getPrimaryInputExtensions()));
curInputExts = new HashSet<String>(Arrays.asList(fromTool.getPrimaryInputExtensions()));
if(curInputExts.contains(exts[k])){
if(curInputExts.contains(ext)){
return true;
}
}
@ -259,17 +260,17 @@ public class FolderInfoModification extends ToolListModification implements IFol
}
@Override
protected Set getExtensionConflictToolSet(Tool tool, Tool[] tools) {
protected Set<Tool> getExtensionConflictToolSet(Tool tool, Tool[] tools) {
String exts[] = tool.getPrimaryInputExtensions();
Set extsSet = new HashSet(Arrays.asList(exts));
Set conflictsSet = null;
Set<String> extsSet = new HashSet<String>(Arrays.asList(exts));
Set<Tool> conflictsSet = null;
for(int i = 0; i < tools.length; i++){
Tool t = tools[i];
if(t == tool)
continue;
if(TcModificationUtil.containCommonEntries(extsSet, t.getPrimaryInputExtensions())){
if(conflictsSet == null)
conflictsSet = new HashSet();
conflictsSet = new HashSet<Tool>();
conflictsSet.add(t);
}
@ -277,14 +278,14 @@ public class FolderInfoModification extends ToolListModification implements IFol
}
if(conflictsSet == null)
conflictsSet = Collections.EMPTY_SET;
conflictsSet = Collections.emptySet();
return conflictsSet;
}
@Override
protected Set getToolApplicabilityPathSet(Tool realTool, boolean isProject) {
protected Set<IPath> getToolApplicabilityPathSet(Tool realTool, boolean isProject) {
if(isProject)
return (Set)getToolChainApplicabilityPaths().fToolPathMap.get(realTool);
return getToolChainApplicabilityPaths().fToolPathMap.get(realTool);
return getToolChainApplicabilityPaths().fFolderInfoPaths;
}
@ -306,24 +307,24 @@ public class FolderInfoModification extends ToolListModification implements IFol
ToolChainApplicabilityPaths tcApplicabilityPaths = new ToolChainApplicabilityPaths();
IPath path = getResourceInfo().getPath();
TreeMap pathMap = getCompletePathMapStorage();
TreeMap<IPath, PerTypeSetStorage> pathMap = getCompletePathMapStorage();
PerTypeSetStorage oSet = (PerTypeSetStorage)pathMap.get(path);
Set toolSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false);
Set tcSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
PerTypeSetStorage oSet = pathMap.get(path);
Set<Tool> toolSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false);
Set<IPath> tcSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
ToolChain curTc = (ToolChain)tcSet.iterator().next();
Set foInfoPaths = tcApplicabilityPaths.fFolderInfoPaths;
Set fileInfoPaths = tcApplicabilityPaths.fFileInfoPaths;
Set<IPath> foInfoPaths = tcApplicabilityPaths.fFolderInfoPaths;
Set<IPath> fileInfoPaths = tcApplicabilityPaths.fFileInfoPaths;
foInfoPaths.add(path);
Map toolPathsMap = tcApplicabilityPaths.fToolPathMap;
Map<Tool, Set<IPath>> toolPathsMap = tcApplicabilityPaths.fToolPathMap;
if(toolSet != null){
for(Iterator iter = toolSet.iterator(); iter.hasNext(); ){
Set set = new HashSet();
toolPathsMap.put(iter.next(), set);
for (Tool tool : toolSet) {
Set<IPath> set = new HashSet<IPath>();
toolPathsMap.put(tool, set);
set.add(path);
}
}
@ -339,11 +340,10 @@ public class FolderInfoModification extends ToolListModification implements IFol
fTcApplicabilityPaths = null;
}
private static void putToolInfo(Set ct, Map toolPathsMap, Set fileInfoPaths, Object p){
private static void putToolInfo(Set<Tool> ct, Map<Tool, Set<IPath>> toolPathsMap, Set<IPath> fileInfoPaths, IPath p){
if(ct != null && ct.size() != 0){
for(Iterator toolIter = ct.iterator(); toolIter.hasNext(); ){
Object t = toolIter.next();
Set set = (Set)toolPathsMap.get(t);
for (Tool t : ct) {
Set<IPath> set = toolPathsMap.get(t);
if(set != null){
if(fileInfoPaths != null)
fileInfoPaths.add(p);
@ -353,14 +353,14 @@ public class FolderInfoModification extends ToolListModification implements IFol
}
}
private static void calculateChildPaths(TreeMap pathMap, IPath path, ToolChain tc, Set tcPaths, Map toolPathsMap, Set fileInfoPaths){
SortedMap directCMap = PathComparator.getDirectChildPathMap(pathMap, path);
for(Iterator iter = directCMap.entrySet().iterator(); iter.hasNext(); ){
Map.Entry entry = (Map.Entry)iter.next();
PerTypeSetStorage cst = (PerTypeSetStorage)entry.getValue();
private static void calculateChildPaths(TreeMap<IPath, PerTypeSetStorage> pathMap, IPath path, ToolChain tc, Set<IPath> tcPaths, Map<Tool,Set<IPath>> toolPathsMap, Set<IPath> fileInfoPaths){
SortedMap<IPath, PerTypeSetStorage> directCMap = PathComparator.getDirectChildPathMap(pathMap, path);
Set<Entry<IPath, PerTypeSetStorage>> entrySet = directCMap.entrySet();
for (Entry<IPath, PerTypeSetStorage> entry : entrySet) {
PerTypeSetStorage cst = entry.getValue();
Set ctc = cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
Set ct = cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false);
Set<ToolChain> ctc = cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
Set<Tool> ct = cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false);
if(ctc == null || ctc.size() == 0){
@ -368,7 +368,7 @@ public class FolderInfoModification extends ToolListModification implements IFol
putToolInfo(ct, toolPathsMap, fileInfoPaths, entry.getKey());
} else {
if(ctc.contains(tc)){
IPath cp = (IPath)entry.getKey();
IPath cp = entry.getKey();
tcPaths.add(cp);
putToolInfo(ct, toolPathsMap, null, entry.getKey());
//recurse
@ -384,8 +384,8 @@ public class FolderInfoModification extends ToolListModification implements IFol
ToolChainApplicabilityPaths tcApplicability = getToolChainApplicabilityPaths();
PerTypeMapStorage storage = getCompleteObjectStore();
Map tcMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
Map toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false);
Map<ToolChain, Set<IPath>> tcMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
Map<Tool, Set<IPath>> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false);
TcModificationUtil.removePaths(tcMap, fRealToolChain, tcApplicability.fFolderInfoPaths);
@ -396,10 +396,11 @@ public class FolderInfoModification extends ToolListModification implements IFol
newTools[i] = (Tool)ManagedBuildManager.getRealTool(newTools[i]);
}
for(Iterator iter = tcApplicability.fToolPathMap.entrySet().iterator(); iter.hasNext(); ){
Map.Entry entry = (Map.Entry)iter.next();
Tool tool = (Tool)entry.getKey();
Set pathSet = (Set)entry.getValue();
Set<Entry<Tool, Set<IPath>>> entrySet = tcApplicability.fToolPathMap.entrySet();
for(Iterator<Entry<Tool, Set<IPath>>> iter = entrySet.iterator(); iter.hasNext(); ){
Map.Entry<Tool, Set<IPath>> entry = iter.next();
Tool tool = entry.getKey();
Set<IPath> pathSet = entry.getValue();
TcModificationUtil.removePaths(toolMap, tool, pathSet);
}
@ -414,8 +415,7 @@ public class FolderInfoModification extends ToolListModification implements IFol
IProject project = mProj.getOwner().getProject();
Tool[] filtered = (Tool[])foInfo.filterTools(newTools, mProj);
if(filtered.length != 0){
for(Iterator iter = tcApplicability.fFileInfoPaths.iterator(); iter.hasNext(); ){
IPath p = (IPath)iter.next();
for (IPath p : tcApplicability.fFileInfoPaths) {
boolean found = false;
String ext = p.getFileExtension();
if(ext == null)

View file

@ -20,7 +20,7 @@ import java.util.TreeSet;
import org.eclipse.core.runtime.IPath;
public class PathComparator implements Comparator {
public class PathComparator implements Comparator<IPath> {
public static PathComparator INSTANCE = new PathComparator();
// public static final SortedSet EMPTY_SET = Collections.unmodifiableSortedSet(new TreeSet(INSTANCE));
// public static final SortedMap EMPTY_MAP = Collections.unmodifiableSortedMap(new TreeMap(INSTANCE));
@ -28,12 +28,12 @@ public class PathComparator implements Comparator {
private PathComparator(){
}
public int compare(Object arg0, Object arg1) {
public int compare(IPath arg0, IPath arg1) {
if(arg0 == arg1)
return 0;
IPath path1 = (IPath)arg0;
IPath path2 = (IPath)arg1;
IPath path1 = arg0;
IPath path2 = arg1;
int length1 = path1.segmentCount();
int length2 = path2.segmentCount();
@ -69,45 +69,43 @@ public class PathComparator implements Comparator {
return path.append("\0"); //$NON-NLS-1$
}
public static SortedMap getChildPathMap(SortedMap map, IPath path, boolean includeThis, boolean copy){
public static SortedMap<IPath, PerTypeSetStorage> getChildPathMap(SortedMap<IPath, PerTypeSetStorage> map, IPath path, boolean includeThis, boolean copy){
IPath start = includeThis ? path : getFirstChild(path);
IPath next = getNext(path);
SortedMap result = next != null ? map.subMap(start, next) : map.tailMap(start);
SortedMap<IPath, PerTypeSetStorage> result = next != null ? map.subMap(start, next) : map.tailMap(start);
if(copy)
result = new TreeMap(result);
result = new TreeMap<IPath, PerTypeSetStorage>(result);
return result;
}
public static SortedSet getChildPathSet(SortedSet set, IPath path, boolean includeThis, boolean copy){
public static SortedSet<IPath> getChildPathSet(SortedSet<IPath> set, IPath path, boolean includeThis, boolean copy){
IPath start = includeThis ? path : getFirstChild(path);
IPath next = getNext(path);
SortedSet result = next != null ? set.subSet(start, next) : set.tailSet(start);
SortedSet<IPath> result = next != null ? set.subSet(start, next) : set.tailSet(start);
if(copy)
result = new TreeSet(result);
result = new TreeSet<IPath>(result);
return result;
}
public static SortedSet getDirectChildPathSet(SortedSet set, IPath path){
public static SortedSet<IPath> getDirectChildPathSet(SortedSet<IPath> set, IPath path){
//all children
SortedSet children = getChildPathSet(set, path, false, false);
SortedSet result = new TreeSet(INSTANCE);
for(Iterator iter = children.iterator(); iter.hasNext(); iter = children.iterator()){
IPath childPath = (IPath)iter.next();
SortedSet<IPath> children = getChildPathSet(set, path, false, false);
SortedSet<IPath> result = new TreeSet<IPath>(INSTANCE);
for (IPath childPath : children) {
result.add(childPath);
children = children.tailSet(getNext(childPath));//getChildPathSet(children, getNext(childPath), true, false);
children = children.tailSet(getNext(childPath));
}
return result;
}
public static SortedMap getDirectChildPathMap(SortedMap map, IPath path){
public static SortedMap<IPath,PerTypeSetStorage> getDirectChildPathMap(SortedMap<IPath, PerTypeSetStorage> map, IPath path){
//all children
SortedMap children = getChildPathMap(map, path, false, false);
SortedMap result = new TreeMap(INSTANCE);
for(Iterator iter = children.entrySet().iterator(); iter.hasNext(); iter = children.entrySet().iterator()){
Map.Entry entry = (Map.Entry)iter.next();
IPath childPath = (IPath)entry.getKey();
SortedMap<IPath,PerTypeSetStorage> children = getChildPathMap(map, path, false, false);
SortedMap<IPath,PerTypeSetStorage> result = new TreeMap<IPath, PerTypeSetStorage>(INSTANCE);
for(Iterator<Map.Entry<IPath,PerTypeSetStorage>> iter = children.entrySet().iterator(); iter.hasNext(); iter = children.entrySet().iterator()){
Map.Entry<IPath,PerTypeSetStorage> entry = iter.next();
IPath childPath = entry.getKey();
result.put(childPath, entry.getValue());
children = children.tailMap(getNext(childPath));//getChildPathMap(children, getNext(childPath), true, false);