1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

bug 319512: Missing type arguments on managedbuilder.core

This commit is contained in:
Andrew Gvozdev 2010-09-17 22:35:18 +00:00
parent bc1f29a4fd
commit f1747cd1b9
6 changed files with 53 additions and 48 deletions

View file

@ -15,9 +15,9 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -110,10 +110,10 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
private Boolean supportsManagedBuild; private Boolean supportsManagedBuild;
//custom builder settings //custom builder settings
private String[] customizedErrorParserIds; private String[] customizedErrorParserIds;
private HashMap customizedEnvironment; private HashMap<String, String> customizedEnvironment;
private Boolean appendEnvironment;// = Boolean.valueOf(true); private Boolean appendEnvironment;// = Boolean.valueOf(true);
private String buildPath; private String buildPath;
private HashMap customBuildProperties; private HashMap<String, String> customBuildProperties;
// private Boolean isWorkspaceBuildPath; // private Boolean isWorkspaceBuildPath;
private String ignoreErrCmd; private String ignoreErrCmd;
private String parallelBuildCmd; private String parallelBuildCmd;
@ -289,11 +289,11 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
if(builder.customizedErrorParserIds != null) if(builder.customizedErrorParserIds != null)
customizedErrorParserIds = builder.customizedErrorParserIds.clone(); customizedErrorParserIds = builder.customizedErrorParserIds.clone();
if(builder.customizedEnvironment != null) if(builder.customizedEnvironment != null)
customizedEnvironment = (HashMap)builder.customizedEnvironment.clone(); customizedEnvironment = (HashMap<String, String>) builder.customizedEnvironment.clone();
appendEnvironment = builder.appendEnvironment; appendEnvironment = builder.appendEnvironment;
buildPath = builder.buildPath; buildPath = builder.buildPath;
if(builder.customBuildProperties != null) if(builder.customBuildProperties != null)
customBuildProperties = (HashMap)builder.customBuildProperties.clone(); customBuildProperties = (HashMap<String, String>) builder.customBuildProperties.clone();
@ -393,14 +393,14 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
if(builder.customizedErrorParserIds != null) if(builder.customizedErrorParserIds != null)
customizedErrorParserIds = builder.customizedErrorParserIds.clone(); customizedErrorParserIds = builder.customizedErrorParserIds.clone();
if(builder.customizedEnvironment != null) if(builder.customizedEnvironment != null)
customizedEnvironment = (HashMap)builder.customizedEnvironment.clone(); customizedEnvironment = (HashMap<String, String>) builder.customizedEnvironment.clone();
appendEnvironment = builder.appendEnvironment; appendEnvironment = builder.appendEnvironment;
if(isBuildPathEditable()){ if(isBuildPathEditable()){
if(!getBuildPath().equals(builder.getBuildPath())) if(!getBuildPath().equals(builder.getBuildPath()))
setBuildPath(builder.getBuildPath()); setBuildPath(builder.getBuildPath());
} }
if(builder.customBuildProperties != null) if(builder.customBuildProperties != null)
customBuildProperties = (HashMap)builder.customBuildProperties.clone(); customBuildProperties = (HashMap<String, String>) builder.customBuildProperties.clone();
if(allBuildSettings){ if(allBuildSettings){
if(!getCommand().equals(builder.getCommand())) if(!getCommand().equals(builder.getCommand()))
@ -520,14 +520,14 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
customizedErrorParserIds = CDataUtil.stringToArray(tmp, ";"); //$NON-NLS-1$ customizedErrorParserIds = CDataUtil.stringToArray(tmp, ";"); //$NON-NLS-1$
tmp = element.getAttribute(ATTRIBUTE_ENVIRONMENT); tmp = element.getAttribute(ATTRIBUTE_ENVIRONMENT);
if(tmp != null) if(tmp != null)
customizedEnvironment = (HashMap)MapStorageElement.decodeMap(tmp); customizedEnvironment = MapStorageElement.decodeMap(tmp);
tmp = element.getAttribute(ATTRIBUTE_APPEND_ENVIRONMENT); tmp = element.getAttribute(ATTRIBUTE_APPEND_ENVIRONMENT);
if(tmp != null) if(tmp != null)
appendEnvironment = Boolean.valueOf(tmp); appendEnvironment = Boolean.valueOf(tmp);
buildPath = element.getAttribute(ATTRIBUTE_BUILD_PATH); buildPath = element.getAttribute(ATTRIBUTE_BUILD_PATH);
tmp = element.getAttribute(ATTRIBUTE_CUSTOM_PROPS); tmp = element.getAttribute(ATTRIBUTE_CUSTOM_PROPS);
if(tmp != null) if(tmp != null)
customBuildProperties = (HashMap)MapStorageElement.decodeMap(tmp); customBuildProperties = MapStorageElement.decodeMap(tmp);
ignoreErrCmd = element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD); ignoreErrCmd = element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD);
tmp = element.getAttribute(ATTRIBUTE_STOP_ON_ERR); tmp = element.getAttribute(ATTRIBUTE_STOP_ON_ERR);
@ -573,12 +573,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
if(entries.length == 0){ if(entries.length == 0){
outputEntries = new ICOutputEntry[0]; outputEntries = new ICOutputEntry[0];
} else { } else {
List list = new ArrayList(entries.length); List<ICSettingEntry> list = new ArrayList<ICSettingEntry>(entries.length);
for(int k = 0; k < entries.length; k++){ for(int k = 0; k < entries.length; k++){
if(entries[k].getKind() == ICLanguageSettingEntry.OUTPUT_PATH) if(entries[k].getKind() == ICLanguageSettingEntry.OUTPUT_PATH)
list.add(entries[k]); list.add(entries[k]);
} }
outputEntries = (ICOutputEntry[])list.toArray(new ICOutputEntry[list.size()]); outputEntries = list.toArray(new ICOutputEntry[list.size()]);
} }
} }
} }
@ -696,7 +696,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
tmp = element.getAttribute(ATTRIBUTE_ENVIRONMENT); tmp = element.getAttribute(ATTRIBUTE_ENVIRONMENT);
if(tmp != null) if(tmp != null)
customizedEnvironment = (HashMap)MapStorageElement.decodeMap(tmp); customizedEnvironment = MapStorageElement.decodeMap(tmp);
tmp = element.getAttribute(ATTRIBUTE_APPEND_ENVIRONMENT); tmp = element.getAttribute(ATTRIBUTE_APPEND_ENVIRONMENT);
if(tmp != null) if(tmp != null)
@ -707,7 +707,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
tmp = element.getAttribute(ATTRIBUTE_CUSTOM_PROPS); tmp = element.getAttribute(ATTRIBUTE_CUSTOM_PROPS);
if(tmp != null) if(tmp != null)
customBuildProperties = (HashMap)MapStorageElement.decodeMap(tmp); customBuildProperties = MapStorageElement.decodeMap(tmp);
// Get the semicolon separated list of IDs of the error parsers // Get the semicolon separated list of IDs of the error parsers
if (element.getAttribute(IToolChain.ERROR_PARSERS) != null) { if (element.getAttribute(IToolChain.ERROR_PARSERS) != null) {
@ -754,12 +754,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
if(entries.length == 0){ if(entries.length == 0){
outputEntries = new ICOutputEntry[0]; outputEntries = new ICOutputEntry[0];
} else { } else {
List list = new ArrayList(entries.length); List<ICSettingEntry> list = new ArrayList<ICSettingEntry>(entries.length);
for(int k = 0; k < entries.length; k++){ for(int k = 0; k < entries.length; k++){
if(entries[k].getKind() == ICLanguageSettingEntry.OUTPUT_PATH) if(entries[k].getKind() == ICLanguageSettingEntry.OUTPUT_PATH)
list.add(entries[k]); list.add(entries[k]);
} }
outputEntries = (ICOutputEntry[])list.toArray(new ICOutputEntry[list.size()]); outputEntries = list.toArray(new ICOutputEntry[list.size()]);
} }
} }
} }
@ -1180,12 +1180,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
errorParsers = new String[0]; errorParsers = new String[0];
} else { } else {
StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$ StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
List list = new ArrayList(tok.countTokens()); List<String> list = new ArrayList<String>(tok.countTokens());
while (tok.hasMoreElements()) { while (tok.hasMoreElements()) {
list.add(tok.nextToken()); list.add(tok.nextToken());
} }
String[] strArr = {""}; //$NON-NLS-1$ String[] strArr = {""}; //$NON-NLS-1$
errorParsers = (String[]) list.toArray(strArr); errorParsers = list.toArray(strArr);
} }
} else { } else {
errorParsers = new String[0]; errorParsers = new String[0];
@ -1413,10 +1413,9 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
String high = ManagedBuildManager String high = ManagedBuildManager
.getExtensionBuilderMap().lastKey(); .getExtensionBuilderMap().lastKey();
SortedMap subMap = null; SortedMap<String, IBuilder> subMap = null;
if (superClassId.compareTo(high) <= 0) { if (superClassId.compareTo(high) <= 0) {
subMap = ManagedBuildManager.getExtensionBuilderMap().subMap( subMap = ManagedBuildManager.getExtensionBuilderMap().subMap(superClassId, high + "\0"); //$NON-NLS-1$
superClassId, high + "\0"); //$NON-NLS-1$
} else { } else {
// It means there are no entries in the map for the given id. // It means there are no entries in the map for the given id.
// make the project is invalid // make the project is invalid
@ -1439,8 +1438,8 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
String version = ManagedBuildManager String version = ManagedBuildManager
.getVersionFromIdAndVersion(superClassId); .getVersionFromIdAndVersion(superClassId);
Collection c = subMap.values(); Collection<IBuilder> c = subMap.values();
IBuilder[] builderElements = (IBuilder[])c.toArray(new IBuilder[c.size()]); IBuilder[] builderElements = c.toArray(new IBuilder[c.size()]);
for (int i = 0; i < builderElements.length; i++) { for (int i = 0; i < builderElements.length; i++) {
IBuilder builderElement = builderElements[i]; IBuilder builderElement = builderElements[i];
@ -2038,7 +2037,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
} else if(BuilderFactory.BUILD_APPEND_ENVIRONMENT.equals(name)){ } else if(BuilderFactory.BUILD_APPEND_ENVIRONMENT.equals(name)){
result = Boolean.valueOf(appendEnvironment()).toString(); result = Boolean.valueOf(appendEnvironment()).toString();
} else if(customBuildProperties != null){ } else if(customBuildProperties != null){
result = (String)customBuildProperties.get(name); result = customBuildProperties.get(name);
} }
if(result == null) if(result == null)
@ -2127,21 +2126,22 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
} }
public Map getEnvironment() { public Map<String, String> getEnvironment() {
if(customizedEnvironment != null) if(customizedEnvironment != null)
return (HashMap)customizedEnvironment.clone(); return (HashMap<String, String>)customizedEnvironment.clone();
return null; return null;
} }
public Map getExpandedEnvironment() throws CoreException { public Map<String, String> getExpandedEnvironment() throws CoreException {
if(customizedEnvironment != null){ if(customizedEnvironment != null){
Map expanded = (HashMap)customizedEnvironment.clone(); @SuppressWarnings("unchecked")
Map<String, String> expanded = (HashMap<String, String>)customizedEnvironment.clone();
ICdtVariableManager mngr = CCorePlugin.getDefault().getCdtVariableManager(); ICdtVariableManager mngr = CCorePlugin.getDefault().getCdtVariableManager();
String separator = CCorePlugin.getDefault().getBuildEnvironmentManager().getDefaultDelimiter(); String separator = CCorePlugin.getDefault().getBuildEnvironmentManager().getDefaultDelimiter();
ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(getParent().getParent()); ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(getParent().getParent());
for(Iterator iter = expanded.entrySet().iterator(); iter.hasNext();){ Set<Entry<String, String>> entrySet = expanded.entrySet();
Map.Entry entry = (Map.Entry)iter.next(); for (Entry<String, String> entry : entrySet) {
String value = (String)entry.getValue(); String value = entry.getValue();
try { try {
value = mngr.resolveValue(value, "", separator, cfgDes); //$NON-NLS-1$ value = mngr.resolveValue(value, "", separator, cfgDes); //$NON-NLS-1$
entry.setValue(value); entry.setValue(value);
@ -2209,7 +2209,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
if(value == null){ if(value == null){
customizedEnvironment = null; customizedEnvironment = null;
} else { } else {
customizedEnvironment = (HashMap)MapStorageElement.decodeMap(value); customizedEnvironment = MapStorageElement.decodeMap(value);
} }
} else if(BuilderFactory.BUILD_APPEND_ENVIRONMENT.equals(name)){ } else if(BuilderFactory.BUILD_APPEND_ENVIRONMENT.equals(name)){
appendEnvironment = value != null ? appendEnvironment = value != null ?
@ -2219,15 +2219,15 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
} }
} }
private Map getCustomBuildPropertiesMap(){ private Map<String, String> getCustomBuildPropertiesMap(){
if(customBuildProperties == null){ if(customBuildProperties == null){
customBuildProperties = new HashMap(); customBuildProperties = new HashMap<String, String>();
} }
return customBuildProperties; return customBuildProperties;
} }
public void setEnvironment(Map env) throws CoreException { public void setEnvironment(Map<String, String> env) throws CoreException {
customizedEnvironment = new HashMap(env); customizedEnvironment = new HashMap<String, String>(env);
} }
public boolean isCustomBuilder() { public boolean isCustomBuilder() {
@ -2528,12 +2528,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
errorParserIds = null; errorParserIds = null;
} }
void removeErrorParsers(Set set){ void removeErrorParsers(Set<String> set){
Set oldSet = contributeErrorParsers(null); Set<String> oldSet = contributeErrorParsers(null);
if(oldSet == null) if(oldSet == null)
oldSet = new HashSet(); oldSet = new HashSet<String>();
oldSet.removeAll(set); oldSet.removeAll(set);
setErrorParserList((String[])oldSet.toArray(new String[oldSet.size()])); setErrorParserList(oldSet.toArray(new String[oldSet.size()]));
} }
public void setErrorParserList(String[] ids) { public void setErrorParserList(String[] ids) {

View file

@ -326,6 +326,7 @@ public class CommonBuilder extends ACBuilder {
for (IBuilder builder : builders) { for (IBuilder builder : builders) {
buildCfgSet.add(builder.getParent().getParent()); buildCfgSet.add(builder.getParent().getParent());
} }
@SuppressWarnings("unchecked")
List<Configuration> othersList = ListComparator.getAdded(allCfgs, buildCfgSet.toArray()); List<Configuration> othersList = ListComparator.getAdded(allCfgs, buildCfgSet.toArray());
if(othersList != null) if(othersList != null)
otherConfigs = othersList.toArray(new Configuration[othersList.size()]); otherConfigs = othersList.toArray(new Configuration[othersList.size()]);
@ -417,7 +418,9 @@ public class CommonBuilder extends ACBuilder {
* @see IncrementalProjectBuilder#build * @see IncrementalProjectBuilder#build
*/ */
@Override @Override
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map argsMap, IProgressMonitor monitor) throws CoreException {
@SuppressWarnings("unchecked")
Map<String, String> args = argsMap;
if (DEBUG_EVENTS) if (DEBUG_EVENTS)
printEvent(kind, args); printEvent(kind, args);

View file

@ -392,7 +392,9 @@ public class GeneratedMakefileBuilder extends ACBuilder {
* @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
*/ */
@Override @Override
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map argsMap, IProgressMonitor monitor) throws CoreException {
@SuppressWarnings("unchecked")
Map<String, String> args = argsMap;
if (DEBUG_EVENTS) if (DEBUG_EVENTS)
printEvent(kind, args); printEvent(kind, args);

View file

@ -121,11 +121,11 @@ public class ManagedMakeProject implements ICOwner {
private String[] parseStringToArray(String syms) { private String[] parseStringToArray(String syms) {
if (syms != null && syms.length() > 0) { if (syms != null && syms.length() > 0) {
StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$ StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$
ArrayList list = new ArrayList(tok.countTokens()); ArrayList<String> list = new ArrayList<String>(tok.countTokens());
while (tok.hasMoreElements()) { while (tok.hasMoreElements()) {
list.add(tok.nextToken()); list.add(tok.nextToken());
} }
return (String[]) list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
return new String[0]; return new String[0];
} }

View file

@ -170,9 +170,9 @@ public class MapStorageElement implements ICStorageElement {
fMap.put(getMapKey(name), value); fMap.put(getMapKey(name), value);
} }
public static Map<String, String> decodeMap(String value) { public static HashMap<String, String> decodeMap(String value) {
List<String> list = decodeList(value); List<String> list = decodeList(value);
Map<String, String> map = new HashMap<String, String>(); HashMap<String, String> map = new HashMap<String, String>();
char escapeChar = '\\'; char escapeChar = '\\';
for(int i = 0; i < list.size(); i++){ for(int i = 0; i < list.size(); i++){

View file

@ -70,10 +70,10 @@ public interface IMakeCommonBuildInfo {
String[] getErrorParsers(); String[] getErrorParsers();
void setErrorParsers(String[] parsers) throws CoreException; void setErrorParsers(String[] parsers) throws CoreException;
Map getExpandedEnvironment() throws CoreException; Map<String, String> getExpandedEnvironment() throws CoreException;
Map getEnvironment(); Map<String, String> getEnvironment();
void setEnvironment(Map env) throws CoreException; void setEnvironment(Map<String, String> env) throws CoreException;
boolean appendEnvironment(); boolean appendEnvironment();
void setAppendEnvironment(boolean append) throws CoreException; void setAppendEnvironment(boolean append) throws CoreException;