mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
compilation warnings
This commit is contained in:
parent
d05a0837ed
commit
cd60bbb283
5 changed files with 153 additions and 157 deletions
|
@ -11,13 +11,14 @@
|
|||
package org.eclipse.cdt.make.core.scannerconfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
@ -29,16 +30,17 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @noextend This class is not intended to be subclassed by clients.
|
||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
*/
|
||||
@Deprecated
|
||||
public class DiscoveredScannerInfo implements IScannerInfo {
|
||||
private IProject project;
|
||||
private LinkedHashMap discoveredPaths;
|
||||
private LinkedHashMap discoveredSymbols;
|
||||
private LinkedHashMap<String, Boolean> discoveredPaths;
|
||||
private LinkedHashMap<String, SymbolEntry> discoveredSymbols;
|
||||
|
||||
private ArrayList activePaths;
|
||||
private ArrayList removedPaths;
|
||||
private ArrayList<String> activePaths;
|
||||
private ArrayList<String> removedPaths;
|
||||
|
||||
private ArrayList activeSymbols;
|
||||
private ArrayList removedSymbols;
|
||||
private ArrayList<String> activeSymbols;
|
||||
private ArrayList<String> removedSymbols;
|
||||
|
||||
private org.eclipse.cdt.make.core.MakeScannerInfo userInfo;
|
||||
|
||||
|
@ -56,8 +58,8 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.IScannerInfo#getDefinedSymbols()
|
||||
*/
|
||||
public synchronized Map getDefinedSymbols() {
|
||||
Map dSymbols = ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols);
|
||||
public synchronized Map<String, String> getDefinedSymbols() {
|
||||
Map<String, String> dSymbols = ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols);
|
||||
dSymbols.putAll(userInfo.getDefinedSymbols());
|
||||
return dSymbols;
|
||||
}
|
||||
|
@ -79,14 +81,14 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
userInfo = info;
|
||||
}
|
||||
|
||||
public LinkedHashMap getDiscoveredIncludePaths() {
|
||||
public LinkedHashMap<String, Boolean> getDiscoveredIncludePaths() {
|
||||
if (discoveredPaths == null) {
|
||||
return new LinkedHashMap();
|
||||
return new LinkedHashMap<String, Boolean>();
|
||||
}
|
||||
return new LinkedHashMap(discoveredPaths);
|
||||
return new LinkedHashMap<String, Boolean>(discoveredPaths);
|
||||
}
|
||||
public synchronized void setDiscoveredIncludePaths(LinkedHashMap paths) {
|
||||
discoveredPaths = new LinkedHashMap(paths);
|
||||
public synchronized void setDiscoveredIncludePaths(LinkedHashMap<String, Boolean> paths) {
|
||||
discoveredPaths = new LinkedHashMap<String, Boolean>(paths);
|
||||
createPathLists();
|
||||
}
|
||||
|
||||
|
@ -94,14 +96,14 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
* Populates active and removed include path lists
|
||||
*/
|
||||
private void createPathLists() {
|
||||
List aPaths = getActivePathList();
|
||||
List<String> aPaths = getActivePathList();
|
||||
aPaths.clear();
|
||||
List rPaths = getRemovedPathList();
|
||||
List<String> rPaths = getRemovedPathList();
|
||||
rPaths.clear();
|
||||
|
||||
for (Iterator i = discoveredPaths.keySet().iterator(); i.hasNext(); ) {
|
||||
String path = (String) i.next();
|
||||
Boolean removed = (Boolean) discoveredPaths.get(path);
|
||||
Set<String> paths = discoveredPaths.keySet();
|
||||
for (String path : paths) {
|
||||
Boolean removed = discoveredPaths.get(path);
|
||||
if (removed == null || removed.booleanValue() == false) {
|
||||
aPaths.add(path);
|
||||
}
|
||||
|
@ -111,14 +113,14 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
}
|
||||
}
|
||||
|
||||
public LinkedHashMap getDiscoveredSymbolDefinitions() {
|
||||
public LinkedHashMap<String, SymbolEntry> getDiscoveredSymbolDefinitions() {
|
||||
if (discoveredSymbols == null) {
|
||||
return new LinkedHashMap();
|
||||
return new LinkedHashMap<String, SymbolEntry>();
|
||||
}
|
||||
return new LinkedHashMap(discoveredSymbols);
|
||||
return new LinkedHashMap<String, SymbolEntry>(discoveredSymbols);
|
||||
}
|
||||
public synchronized void setDiscoveredSymbolDefinitions(LinkedHashMap symbols) {
|
||||
discoveredSymbols = new LinkedHashMap(symbols);
|
||||
public synchronized void setDiscoveredSymbolDefinitions(LinkedHashMap<String, SymbolEntry> symbols) {
|
||||
discoveredSymbols = new LinkedHashMap<String, SymbolEntry>(symbols);
|
||||
createSymbolsLists();
|
||||
}
|
||||
|
||||
|
@ -126,9 +128,9 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
* Populates active and removed defined symbols sets
|
||||
*/
|
||||
private void createSymbolsLists() {
|
||||
List aSymbols = getActiveSymbolsList();
|
||||
List<String> aSymbols = getActiveSymbolsList();
|
||||
aSymbols.clear();
|
||||
List rSymbols = getRemovedSymbolsList();
|
||||
List<String> rSymbols = getRemovedSymbolsList();
|
||||
rSymbols.clear();
|
||||
|
||||
aSymbols.addAll(ScannerConfigUtil.scSymbolsSymbolEntryMap2List(discoveredSymbols, true));
|
||||
|
@ -142,10 +144,10 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
return userInfo.getIncludePaths();
|
||||
}
|
||||
public String[] getActiveIncludePaths() {
|
||||
return (String[]) getActivePathList().toArray(new String[getActivePathList().size()]);
|
||||
return getActivePathList().toArray(new String[getActivePathList().size()]);
|
||||
}
|
||||
public String[] getRemovedIncludePaths() {
|
||||
return (String[])getRemovedPathList().toArray(new String[getRemovedPathList().size()]);
|
||||
return getRemovedPathList().toArray(new String[getRemovedPathList().size()]);
|
||||
}
|
||||
|
||||
public String[] getUserSymbolDefinitions() {
|
||||
|
@ -155,10 +157,10 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
return userInfo.getPreprocessorSymbols();
|
||||
}
|
||||
public String[] getActiveSymbolDefinitions() {
|
||||
return (String[]) getActiveSymbolsList().toArray(new String[getActiveSymbolsList().size()]);
|
||||
return getActiveSymbolsList().toArray(new String[getActiveSymbolsList().size()]);
|
||||
}
|
||||
public String[] getRemovedSymbolDefinitions() {
|
||||
return (String[]) getRemovedSymbolsList().toArray(new String[getRemovedSymbolsList().size()]);
|
||||
return getRemovedSymbolsList().toArray(new String[getRemovedSymbolsList().size()]);
|
||||
}
|
||||
public String[] getPreprocessorSymbols() {
|
||||
// user specified + active
|
||||
|
@ -170,30 +172,30 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
return rv;
|
||||
}
|
||||
|
||||
private List getActivePathList() {
|
||||
private List<String> getActivePathList() {
|
||||
if (activePaths == null) {
|
||||
activePaths = new ArrayList();
|
||||
activePaths = new ArrayList<String>();
|
||||
}
|
||||
return activePaths;
|
||||
}
|
||||
|
||||
private List getRemovedPathList() {
|
||||
private List<String> getRemovedPathList() {
|
||||
if (removedPaths == null) {
|
||||
removedPaths = new ArrayList();
|
||||
removedPaths = new ArrayList<String>();
|
||||
}
|
||||
return removedPaths;
|
||||
}
|
||||
|
||||
private List getActiveSymbolsList() {
|
||||
private List<String> getActiveSymbolsList() {
|
||||
if (activeSymbols == null) {
|
||||
activeSymbols = new ArrayList();
|
||||
activeSymbols = new ArrayList<String>();
|
||||
}
|
||||
return activeSymbols;
|
||||
}
|
||||
|
||||
private List getRemovedSymbolsList() {
|
||||
private List<String> getRemovedSymbolsList() {
|
||||
if (removedSymbols == null) {
|
||||
removedSymbols = new ArrayList();
|
||||
removedSymbols = new ArrayList<String>();
|
||||
}
|
||||
return removedSymbols;
|
||||
}
|
||||
|
@ -205,15 +207,15 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
/**
|
||||
* @param userPaths
|
||||
*/
|
||||
public void setUserIncludePaths(List userPaths) {
|
||||
userInfo.setIncludePaths((String[]) userPaths.toArray(new String[userPaths.size()]));
|
||||
public void setUserIncludePaths(List<String> userPaths) {
|
||||
userInfo.setIncludePaths(userPaths.toArray(new String[userPaths.size()]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userSymbols
|
||||
*/
|
||||
public void setUserDefinedSymbols(List userSymbols) {
|
||||
userInfo.setPreprocessorSymbols((String[]) userSymbols.toArray(new String[userSymbols.size()]));
|
||||
public void setUserDefinedSymbols(List<String> userSymbols) {
|
||||
userInfo.setPreprocessorSymbols(userSymbols.toArray(new String[userSymbols.size()]));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -43,11 +44,11 @@ public interface IDiscoveredPathManager {
|
|||
}
|
||||
|
||||
interface IPerProjectDiscoveredPathInfo extends IDiscoveredPathInfo {
|
||||
void setIncludeMap(LinkedHashMap map);
|
||||
void setSymbolMap(LinkedHashMap map);
|
||||
void setIncludeMap(LinkedHashMap<String, Boolean> map);
|
||||
void setSymbolMap(LinkedHashMap<String, SymbolEntry> map);
|
||||
|
||||
LinkedHashMap getIncludeMap();
|
||||
LinkedHashMap getSymbolMap();
|
||||
LinkedHashMap<String, Boolean> getIncludeMap();
|
||||
LinkedHashMap<String, SymbolEntry> getSymbolMap();
|
||||
}
|
||||
|
||||
interface IPerFileDiscoveredPathInfo extends IDiscoveredPathInfo {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2007 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2010 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -12,10 +12,10 @@ package org.eclipse.cdt.make.internal.core.scannerconfig;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
|
||||
|
@ -37,27 +37,27 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
public static final String REMOVED = "removed"; //$NON-NLS-1$
|
||||
|
||||
final private IProject project;
|
||||
private LinkedHashMap discoveredPaths;
|
||||
private LinkedHashMap discoveredSymbols;
|
||||
private LinkedHashMap<String, Boolean> discoveredPaths;
|
||||
private LinkedHashMap<String, SymbolEntry> discoveredSymbols;
|
||||
|
||||
private List activePaths;
|
||||
private Map activeSymbols;
|
||||
private List<Path> activePaths;
|
||||
private Map<String, String> activeSymbols;
|
||||
|
||||
public DiscoveredPathInfo(IProject project) {
|
||||
this.project = project;
|
||||
discoveredPaths = new LinkedHashMap();
|
||||
discoveredSymbols = new LinkedHashMap();
|
||||
discoveredPaths = new LinkedHashMap<String, Boolean>();
|
||||
discoveredSymbols = new LinkedHashMap<String, SymbolEntry>();
|
||||
}
|
||||
|
||||
public IProject getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public synchronized Map getSymbols() {
|
||||
public synchronized Map<String, String> getSymbols() {
|
||||
if (activeSymbols == null) {
|
||||
createSymbolsMap();
|
||||
}
|
||||
Map dSymbols = ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols);
|
||||
Map<String, String> dSymbols = ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols);
|
||||
return dSymbols;
|
||||
}
|
||||
|
||||
|
@ -65,15 +65,15 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
if ( activePaths == null) {
|
||||
createPathLists();
|
||||
}
|
||||
return (IPath[])activePaths.toArray(new IPath[activePaths.size()]);
|
||||
return activePaths.toArray(new IPath[activePaths.size()]);
|
||||
}
|
||||
|
||||
public LinkedHashMap getIncludeMap() {
|
||||
return new LinkedHashMap(discoveredPaths);
|
||||
public LinkedHashMap<String, Boolean> getIncludeMap() {
|
||||
return new LinkedHashMap<String, Boolean>(discoveredPaths);
|
||||
}
|
||||
|
||||
public synchronized void setIncludeMap(LinkedHashMap paths) {
|
||||
discoveredPaths = new LinkedHashMap(paths);
|
||||
public synchronized void setIncludeMap(LinkedHashMap<String, Boolean> paths) {
|
||||
discoveredPaths = new LinkedHashMap<String, Boolean>(paths);
|
||||
activePaths = null;
|
||||
}
|
||||
|
||||
|
@ -81,24 +81,24 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
* Populates active and removed include path lists
|
||||
*/
|
||||
private void createPathLists() {
|
||||
List aPaths = getActivePathList();
|
||||
List<Path> aPaths = getActivePathList();
|
||||
aPaths.clear();
|
||||
|
||||
for (Iterator i = discoveredPaths.keySet().iterator(); i.hasNext(); ) {
|
||||
String path = (String) i.next();
|
||||
Boolean removed = (Boolean) discoveredPaths.get(path);
|
||||
Set<String> paths = discoveredPaths.keySet();
|
||||
for (String path : paths) {
|
||||
Boolean removed = discoveredPaths.get(path);
|
||||
if (removed == null || removed.booleanValue() == false) {
|
||||
aPaths.add(new Path(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LinkedHashMap getSymbolMap() {
|
||||
return new LinkedHashMap(discoveredSymbols);
|
||||
public LinkedHashMap<String, SymbolEntry> getSymbolMap() {
|
||||
return new LinkedHashMap<String, SymbolEntry>(discoveredSymbols);
|
||||
}
|
||||
|
||||
public synchronized void setSymbolMap(LinkedHashMap symbols) {
|
||||
discoveredSymbols = new LinkedHashMap(symbols);
|
||||
public synchronized void setSymbolMap(LinkedHashMap<String, SymbolEntry> symbols) {
|
||||
discoveredSymbols = new LinkedHashMap<String, SymbolEntry>(symbols);
|
||||
activeSymbols = null;
|
||||
}
|
||||
|
||||
|
@ -106,22 +106,22 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
* Populates active symbols sets
|
||||
*/
|
||||
private void createSymbolsMap() {
|
||||
Map aSymbols = getActiveSymbolsMap();
|
||||
Map<String, String> aSymbols = getActiveSymbolsMap();
|
||||
aSymbols.clear();
|
||||
|
||||
aSymbols.putAll(ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols));
|
||||
}
|
||||
|
||||
private List getActivePathList() {
|
||||
private List<Path> getActivePathList() {
|
||||
if (activePaths == null) {
|
||||
activePaths = new ArrayList();
|
||||
activePaths = new ArrayList<Path>();
|
||||
}
|
||||
return activePaths;
|
||||
}
|
||||
|
||||
private Map getActiveSymbolsMap() {
|
||||
private Map<String, String> getActiveSymbolsMap() {
|
||||
if (activeSymbols == null) {
|
||||
activeSymbols = new HashMap();
|
||||
activeSymbols = new HashMap<String, String>();
|
||||
}
|
||||
return activeSymbols;
|
||||
}
|
||||
|
@ -132,32 +132,30 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
public void serialize(Element collectorElem) {
|
||||
Document doc = collectorElem.getOwnerDocument();
|
||||
|
||||
Map includes = getIncludeMap();
|
||||
Iterator iter = includes.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map<String, Boolean> includes = getIncludeMap();
|
||||
Set<String> includesSet = includes.keySet();
|
||||
for (String include : includesSet) {
|
||||
Element pathElement = doc.createElement(INCLUDE_PATH);
|
||||
String include = (String)iter.next();
|
||||
pathElement.setAttribute(PATH, include);
|
||||
Boolean removed = (Boolean)includes.get(include);
|
||||
Boolean removed = includes.get(include);
|
||||
if (removed != null && removed.booleanValue() == true) {
|
||||
pathElement.setAttribute(REMOVED, "true"); //$NON-NLS-1$
|
||||
}
|
||||
collectorElem.appendChild(pathElement);
|
||||
}
|
||||
// Now do the same for the symbols
|
||||
Map symbols = getSymbolMap();
|
||||
iter = symbols.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String symbol = (String)iter.next();
|
||||
SymbolEntry se = (SymbolEntry)symbols.get(symbol);
|
||||
for (Iterator i = se.getActiveRaw().iterator(); i.hasNext();) {
|
||||
String value = (String)i.next();
|
||||
Map<String, SymbolEntry> symbols = getSymbolMap();
|
||||
Set<String> symbolsSet = includes.keySet();
|
||||
for (String symbol : symbolsSet) {
|
||||
SymbolEntry se = symbols.get(symbol);
|
||||
List<String> activeValues = se.getActiveRaw();
|
||||
for (String value : activeValues) {
|
||||
Element symbolElement = doc.createElement(DEFINED_SYMBOL);
|
||||
symbolElement.setAttribute(SYMBOL, value);
|
||||
collectorElem.appendChild(symbolElement);
|
||||
}
|
||||
for (Iterator i = se.getRemovedRaw().iterator(); i.hasNext();) {
|
||||
String value = (String)i.next();
|
||||
List<String> removedValues = se.getRemovedRaw();
|
||||
for (String value : removedValues) {
|
||||
Element symbolElement = doc.createElement(DEFINED_SYMBOL);
|
||||
symbolElement.setAttribute(SYMBOL, value);
|
||||
symbolElement.setAttribute(REMOVED, "true"); //$NON-NLS-1$
|
||||
|
@ -170,8 +168,8 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#deserialize(org.w3c.dom.Element)
|
||||
*/
|
||||
public void deserialize(Element collectorElem) {
|
||||
LinkedHashMap includes = getIncludeMap();
|
||||
LinkedHashMap symbols = getSymbolMap();
|
||||
LinkedHashMap<String, Boolean> includes = getIncludeMap();
|
||||
LinkedHashMap<String, SymbolEntry> symbols = getSymbolMap();
|
||||
|
||||
Node child = collectorElem.getFirstChild();
|
||||
while (child != null) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -12,10 +12,10 @@ package org.eclipse.cdt.make.internal.core.scannerconfig;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
|
||||
|
@ -34,10 +34,9 @@ public final class ScannerConfigUtil {
|
|||
* @param symbols
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean scAddSymbolsList2SymbolEntryMap(Map sumSymbols, List symbols, boolean active) {
|
||||
public static boolean scAddSymbolsList2SymbolEntryMap(Map<String, SymbolEntry> sumSymbols, List<String> symbols, boolean active) {
|
||||
boolean rc = false;
|
||||
for (Iterator i = symbols.iterator(); i.hasNext(); ) {
|
||||
String symbol = (String) i.next();
|
||||
for (String symbol : symbols) {
|
||||
String key;
|
||||
String value = null;
|
||||
int index = symbol.indexOf("="); //$NON-NLS-1$
|
||||
|
@ -47,7 +46,7 @@ public final class ScannerConfigUtil {
|
|||
} else {
|
||||
key = symbol.trim();
|
||||
}
|
||||
SymbolEntry sEntry = (SymbolEntry) sumSymbols.get(key);
|
||||
SymbolEntry sEntry = sumSymbols.get(key);
|
||||
if (sEntry == null) {
|
||||
// make only the first one to be active
|
||||
sEntry = new SymbolEntry(key, value, true);
|
||||
|
@ -67,11 +66,11 @@ public final class ScannerConfigUtil {
|
|||
* @param active - false = removed
|
||||
* @return
|
||||
*/
|
||||
public static List scSymbolsSymbolEntryMap2List(Map sumSymbols, boolean active) {
|
||||
Set symbols = sumSymbols.entrySet();
|
||||
List rv = new ArrayList(symbols.size());
|
||||
for (Iterator i = symbols.iterator(); i.hasNext(); ) {
|
||||
SymbolEntry sEntry = (SymbolEntry) ((Map.Entry) i.next()).getValue();
|
||||
public static List<String> scSymbolsSymbolEntryMap2List(Map<String, SymbolEntry> sumSymbols, boolean active) {
|
||||
Set<Entry<String, SymbolEntry>> symbols = sumSymbols.entrySet();
|
||||
List<String> rv = new ArrayList<String>(symbols.size());
|
||||
for (Entry<String, SymbolEntry> symbol : symbols) {
|
||||
SymbolEntry sEntry = symbol.getValue();
|
||||
if (active) {
|
||||
rv.addAll(sEntry.getActiveRaw());
|
||||
}
|
||||
|
@ -88,13 +87,13 @@ public final class ScannerConfigUtil {
|
|||
* @param sumSymbols (in) - discovered symbols in SymbolEntryMap
|
||||
* @return - active symbols as a plain Map
|
||||
*/
|
||||
public static Map scSymbolEntryMap2Map(Map sumSymbols) {
|
||||
Map rv = new HashMap();
|
||||
for (Iterator i = sumSymbols.keySet().iterator(); i.hasNext(); ) {
|
||||
String key = (String) i.next();
|
||||
SymbolEntry values = (SymbolEntry) sumSymbols.get(key);
|
||||
for (Iterator j = values.getValuesOnly(true).iterator(); j.hasNext(); ) {
|
||||
String value = (String) j.next();
|
||||
public static Map<String, String> scSymbolEntryMap2Map(Map<String, SymbolEntry> sumSymbols) {
|
||||
Map<String, String> rv = new HashMap<String, String>();
|
||||
Set<String> keys = sumSymbols.keySet();
|
||||
for (String key : keys) {
|
||||
SymbolEntry entries = sumSymbols.get(key);
|
||||
List<String> values = entries.getValuesOnly(true);
|
||||
for (String value : values) {
|
||||
rv.put(key, value); // multiple active values will be condensed to one !!!
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +107,7 @@ public final class ScannerConfigUtil {
|
|||
* @param symbol
|
||||
* @param active
|
||||
*/
|
||||
public static boolean scAddSymbolString2SymbolEntryMap(Map symbols, String symbol, boolean active) {
|
||||
public static boolean scAddSymbolString2SymbolEntryMap(Map<String, SymbolEntry> symbols, String symbol, boolean active) {
|
||||
boolean rc = false;
|
||||
String key;
|
||||
String value = null;
|
||||
|
@ -119,7 +118,7 @@ public final class ScannerConfigUtil {
|
|||
} else {
|
||||
key = symbol.trim();
|
||||
}
|
||||
SymbolEntry sEntry = (SymbolEntry) symbols.get(key);
|
||||
SymbolEntry sEntry = symbols.get(key);
|
||||
if (sEntry == null) {
|
||||
// make only the first one to be active
|
||||
sEntry = new SymbolEntry(key, value, active);
|
||||
|
@ -137,25 +136,23 @@ public final class ScannerConfigUtil {
|
|||
* @param addend (in)
|
||||
* @return
|
||||
*/
|
||||
public static boolean scAddSymbolEntryMap2SymbolEntryMap(Map result, Map addend) {
|
||||
public static boolean scAddSymbolEntryMap2SymbolEntryMap(Map<String, SymbolEntry> result, Map<String, SymbolEntry> addend) {
|
||||
boolean rc = false;
|
||||
for (Iterator i = addend.keySet().iterator(); i.hasNext(); ) {
|
||||
String key = (String) i.next();
|
||||
Set<String> keySet = addend.keySet();
|
||||
for (String key : keySet) {
|
||||
if (result.keySet().contains(key)) {
|
||||
SymbolEntry rSE = (SymbolEntry) result.get(key);
|
||||
SymbolEntry aSE = (SymbolEntry) addend.get(key);
|
||||
List activeValues = rSE.getActiveRaw();
|
||||
for (Iterator j = aSE.getActiveRaw().iterator(); j.hasNext(); ) {
|
||||
String aValue = (String) j.next();
|
||||
SymbolEntry rSE = result.get(key);
|
||||
SymbolEntry aSE = addend.get(key);
|
||||
List<String> activeValues = rSE.getActiveRaw();
|
||||
for (String aValue : aSE.getActiveRaw()) {
|
||||
if (!activeValues.contains(aValue)) {
|
||||
// result does not contain addend's value; add it
|
||||
rSE.add(getSymbolValue(aValue), true);
|
||||
rc |= true;
|
||||
}
|
||||
}
|
||||
List removedValues = rSE.getRemovedRaw();
|
||||
for (Iterator j = aSE.getRemovedRaw().iterator(); j.hasNext(); ) {
|
||||
String aValue = (String) j.next();
|
||||
List<String> removedValues = rSE.getRemovedRaw();
|
||||
for (String aValue : aSE.getRemovedRaw()) {
|
||||
if (!removedValues.contains(aValue)) {
|
||||
// result does not contain addend's value; add it
|
||||
rSE.add(getSymbolValue(aValue), false);
|
||||
|
@ -166,7 +163,7 @@ public final class ScannerConfigUtil {
|
|||
else {
|
||||
// result does not contain the symbol; add it
|
||||
// shallow copy
|
||||
SymbolEntry aSymbolEntry = (SymbolEntry) addend.get(key);
|
||||
SymbolEntry aSymbolEntry = addend.get(key);
|
||||
result.put(key, aSymbolEntry);
|
||||
rc |= true;
|
||||
}
|
||||
|
@ -209,11 +206,11 @@ public final class ScannerConfigUtil {
|
|||
* @param symbol
|
||||
* @param symbolEntryMap map of [symbol's key, symbolEntry]
|
||||
*/
|
||||
public static void removeSymbolEntryValue(String symbol, Map symbolEntryMap) {
|
||||
public static void removeSymbolEntryValue(String symbol, Map<String, SymbolEntry> symbolEntryMap) {
|
||||
String key = getSymbolKey(symbol);
|
||||
String value = getSymbolValue(symbol);
|
||||
// find it in the discoveredSymbols Map of SymbolEntries
|
||||
SymbolEntry se = (SymbolEntry) symbolEntryMap.get(key);
|
||||
SymbolEntry se = symbolEntryMap.get(key);
|
||||
if (se != null) {
|
||||
se.remove(value);
|
||||
if (se.numberOfValues() == 0) {
|
||||
|
@ -231,22 +228,21 @@ public final class ScannerConfigUtil {
|
|||
* @param index2
|
||||
* @return new map of include paths
|
||||
*/
|
||||
public static LinkedHashMap swapIncludePaths(LinkedHashMap sumPaths, int index1, int index2) {
|
||||
public static LinkedHashMap<String, SymbolEntry> swapIncludePaths(LinkedHashMap<String, SymbolEntry> sumPaths, int index1, int index2) {
|
||||
int size = sumPaths.size();
|
||||
if (index1 == index2 ||
|
||||
!(index1 >= 0 && index1 < size &&
|
||||
index2 >= 0 && index2 < size)) {
|
||||
return sumPaths;
|
||||
}
|
||||
ArrayList pathKeyList = new ArrayList(sumPaths.keySet());
|
||||
String temp1 = (String) pathKeyList.get(index1);
|
||||
String temp2 = (String) pathKeyList.get(index2);
|
||||
ArrayList<String> pathKeyList = new ArrayList<String>(sumPaths.keySet());
|
||||
String temp1 = pathKeyList.get(index1);
|
||||
String temp2 = pathKeyList.get(index2);
|
||||
pathKeyList.set(index1, temp2);
|
||||
pathKeyList.set(index2, temp1);
|
||||
|
||||
LinkedHashMap newSumPaths = new LinkedHashMap(sumPaths.size());
|
||||
for (Iterator i = pathKeyList.iterator(); i.hasNext(); ) {
|
||||
String key = (String) i.next();
|
||||
LinkedHashMap<String, SymbolEntry> newSumPaths = new LinkedHashMap<String, SymbolEntry>(sumPaths.size());
|
||||
for (String key : pathKeyList) {
|
||||
newSumPaths.put(key, sumPaths.get(key));
|
||||
}
|
||||
return newSumPaths;
|
||||
|
@ -259,18 +255,18 @@ public final class ScannerConfigUtil {
|
|||
* @return String[]
|
||||
*/
|
||||
public static String[] tokenizeStringWithQuotes(String line, String quoteStyle) {
|
||||
ArrayList allTokens = new ArrayList();
|
||||
ArrayList<String> allTokens = new ArrayList<String>();
|
||||
String[] tokens = line.split(quoteStyle);
|
||||
for (int i = 0; i < tokens.length; ++i) {
|
||||
if (i % 2 == 0) { // even tokens need further tokenization
|
||||
String[] sTokens = tokens[i].split("\\s+"); //$NON-NLS-1$
|
||||
for (int j = 0; j < sTokens.length; allTokens.add(sTokens[j++]));
|
||||
for (int j = 0; j < sTokens.length; allTokens.add(sTokens[j++])) {}
|
||||
}
|
||||
else {
|
||||
allTokens.add(tokens[i]);
|
||||
}
|
||||
}
|
||||
return (String[]) allTokens.toArray(new String[allTokens.size()]);
|
||||
return allTokens.toArray(new String[allTokens.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -42,6 +42,7 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathInfo;
|
|||
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CygpathTranslator;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -73,7 +74,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
// private List discoveredTSO; // target specific options
|
||||
// cumulative values
|
||||
private List<String> sumDiscoveredIncludes;
|
||||
private Map<?, ?> sumDiscoveredSymbols;
|
||||
private Map<String, SymbolEntry> sumDiscoveredSymbols;
|
||||
private boolean scPersisted = false;
|
||||
|
||||
public PerProjectSICollector() {
|
||||
|
@ -83,7 +84,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
// discoveredTSO = new ArrayList();
|
||||
//
|
||||
sumDiscoveredIncludes = new ArrayList<String>();
|
||||
sumDiscoveredSymbols = new LinkedHashMap<Object, Object>();
|
||||
sumDiscoveredSymbols = new LinkedHashMap<String, SymbolEntry>();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -211,7 +212,6 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) pathInfo;
|
||||
|
||||
monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
|
||||
if (pathInfo != null) {
|
||||
monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
|
||||
if (scannerConfigNeedsUpdate(projectPathInfo)) {
|
||||
monitor.worked(50);
|
||||
|
@ -226,7 +226,6 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
MakeCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
monitor.done();
|
||||
scPersisted = true;
|
||||
}
|
||||
|
@ -311,7 +310,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
*/
|
||||
private boolean definedSymbolsNeedUpdate(IPerProjectDiscoveredPathInfo discPathInfo) {
|
||||
boolean addedSymbols = false;
|
||||
List<?> discoveredSymbols = discoveredSI.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
List<String> discoveredSymbols = discoveredSI.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
if (discoveredSymbols != null) {
|
||||
// Step 1. Add discovered scanner config to the existing discovered scanner config
|
||||
// add the symbols from the latest discovery
|
||||
|
@ -321,10 +320,10 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
addedSymbols = ScannerConfigUtil.scAddSymbolsList2SymbolEntryMap(sumDiscoveredSymbols, discoveredSymbols, true);
|
||||
|
||||
// Step 2. Get project's scanner config
|
||||
LinkedHashMap<?, ?> persistedSymbols = discPathInfo.getSymbolMap();
|
||||
LinkedHashMap<String, SymbolEntry> persistedSymbols = discPathInfo.getSymbolMap();
|
||||
|
||||
// Step 3. Merge scanner config from steps 1 and 2
|
||||
LinkedHashMap<?, ?> candidateSymbols = new LinkedHashMap<Object, Object>(persistedSymbols);
|
||||
LinkedHashMap<String, SymbolEntry> candidateSymbols = new LinkedHashMap<String, SymbolEntry>(persistedSymbols);
|
||||
addedSymbols |= ScannerConfigUtil.scAddSymbolEntryMap2SymbolEntryMap(candidateSymbols, sumDiscoveredSymbols);
|
||||
|
||||
// Step 4. Set resulting scanner config
|
||||
|
@ -336,8 +335,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
|
||||
*/
|
||||
public List<?> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
||||
List<?> rv = null;
|
||||
public List<String> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
||||
List<String> rv = null;
|
||||
// check the resource
|
||||
String errorMessage = null;
|
||||
if (resource == null) {
|
||||
|
@ -365,8 +364,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#getDefinedSymbols()
|
||||
*/
|
||||
public Map getDefinedSymbols() {
|
||||
Map<?, ?> definedSymbols = ScannerConfigUtil.scSymbolEntryMap2Map(sumDiscoveredSymbols);
|
||||
public Map<String, String> getDefinedSymbols() {
|
||||
Map<String, String> definedSymbols = ScannerConfigUtil.scSymbolEntryMap2Map(sumDiscoveredSymbols);
|
||||
return definedSymbols;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue