From f1747cd1b9a20edc8be62d1aad5ea6c84562cbe3 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Fri, 17 Sep 2010 22:35:18 +0000 Subject: [PATCH] bug 319512: Missing type arguments on managedbuilder.core --- .../managedbuilder/internal/core/Builder.java | 78 +++++++++---------- .../internal/core/CommonBuilder.java | 5 +- .../core/GeneratedMakefileBuilder.java | 4 +- .../internal/core/ManagedMakeProject.java | 4 +- .../internal/core/MapStorageElement.java | 4 +- .../newmake/core/IMakeCommonBuildInfo.java | 6 +- 6 files changed, 53 insertions(+), 48 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java index 3c5a1151ec3..53c89de0473 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java @@ -15,9 +15,9 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; 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.StringTokenizer; @@ -110,10 +110,10 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider private Boolean supportsManagedBuild; //custom builder settings private String[] customizedErrorParserIds; - private HashMap customizedEnvironment; + private HashMap customizedEnvironment; private Boolean appendEnvironment;// = Boolean.valueOf(true); private String buildPath; - private HashMap customBuildProperties; + private HashMap customBuildProperties; // private Boolean isWorkspaceBuildPath; private String ignoreErrCmd; private String parallelBuildCmd; @@ -289,11 +289,11 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider if(builder.customizedErrorParserIds != null) customizedErrorParserIds = builder.customizedErrorParserIds.clone(); if(builder.customizedEnvironment != null) - customizedEnvironment = (HashMap)builder.customizedEnvironment.clone(); + customizedEnvironment = (HashMap) builder.customizedEnvironment.clone(); appendEnvironment = builder.appendEnvironment; buildPath = builder.buildPath; if(builder.customBuildProperties != null) - customBuildProperties = (HashMap)builder.customBuildProperties.clone(); + customBuildProperties = (HashMap) builder.customBuildProperties.clone(); @@ -393,14 +393,14 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider if(builder.customizedErrorParserIds != null) customizedErrorParserIds = builder.customizedErrorParserIds.clone(); if(builder.customizedEnvironment != null) - customizedEnvironment = (HashMap)builder.customizedEnvironment.clone(); + customizedEnvironment = (HashMap) builder.customizedEnvironment.clone(); appendEnvironment = builder.appendEnvironment; if(isBuildPathEditable()){ if(!getBuildPath().equals(builder.getBuildPath())) setBuildPath(builder.getBuildPath()); } if(builder.customBuildProperties != null) - customBuildProperties = (HashMap)builder.customBuildProperties.clone(); + customBuildProperties = (HashMap) builder.customBuildProperties.clone(); if(allBuildSettings){ if(!getCommand().equals(builder.getCommand())) @@ -520,14 +520,14 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider customizedErrorParserIds = CDataUtil.stringToArray(tmp, ";"); //$NON-NLS-1$ tmp = element.getAttribute(ATTRIBUTE_ENVIRONMENT); if(tmp != null) - customizedEnvironment = (HashMap)MapStorageElement.decodeMap(tmp); + customizedEnvironment = MapStorageElement.decodeMap(tmp); tmp = element.getAttribute(ATTRIBUTE_APPEND_ENVIRONMENT); if(tmp != null) appendEnvironment = Boolean.valueOf(tmp); buildPath = element.getAttribute(ATTRIBUTE_BUILD_PATH); tmp = element.getAttribute(ATTRIBUTE_CUSTOM_PROPS); if(tmp != null) - customBuildProperties = (HashMap)MapStorageElement.decodeMap(tmp); + customBuildProperties = MapStorageElement.decodeMap(tmp); ignoreErrCmd = element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD); tmp = element.getAttribute(ATTRIBUTE_STOP_ON_ERR); @@ -573,12 +573,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider if(entries.length == 0){ outputEntries = new ICOutputEntry[0]; } else { - List list = new ArrayList(entries.length); + List list = new ArrayList(entries.length); for(int k = 0; k < entries.length; k++){ if(entries[k].getKind() == ICLanguageSettingEntry.OUTPUT_PATH) 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); if(tmp != null) - customizedEnvironment = (HashMap)MapStorageElement.decodeMap(tmp); + customizedEnvironment = MapStorageElement.decodeMap(tmp); tmp = element.getAttribute(ATTRIBUTE_APPEND_ENVIRONMENT); if(tmp != null) @@ -707,7 +707,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider tmp = element.getAttribute(ATTRIBUTE_CUSTOM_PROPS); if(tmp != null) - customBuildProperties = (HashMap)MapStorageElement.decodeMap(tmp); + customBuildProperties = MapStorageElement.decodeMap(tmp); // Get the semicolon separated list of IDs of the error parsers if (element.getAttribute(IToolChain.ERROR_PARSERS) != null) { @@ -754,12 +754,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider if(entries.length == 0){ outputEntries = new ICOutputEntry[0]; } else { - List list = new ArrayList(entries.length); + List list = new ArrayList(entries.length); for(int k = 0; k < entries.length; k++){ if(entries[k].getKind() == ICLanguageSettingEntry.OUTPUT_PATH) 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]; } else { StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$ - List list = new ArrayList(tok.countTokens()); + List list = new ArrayList(tok.countTokens()); while (tok.hasMoreElements()) { list.add(tok.nextToken()); } String[] strArr = {""}; //$NON-NLS-1$ - errorParsers = (String[]) list.toArray(strArr); + errorParsers = list.toArray(strArr); } } else { errorParsers = new String[0]; @@ -1413,10 +1413,9 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider String high = ManagedBuildManager .getExtensionBuilderMap().lastKey(); - SortedMap subMap = null; + SortedMap subMap = null; if (superClassId.compareTo(high) <= 0) { - subMap = ManagedBuildManager.getExtensionBuilderMap().subMap( - superClassId, high + "\0"); //$NON-NLS-1$ + subMap = ManagedBuildManager.getExtensionBuilderMap().subMap(superClassId, high + "\0"); //$NON-NLS-1$ } else { // It means there are no entries in the map for the given id. // make the project is invalid @@ -1439,8 +1438,8 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider String version = ManagedBuildManager .getVersionFromIdAndVersion(superClassId); - Collection c = subMap.values(); - IBuilder[] builderElements = (IBuilder[])c.toArray(new IBuilder[c.size()]); + Collection c = subMap.values(); + IBuilder[] builderElements = c.toArray(new IBuilder[c.size()]); for (int i = 0; i < builderElements.length; 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)){ result = Boolean.valueOf(appendEnvironment()).toString(); } else if(customBuildProperties != null){ - result = (String)customBuildProperties.get(name); + result = customBuildProperties.get(name); } if(result == null) @@ -2127,21 +2126,22 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider } - public Map getEnvironment() { + public Map getEnvironment() { if(customizedEnvironment != null) - return (HashMap)customizedEnvironment.clone(); + return (HashMap)customizedEnvironment.clone(); return null; } - public Map getExpandedEnvironment() throws CoreException { + public Map getExpandedEnvironment() throws CoreException { if(customizedEnvironment != null){ - Map expanded = (HashMap)customizedEnvironment.clone(); + @SuppressWarnings("unchecked") + Map expanded = (HashMap)customizedEnvironment.clone(); ICdtVariableManager mngr = CCorePlugin.getDefault().getCdtVariableManager(); String separator = CCorePlugin.getDefault().getBuildEnvironmentManager().getDefaultDelimiter(); ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(getParent().getParent()); - for(Iterator iter = expanded.entrySet().iterator(); iter.hasNext();){ - Map.Entry entry = (Map.Entry)iter.next(); - String value = (String)entry.getValue(); + Set> entrySet = expanded.entrySet(); + for (Entry entry : entrySet) { + String value = entry.getValue(); try { value = mngr.resolveValue(value, "", separator, cfgDes); //$NON-NLS-1$ entry.setValue(value); @@ -2209,7 +2209,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider if(value == null){ customizedEnvironment = null; } else { - customizedEnvironment = (HashMap)MapStorageElement.decodeMap(value); + customizedEnvironment = MapStorageElement.decodeMap(value); } } else if(BuilderFactory.BUILD_APPEND_ENVIRONMENT.equals(name)){ appendEnvironment = value != null ? @@ -2219,15 +2219,15 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider } } - private Map getCustomBuildPropertiesMap(){ + private Map getCustomBuildPropertiesMap(){ if(customBuildProperties == null){ - customBuildProperties = new HashMap(); + customBuildProperties = new HashMap(); } return customBuildProperties; } - public void setEnvironment(Map env) throws CoreException { - customizedEnvironment = new HashMap(env); + public void setEnvironment(Map env) throws CoreException { + customizedEnvironment = new HashMap(env); } public boolean isCustomBuilder() { @@ -2528,12 +2528,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider errorParserIds = null; } - void removeErrorParsers(Set set){ - Set oldSet = contributeErrorParsers(null); + void removeErrorParsers(Set set){ + Set oldSet = contributeErrorParsers(null); if(oldSet == null) - oldSet = new HashSet(); + oldSet = new HashSet(); oldSet.removeAll(set); - setErrorParserList((String[])oldSet.toArray(new String[oldSet.size()])); + setErrorParserList(oldSet.toArray(new String[oldSet.size()])); } public void setErrorParserList(String[] ids) { diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java index c5b25610fa0..3167b768e3e 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java @@ -326,6 +326,7 @@ public class CommonBuilder extends ACBuilder { for (IBuilder builder : builders) { buildCfgSet.add(builder.getParent().getParent()); } + @SuppressWarnings("unchecked") List othersList = ListComparator.getAdded(allCfgs, buildCfgSet.toArray()); if(othersList != null) otherConfigs = othersList.toArray(new Configuration[othersList.size()]); @@ -417,7 +418,9 @@ public class CommonBuilder extends ACBuilder { * @see IncrementalProjectBuilder#build */ @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 args = argsMap; if (DEBUG_EVENTS) printEvent(kind, args); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java index c374b9a7729..26c9a53bd51 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java @@ -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) */ @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 args = argsMap; if (DEBUG_EVENTS) printEvent(kind, args); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedMakeProject.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedMakeProject.java index 19e0c86ff2e..34308d4b875 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedMakeProject.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedMakeProject.java @@ -121,11 +121,11 @@ public class ManagedMakeProject implements ICOwner { private String[] parseStringToArray(String syms) { if (syms != null && syms.length() > 0) { StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$ - ArrayList list = new ArrayList(tok.countTokens()); + ArrayList list = new ArrayList(tok.countTokens()); while (tok.hasMoreElements()) { list.add(tok.nextToken()); } - return (String[]) list.toArray(new String[list.size()]); + return list.toArray(new String[list.size()]); } return new String[0]; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MapStorageElement.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MapStorageElement.java index 6545b1eea00..8bec35c4673 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MapStorageElement.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MapStorageElement.java @@ -170,9 +170,9 @@ public class MapStorageElement implements ICStorageElement { fMap.put(getMapKey(name), value); } - public static Map decodeMap(String value) { + public static HashMap decodeMap(String value) { List list = decodeList(value); - Map map = new HashMap(); + HashMap map = new HashMap(); char escapeChar = '\\'; for(int i = 0; i < list.size(); i++){ diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/newmake/core/IMakeCommonBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/newmake/core/IMakeCommonBuildInfo.java index f9f3b2f49f1..35cded8218d 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/newmake/core/IMakeCommonBuildInfo.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/newmake/core/IMakeCommonBuildInfo.java @@ -70,10 +70,10 @@ public interface IMakeCommonBuildInfo { String[] getErrorParsers(); void setErrorParsers(String[] parsers) throws CoreException; - Map getExpandedEnvironment() throws CoreException; + Map getExpandedEnvironment() throws CoreException; - Map getEnvironment(); - void setEnvironment(Map env) throws CoreException; + Map getEnvironment(); + void setEnvironment(Map env) throws CoreException; boolean appendEnvironment(); void setAppendEnvironment(boolean append) throws CoreException;