1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

bug 319512: Missing type arguments on managedbuilder.core

This commit is contained in:
Andrew Gvozdev 2010-10-01 20:18:23 +00:00
parent 6f4c249382
commit a56ce44af6
2 changed files with 22 additions and 23 deletions

View file

@ -31,8 +31,8 @@ import org.eclipse.core.runtime.CoreException;
public class MakeScannerInfo implements IScannerInfo { public class MakeScannerInfo implements IScannerInfo {
private IProject project; private IProject project;
private ArrayList symbolList; private ArrayList<String> symbolList;
private ArrayList pathList; private ArrayList<String> pathList;
boolean hasChanged = false; boolean hasChanged = false;
public MakeScannerInfo(IProject project) { public MakeScannerInfo(IProject project) {
@ -73,7 +73,7 @@ public class MakeScannerInfo implements IScannerInfo {
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths() * @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
*/ */
public synchronized String[] getIncludePaths() { public synchronized String[] getIncludePaths() {
return (String[]) getPathList().toArray(new String[getPathList().size()]); return getPathList().toArray(new String[getPathList().size()]);
} }
/* /*
@ -81,9 +81,9 @@ public class MakeScannerInfo implements IScannerInfo {
* *
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths() * @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
*/ */
public synchronized Map getDefinedSymbols() { public synchronized Map<String, String> getDefinedSymbols() {
// Return the defined symbols for the default configuration // Return the defined symbols for the default configuration
HashMap symbols = new HashMap(); HashMap<String, String> symbols = new HashMap<String, String>();
String[] symbolList = getPreprocessorSymbols(); String[] symbolList = getPreprocessorSymbols();
for (int i = 0; i < symbolList.length; ++i) { for (int i = 0; i < symbolList.length; ++i) {
String symbol = symbolList[i]; String symbol = symbolList[i];
@ -104,20 +104,20 @@ public class MakeScannerInfo implements IScannerInfo {
return symbols; return symbols;
} }
protected List getPathList() { protected List<String> getPathList() {
if (pathList == null) { if (pathList == null) {
pathList = new ArrayList(); pathList = new ArrayList<String>();
} }
return pathList; return pathList;
} }
public synchronized String[] getPreprocessorSymbols() { public synchronized String[] getPreprocessorSymbols() {
return (String[]) getSymbolList().toArray(new String[getSymbolList().size()]); return getSymbolList().toArray(new String[getSymbolList().size()]);
} }
protected List getSymbolList() { protected List<String> getSymbolList() {
if (symbolList == null) { if (symbolList == null) {
symbolList = new ArrayList(); symbolList = new ArrayList<String>();
} }
return symbolList; return symbolList;
} }

View file

@ -119,8 +119,8 @@ public class MakeScannerProvider extends ScannerProvider {
private MakeScannerInfo loadScannerInfo(IProject project) throws CoreException { private MakeScannerInfo loadScannerInfo(IProject project) throws CoreException {
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project); ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
ICStorageElement root = descriptor.getProjectStorageElement(CDESCRIPTOR_ID); ICStorageElement root = descriptor.getProjectStorageElement(CDESCRIPTOR_ID);
ArrayList includes = new ArrayList(); ArrayList<String> includes = new ArrayList<String>();
ArrayList symbols = new ArrayList(); ArrayList<String> symbols = new ArrayList<String>();
for (ICStorageElement child : root.getChildren()) { for (ICStorageElement child : root.getChildren()) {
if (child.getName().equals(INCLUDE_PATH)) { if (child.getName().equals(INCLUDE_PATH)) {
// Add the path to the property list // Add the path to the property list
@ -131,21 +131,21 @@ public class MakeScannerProvider extends ScannerProvider {
} }
} }
MakeScannerInfo info = new MakeScannerInfo(project); MakeScannerInfo info = new MakeScannerInfo(project);
info.setIncludePaths((String[])includes.toArray(new String[includes.size()])); info.setIncludePaths(includes.toArray(new String[includes.size()]));
info.setPreprocessorSymbols((String[])symbols.toArray(new String[symbols.size()])); info.setPreprocessorSymbols(symbols.toArray(new String[symbols.size()]));
return info; return info;
} }
static void migrateToCPathEntries(MakeScannerInfo info) throws CoreException { static void migrateToCPathEntries(MakeScannerInfo info) throws CoreException {
Map symbols = info.getDefinedSymbols(); Map<String, String> symbols = info.getDefinedSymbols();
String[] includes = info.getIncludePaths(); String[] includes = info.getIncludePaths();
ICProject cProject = CoreModel.getDefault().create(info.getProject()); ICProject cProject = CoreModel.getDefault().create(info.getProject());
IPathEntry[] entries = cProject.getRawPathEntries(); IPathEntry[] entries = cProject.getRawPathEntries();
List cPaths = new ArrayList(Arrays.asList(entries)); List<IPathEntry> cPaths = new ArrayList<IPathEntry>(Arrays.asList(entries));
Iterator cpIter = cPaths.iterator(); Iterator<IPathEntry> cpIter = cPaths.iterator();
while(cpIter.hasNext()) { while(cpIter.hasNext()) {
int kind = ((IPathEntry)cpIter.next()).getEntryKind(); int kind = cpIter.next().getEntryKind();
if(kind == IPathEntry.CDT_INCLUDE || kind == IPathEntry.CDT_MACRO) { if(kind == IPathEntry.CDT_INCLUDE || kind == IPathEntry.CDT_MACRO) {
cpIter.remove(); cpIter.remove();
} }
@ -156,16 +156,15 @@ public class MakeScannerProvider extends ScannerProvider {
cPaths.add(include); cPaths.add(include);
} }
} }
Iterator syms = symbols.entrySet().iterator(); Iterator<Entry<String, String>> syms = symbols.entrySet().iterator();
while (syms.hasNext()) { while (syms.hasNext()) {
Map.Entry entry = (Entry)syms.next(); Entry<String, String> entry = syms.next();
IMacroEntry sym = CoreModel.newMacroEntry(info.getProject().getFullPath(), (String)entry.getKey(), IMacroEntry sym = CoreModel.newMacroEntry(info.getProject().getFullPath(), entry.getKey(), entry.getValue());
(String)entry.getValue());
if (!cPaths.contains(sym)) { if (!cPaths.contains(sym)) {
cPaths.add(sym); cPaths.add(sym);
} }
} }
cProject.setRawPathEntries((IPathEntry[])cPaths.toArray(new IPathEntry[cPaths.size()]), null); cProject.setRawPathEntries(cPaths.toArray(new IPathEntry[cPaths.size()]), null);
} }
/** /**