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

bug 319512: Compilation warnings

This commit is contained in:
Andrew Gvozdev 2010-07-27 03:28:25 +00:00
parent 5094e4e9a0
commit 4c9e17c86d
5 changed files with 138 additions and 176 deletions

View file

@ -26,7 +26,7 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ITool extends IBuildObject, IHoldsOptions { public interface ITool extends IHoldsOptions {
// Schema element names // Schema element names
public static final String COMMAND = "command"; //$NON-NLS-1$ public static final String COMMAND = "command"; //$NON-NLS-1$
public static final String COMMAND_LINE_PATTERN = "commandLinePattern"; //$NON-NLS-1$ public static final String COMMAND_LINE_PATTERN = "commandLinePattern"; //$NON-NLS-1$
@ -288,7 +288,7 @@ public interface ITool extends IBuildObject, IHoldsOptions {
* @deprecated - use getPrimaryInputExtensions or getAllInputExtensions * @deprecated - use getPrimaryInputExtensions or getAllInputExtensions
*/ */
@Deprecated @Deprecated
public List getInputExtensions(); public List<String> getInputExtensions();
/** /**
* Returns the array of valid primary source extensions this tool knows how to build. * Returns the array of valid primary source extensions this tool knows how to build.
@ -330,7 +330,7 @@ public interface ITool extends IBuildObject, IHoldsOptions {
* @deprecated - use getDependency* methods * @deprecated - use getDependency* methods
*/ */
@Deprecated @Deprecated
public List getInterfaceExtensions(); public List<String> getInterfaceExtensions();
/** /**
* Answers a constant corresponding to the project nature the tool should be used * Answers a constant corresponding to the project nature the tool should be used

View file

@ -37,7 +37,7 @@ public interface IToolReference extends ITool {
* *
* @return List * @return List
*/ */
public List getOptionReferenceList(); public List<OptionReference> getOptionReferenceList();
/** /**
* Answers the tool that the reference has been created for. * Answers the tool that the reference has been created for.

View file

@ -12,7 +12,6 @@ package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
@ -36,9 +35,7 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
/** /**
* This class is deprecated in 2.1 * @deprecated This class is deprecated in 2.1
*
* @deprecated
*/ */
@Deprecated @Deprecated
public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
@ -47,7 +44,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
private boolean rebuildNeeded = false; private boolean rebuildNeeded = false;
private boolean resolved = true; private boolean resolved = true;
private ITarget target; private ITarget target;
private List toolReferences; private List<IToolReference> toolReferences;
private IConfiguration createdConfig; private IConfiguration createdConfig;
/** /**
@ -113,12 +110,9 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
IProject project = (IProject) target.getOwner(); IProject project = (IProject) target.getOwner();
// Get the tool references from the target and parent // Get the tool references from the target and parent
List allToolRefs = new Vector(target.getLocalToolReferences()); List<IToolReference> allToolRefs = new Vector<IToolReference>(target.getLocalToolReferences());
allToolRefs.addAll(((ConfigurationV2)parentConfig).getLocalToolReferences()); allToolRefs.addAll(((ConfigurationV2)parentConfig).getLocalToolReferences());
Iterator iter = allToolRefs.listIterator(); for (IToolReference toolRef : allToolRefs) {
while (iter.hasNext()) {
ToolReference toolRef = (ToolReference)iter.next();
// Make a new ToolReference based on the tool in the ref // Make a new ToolReference based on the tool in the ref
ITool parentTool = toolRef.getTool(); ITool parentTool = toolRef.getTool();
ToolReference newRef = new ToolReference(this, parentTool); ToolReference newRef = new ToolReference(this, parentTool);
@ -129,10 +123,8 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
newRef.setToolCommand(refCmd); newRef.setToolCommand(refCmd);
} }
List optRefs = toolRef.getOptionReferenceList(); List<OptionReference> optRefs = toolRef.getOptionReferenceList();
Iterator optIter = optRefs.listIterator(); for (OptionReference optRef : optRefs) {
while (optIter.hasNext()) {
OptionReference optRef = (OptionReference)optIter.next();
IOption opt = optRef.getOption(); IOption opt = optRef.getOption();
try { try {
switch (opt.getValueType()) { switch (opt.getValueType()) {
@ -218,10 +210,9 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
if (!resolved) { if (!resolved) {
resolved = true; resolved = true;
// IManagedConfigElement element = ManagedBuildManager.getConfigElement(this); // IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
Iterator refIter = getLocalToolReferences().iterator(); List<IToolReference> localToolReferences = getLocalToolReferences();
while (refIter.hasNext()) { for (IToolReference ref : localToolReferences) {
ToolReference ref = (ToolReference)refIter.next(); ((ToolReference)ref).resolveReferences();
ref.resolveReferences();
} }
} }
} }
@ -239,7 +230,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
* @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getToolReferences() * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getToolReferences()
*/ */
public IToolReference[] getToolReferences() { public IToolReference[] getToolReferences() {
List list = getLocalToolReferences(); List<IToolReference> list = getLocalToolReferences();
IToolReference[] tools = new IToolReference[list.size()]; IToolReference[] tools = new IToolReference[list.size()];
list.toArray(tools); list.toArray(tools);
return tools; return tools;
@ -251,7 +242,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
*/ */
private OptionReference createOptionReference(IOption option) { private OptionReference createOptionReference(IOption option) {
ToolReference searchRef = null; ToolReference searchRef = null;
ToolReference answer = null; IToolReference answer = null;
// The option may already be a reference created to hold user settings // The option may already be a reference created to hold user settings
if (option instanceof OptionReference) { if (option instanceof OptionReference) {
// The option reference belongs to an existing tool reference // The option reference belongs to an existing tool reference
@ -293,11 +284,9 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
* @param toolRef * @param toolRef
* @return * @return
*/ */
private ToolReference findLocalReference(ToolReference toolRef) { private IToolReference findLocalReference(ToolReference toolRef) {
Iterator iter = getLocalToolReferences().iterator(); List<IToolReference> localToolReferences = getLocalToolReferences();
for (IToolReference ref : localToolReferences) {
while (iter.hasNext()) {
ToolReference ref = (ToolReference)iter.next();
if (toolRef.getTool().equals(ref.getTool())) { if (toolRef.getTool().equals(ref.getTool())) {
return ref; return ref;
} }
@ -311,9 +300,8 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
*/ */
public ITool[] getFilteredTools(IProject project) { public ITool[] getFilteredTools(IProject project) {
ITool[] localTools = getTools(); ITool[] localTools = getTools();
Vector tools = new Vector(localTools.length); Vector<ITool> tools = new Vector<ITool>(localTools.length);
for (int i = 0; i < localTools.length; i++) { for (ITool tool : localTools) {
ITool tool = localTools[i];
try { try {
// Make sure the tool is right for the project // Make sure the tool is right for the project
switch (tool.getNatureFilter()) { switch (tool.getNatureFilter()) {
@ -339,7 +327,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
} }
// Answer the filtered tools as an array // Answer the filtered tools as an array
return (ITool[])tools.toArray(new ITool[tools.size()]); return tools.toArray(new ITool[tools.size()]);
} }
/* (non-javadoc) /* (non-javadoc)
@ -348,9 +336,9 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
* *
* @return List * @return List
*/ */
protected List getLocalToolReferences() { protected List<IToolReference> getLocalToolReferences() {
if (toolReferences == null) { if (toolReferences == null) {
toolReferences = new ArrayList(); toolReferences = new ArrayList<IToolReference>();
} }
return toolReferences; return toolReferences;
} }
@ -374,7 +362,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
// Validate that the tools correspond to the nature // Validate that the tools correspond to the nature
IProject project = (IProject)target.getOwner(); IProject project = (IProject)target.getOwner();
if (project != null) { if (project != null) {
List validTools = new ArrayList(); List<ITool> validTools = new ArrayList<ITool>();
// The target is associated with a real project // The target is associated with a real project
for (int i = 0; i < tools.length; ++i) { for (int i = 0; i < tools.length; ++i) {
@ -405,7 +393,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
} }
} }
// Now put the valid tools back into the array // Now put the valid tools back into the array
tools = (ITool[]) validTools.toArray(new ITool[validTools.size()]); tools = validTools.toArray(new ITool[validTools.size()]);
} }
// Replace tools with local overrides // Replace tools with local overrides
@ -426,9 +414,8 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
if (isDirty) return true; if (isDirty) return true;
// Otherwise see if any tool references need saving // Otherwise see if any tool references need saving
Iterator iter = getLocalToolReferences().listIterator(); List<IToolReference> localToolReferences = getLocalToolReferences();
while (iter.hasNext()) { for (IToolReference ref : localToolReferences) {
IToolReference ref = (IToolReference) iter.next();
if (ref.isDirty()) return true; if (ref.isDirty()) return true;
} }
@ -454,8 +441,8 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
* @param tool * @param tool
* @return List * @return List
*/ */
protected List getOptionReferences(ITool tool) { protected List<OptionReference> getOptionReferences(ITool tool) {
List references = new ArrayList(); List<OptionReference> references = new ArrayList<OptionReference>();
// Get all the option references I add for this tool // Get all the option references I add for this tool
IToolReference toolRef = getToolReference(tool); IToolReference toolRef = getToolReference(tool);
@ -465,10 +452,8 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
// See if there is anything that my parents add that I don't // See if there is anything that my parents add that I don't
if (parent != null) { if (parent != null) {
List temp = ((ConfigurationV2)parent).getOptionReferences(tool); List<OptionReference> temp = ((ConfigurationV2)parent).getOptionReferences(tool);
Iterator iter = temp.listIterator(); for (OptionReference ref : temp) {
while (iter.hasNext()) {
OptionReference ref = (OptionReference) iter.next();
if (!references.contains(ref)) { if (!references.contains(ref)) {
references.add(ref); references.add(ref);
} }
@ -529,9 +514,8 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
if (tool == null) return null; if (tool == null) return null;
// See if the receiver has a reference to the tool // See if the receiver has a reference to the tool
Iterator iter = getLocalToolReferences().listIterator(); List<IToolReference> localToolReferences = getLocalToolReferences();
while (iter.hasNext()) { for (IToolReference temp : localToolReferences) {
ToolReference temp = (ToolReference)iter.next();
if (temp.references(tool)) { if (temp.references(tool)) {
return temp; return temp;
} }
@ -583,12 +567,11 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
element.setAttribute(IConfigurationV2.PARENT, parent.getId()); element.setAttribute(IConfigurationV2.PARENT, parent.getId());
// Serialize only the tool references defined in the configuration // Serialize only the tool references defined in the configuration
Iterator iter = getLocalToolReferences().listIterator(); List<IToolReference> localToolReferences = getLocalToolReferences();
while (iter.hasNext()) { for (IToolReference toolRef : localToolReferences) {
ToolReference toolRef = (ToolReference) iter.next();
Element toolRefElement = doc.createElement(IConfigurationV2.TOOLREF_ELEMENT_NAME); Element toolRefElement = doc.createElement(IConfigurationV2.TOOLREF_ELEMENT_NAME);
element.appendChild(toolRefElement); element.appendChild(toolRefElement);
toolRef.serialize(doc, toolRefElement); ((ToolReference)toolRef).serialize(doc, toolRefElement);
} }
// I am clean now // I am clean now
@ -602,9 +585,9 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
// Override the dirty flag // Override the dirty flag
this.isDirty = isDirty; this.isDirty = isDirty;
// And do the same for the tool references // And do the same for the tool references
Iterator iter = getLocalToolReferences().listIterator(); List<IToolReference> localToolReferences = getLocalToolReferences();
while (iter.hasNext()) { for (IToolReference toolRef : localToolReferences) {
((ToolReference)iter.next()).setDirty(isDirty); ((ToolReference)toolRef).setDirty(isDirty);
} }
} }
@ -692,12 +675,10 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
ref = new ToolReference(this, tool); ref = new ToolReference(this, tool);
} }
// Set the ref's command // Set the ref's command
if (ref != null) {
isDirty = ref.setToolCommand(command); isDirty = ref.setToolCommand(command);
rebuildNeeded = isDirty; rebuildNeeded = isDirty;
} }
} }
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#setCreatedConfig(IConfiguration) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#setCreatedConfig(IConfiguration)

View file

@ -12,13 +12,12 @@ package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Vector; import java.util.Vector;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.managedbuilder.core.IBuilder; import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IConfigurationV2; import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
@ -41,14 +40,13 @@ import org.w3c.dom.Node;
public class Target extends BuildObject implements ITarget { public class Target extends BuildObject implements ITarget {
private static final String EMPTY_STRING = new String(); private static final String EMPTY_STRING = new String();
private static final IConfigurationV2[] emptyConfigs = new IConfigurationV2[0];
private String artifactName; private String artifactName;
private String binaryParserId; private String binaryParserId;
private String cleanCommand; private String cleanCommand;
private List configList; private List<IConfigurationV2> configList;
private Map configMap; private Map<String, IConfigurationV2> configMap;
private String defaultExtension; private String defaultExtension;
private Map depCalculatorsMap; // private Map depCalculatorsMap;
private String errorParserIds; private String errorParserIds;
private String extension; private String extension;
private boolean isAbstract = false; private boolean isAbstract = false;
@ -59,11 +57,11 @@ public class Target extends BuildObject implements ITarget {
private IResource owner; private IResource owner;
private ITarget parent; private ITarget parent;
private boolean resolved = true; private boolean resolved = true;
private List targetArchList; private List<String> targetArchList;
private List targetOSList; private List<String> targetOSList;
private List toolList; private List<ITool> toolList;
private Map toolMap; private Map<String, ITool> toolMap;
private List toolReferences; private List<ToolReference> toolReferences;
private ProjectType createdProjectType; private ProjectType createdProjectType;
private String scannerInfoCollectorId; private String scannerInfoCollectorId;
@ -125,7 +123,7 @@ public class Target extends BuildObject implements ITarget {
// Get the comma-separated list of valid OS // Get the comma-separated list of valid OS
String os = element.getAttribute(OS_LIST); String os = element.getAttribute(OS_LIST);
if (os != null) { if (os != null) {
targetOSList = new ArrayList(); targetOSList = new ArrayList<String>();
String[] osTokens = os.split(","); //$NON-NLS-1$ String[] osTokens = os.split(","); //$NON-NLS-1$
for (int i = 0; i < osTokens.length; ++i) { for (int i = 0; i < osTokens.length; ++i) {
targetOSList.add(osTokens[i].trim()); targetOSList.add(osTokens[i].trim());
@ -135,7 +133,7 @@ public class Target extends BuildObject implements ITarget {
// Get the comma-separated list of valid Architectures // Get the comma-separated list of valid Architectures
String arch = element.getAttribute(ARCH_LIST); String arch = element.getAttribute(ARCH_LIST);
if (arch != null) { if (arch != null) {
targetArchList = new ArrayList(); targetArchList = new ArrayList<String>();
String[] archTokens = arch.split(","); //$NON-NLS-1$ String[] archTokens = arch.split(","); //$NON-NLS-1$
for (int j = 0; j < archTokens.length; ++j) { for (int j = 0; j < archTokens.length; ++j) {
targetArchList.add(archTokens[j].trim()); targetArchList.add(archTokens[j].trim());
@ -303,7 +301,7 @@ public class Target extends BuildObject implements ITarget {
* *
* @param toolArray * @param toolArray
*/ */
private void addToolsToArray(Vector toolArray) { private void addToolsToArray(Vector<ITool> toolArray) {
if (parent != null) { if (parent != null) {
((Target)parent).addToolsToArray(toolArray); ((Target)parent).addToolsToArray(toolArray);
} }
@ -410,7 +408,7 @@ public class Target extends BuildObject implements ITarget {
* @see org.eclipse.cdt.core.build.managed.ITarget#getConfiguration() * @see org.eclipse.cdt.core.build.managed.ITarget#getConfiguration()
*/ */
public IConfigurationV2 getConfiguration(String id) { public IConfigurationV2 getConfiguration(String id) {
return (IConfigurationV2)getConfigurationMap().get(id); return getConfigurationMap().get(id);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -418,9 +416,9 @@ public class Target extends BuildObject implements ITarget {
* *
* @return List containing the configurations * @return List containing the configurations
*/ */
private List getConfigurationList() { private List<IConfigurationV2> getConfigurationList() {
if (configList == null) { if (configList == null) {
configList = new ArrayList(); configList = new ArrayList<IConfigurationV2>();
} }
return configList; return configList;
} }
@ -430,9 +428,9 @@ public class Target extends BuildObject implements ITarget {
* *
* @return * @return
*/ */
private Map getConfigurationMap() { private Map<String, IConfigurationV2> getConfigurationMap() {
if (configMap == null) { if (configMap == null) {
configMap = new HashMap(); configMap = new HashMap<String, IConfigurationV2>();
} }
return configMap; return configMap;
} }
@ -441,7 +439,7 @@ public class Target extends BuildObject implements ITarget {
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getConfigurations() * @see org.eclipse.cdt.managedbuilder.core.ITarget#getConfigurations()
*/ */
public IConfigurationV2[] getConfigurations() { public IConfigurationV2[] getConfigurations() {
return (IConfigurationV2[])getConfigurationList().toArray(new IConfigurationV2[getConfigurationList().size()]); return getConfigurationList().toArray(new IConfigurationV2[getConfigurationList().size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -451,12 +449,12 @@ public class Target extends BuildObject implements ITarget {
return defaultExtension == null ? EMPTY_STRING : defaultExtension; return defaultExtension == null ? EMPTY_STRING : defaultExtension;
} }
private Map getDepCalcMap() { // private Map getDepCalcMap() {
if (depCalculatorsMap == null) { // if (depCalculatorsMap == null) {
depCalculatorsMap = new HashMap(); // depCalculatorsMap = new HashMap();
} // }
return depCalculatorsMap; // return depCalculatorsMap;
} // }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getErrorParserIds() * @see org.eclipse.cdt.managedbuilder.core.ITarget#getErrorParserIds()
@ -483,17 +481,17 @@ public class Target extends BuildObject implements ITarget {
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 {
// If no error parsers are specified by the target, the default is // If no error parsers are specified by the target, the default is
// all error parsers // all error parsers
errorParsers = CCorePlugin.getDefault().getAllErrorParsersIDs(); errorParsers = ErrorParserManager.getErrorParserAvailableIds();
} }
return errorParsers; return errorParsers;
} }
@ -504,9 +502,9 @@ public class Target extends BuildObject implements ITarget {
* *
* @return List * @return List
*/ */
protected List getLocalToolReferences() { protected List<ToolReference> getLocalToolReferences() {
if (toolReferences == null) { if (toolReferences == null) {
toolReferences = new ArrayList(); toolReferences = new ArrayList<ToolReference>();
} }
return toolReferences; return toolReferences;
} }
@ -566,8 +564,8 @@ public class Target extends BuildObject implements ITarget {
* @param tool * @param tool
* @return List * @return List
*/ */
protected List getOptionReferences(ITool tool) { protected List<OptionReference> getOptionReferences(ITool tool) {
List references = new ArrayList(); List<OptionReference> references = new ArrayList<OptionReference>();
// Get all the option references I add for this tool // Get all the option references I add for this tool
ToolReference toolRef = getToolReference(tool); ToolReference toolRef = getToolReference(tool);
@ -577,10 +575,8 @@ public class Target extends BuildObject implements ITarget {
// See if there is anything that my parents add that I don't // See if there is anything that my parents add that I don't
if (parent != null) { if (parent != null) {
List temp = ((Target)parent).getOptionReferences(tool); List<OptionReference> refs = ((Target)parent).getOptionReferences(tool);
Iterator iter = temp.listIterator(); for (OptionReference ref : refs) {
while (iter.hasNext()) {
OptionReference ref = (OptionReference) iter.next();
if (!references.contains(ref)) { if (!references.contains(ref)) {
references.add(ref); references.add(ref);
} }
@ -617,7 +613,7 @@ public class Target extends BuildObject implements ITarget {
return new String[] {"all"}; //$NON-NLS-1$ return new String[] {"all"}; //$NON-NLS-1$
} }
} }
return (String[]) targetArchList.toArray(new String[targetArchList.size()]); return targetArchList.toArray(new String[targetArchList.size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -633,7 +629,7 @@ public class Target extends BuildObject implements ITarget {
return new String[] {"all"}; //$NON-NLS-1$ return new String[] {"all"}; //$NON-NLS-1$
} }
} }
return (String[]) targetOSList.toArray(new String[targetOSList.size()]); return targetOSList.toArray(new String[targetOSList.size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -643,7 +639,7 @@ public class Target extends BuildObject implements ITarget {
ITool result = null; ITool result = null;
// See if receiver has it in list // See if receiver has it in list
result = (ITool) getToolMap().get(id); result = getToolMap().get(id);
// If not, check if parent has it // If not, check if parent has it
if (result == null && parent != null) { if (result == null && parent != null) {
@ -663,9 +659,9 @@ public class Target extends BuildObject implements ITarget {
* target * target
* *
*/ */
private List getToolList() { private List<ITool> getToolList() {
if (toolList == null) { if (toolList == null) {
toolList = new ArrayList(); toolList = new ArrayList<ITool>();
} }
return toolList; return toolList;
} }
@ -674,9 +670,9 @@ public class Target extends BuildObject implements ITarget {
* A safe accessor for the tool map * A safe accessor for the tool map
* *
*/ */
private Map getToolMap() { private Map<String, ITool> getToolMap() {
if (toolMap == null) { if (toolMap == null) {
toolMap = new HashMap(); toolMap = new HashMap<String, ITool>();
} }
return toolMap; return toolMap;
} }
@ -692,9 +688,8 @@ public class Target extends BuildObject implements ITarget {
// See if the receiver has a reference to the tool // See if the receiver has a reference to the tool
ToolReference ref = null; ToolReference ref = null;
if (tool == null) return ref; if (tool == null) return ref;
Iterator iter = getLocalToolReferences().listIterator(); List<ToolReference> localToolReferences = getLocalToolReferences();
while (iter.hasNext()) { for (ToolReference temp : localToolReferences) {
ToolReference temp = (ToolReference)iter.next();
if (temp.references(tool)) { if (temp.references(tool)) {
ref = temp; ref = temp;
break; break;
@ -707,9 +702,9 @@ public class Target extends BuildObject implements ITarget {
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getTools() * @see org.eclipse.cdt.managedbuilder.core.ITarget#getTools()
*/ */
public ITool[] getTools() { public ITool[] getTools() {
Vector toolArray = new Vector(); Vector<ITool> toolArray = new Vector<ITool>();
addToolsToArray(toolArray); addToolsToArray(toolArray);
return (ITool[]) toolArray.toArray(new ITool[toolArray.size()]); return toolArray.toArray(new ITool[toolArray.size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -738,9 +733,9 @@ public class Target extends BuildObject implements ITarget {
} }
// Iterate over the configurations and ask them if they need saving // Iterate over the configurations and ask them if they need saving
Iterator iter = getConfigurationList().listIterator(); List<IConfigurationV2> configurationList = getConfigurationList();
while (iter.hasNext()) { for (IConfigurationV2 cfgV2 : configurationList) {
if (((IConfigurationV2)iter.next()).isDirty()) { if (cfgV2.isDirty()) {
return true; return true;
} }
} }
@ -760,9 +755,9 @@ public class Target extends BuildObject implements ITarget {
*/ */
public boolean needsRebuild(){ public boolean needsRebuild(){
// Iterate over the configurations and ask them if they need saving // Iterate over the configurations and ask them if they need saving
Iterator iter = getConfigurationList().listIterator(); List<IConfigurationV2> configurationList = getConfigurationList();
while (iter.hasNext()) { for (IConfigurationV2 cfgV2 : configurationList) {
if (((IConfigurationV2)iter.next()).needsRebuild()) { if (cfgV2.needsRebuild()) {
return true; return true;
} }
} }
@ -774,11 +769,10 @@ public class Target extends BuildObject implements ITarget {
*/ */
public void removeConfiguration(String id) { public void removeConfiguration(String id) {
// Remove the specified configuration from the list and map // Remove the specified configuration from the list and map
Iterator iter = getConfigurationList().listIterator(); List<IConfigurationV2> configurationList = getConfigurationList();
while (iter.hasNext()) { for (IConfigurationV2 config : configurationList) {
IConfigurationV2 config = (IConfigurationV2)iter.next();
if (config.getId().equals(id)) { if (config.getId().equals(id)) {
getConfigurationList().remove(config); configurationList.remove(config);
getConfigurationMap().remove(id); getConfigurationMap().remove(id);
isDirty = true; isDirty = true;
break; break;
@ -813,25 +807,23 @@ public class Target extends BuildObject implements ITarget {
((Target)parent).resolveReferences(); ((Target)parent).resolveReferences();
// copy over the parents configs // copy over the parents configs
IConfigurationV2[] parentConfigs = parent.getConfigurations(); IConfigurationV2[] parentConfigs = parent.getConfigurations();
for (int i = 0; i < parentConfigs.length; ++i) for (IConfigurationV2 cfgV2 : parentConfigs) {
addConfiguration(parentConfigs[i]); addConfiguration(cfgV2);
}
} }
// call resolve references on any children // call resolve references on any children
Iterator toolIter = getToolList().iterator(); List<ITool> toolList = getToolList();
while (toolIter.hasNext()) { for (ITool current : toolList) {
Tool current = (Tool)toolIter.next(); ((Tool)current).resolveReferences();
}
List<ToolReference> localToolReferences = getLocalToolReferences();
for (ToolReference current : localToolReferences) {
current.resolveReferences(); current.resolveReferences();
} }
Iterator refIter = getLocalToolReferences().iterator(); List<IConfigurationV2> configurationList = getConfigurationList();
while (refIter.hasNext()) { for (IConfigurationV2 current : configurationList) {
ToolReference current = (ToolReference)refIter.next(); ((ConfigurationV2)current).resolveReferences();
current.resolveReferences();
}
Iterator configIter = getConfigurationList().iterator();
while (configIter.hasNext()) {
ConfigurationV2 current = (ConfigurationV2)configIter.next();
current.resolveReferences();
} }
} }
} }
@ -868,12 +860,11 @@ public class Target extends BuildObject implements ITarget {
} }
// Serialize the configuration settings // Serialize the configuration settings
Iterator iter = getConfigurationList().listIterator(); List<IConfigurationV2> configurationList = getConfigurationList();
while (iter.hasNext()) { for (IConfigurationV2 config : configurationList) {
ConfigurationV2 config = (ConfigurationV2) iter.next();
Element configElement = doc.createElement(IConfigurationV2.CONFIGURATION_ELEMENT_NAME); Element configElement = doc.createElement(IConfigurationV2.CONFIGURATION_ELEMENT_NAME);
element.appendChild(configElement); element.appendChild(configElement);
config.serialize(doc, configElement); ((ConfigurationV2)config).serialize(doc, configElement);
} }
// I am clean now // I am clean now
@ -908,9 +899,8 @@ public class Target extends BuildObject implements ITarget {
// Override the dirty flag here // Override the dirty flag here
this.isDirty = isDirty; this.isDirty = isDirty;
// and in the configurations // and in the configurations
Iterator iter = getConfigurationList().listIterator(); List<IConfigurationV2> configurationList = getConfigurationList();
while (iter.hasNext()) { for (IConfigurationV2 config : configurationList) {
IConfigurationV2 config = (IConfigurationV2)iter.next();
config.setDirty(isDirty); config.setDirty(isDirty);
} }
} }
@ -953,9 +943,9 @@ public class Target extends BuildObject implements ITarget {
* @see org.eclipse.cdt.managedbuilder.core.ITarget#setRebuildState(boolean) * @see org.eclipse.cdt.managedbuilder.core.ITarget#setRebuildState(boolean)
*/ */
public void setRebuildState(boolean rebuild) { public void setRebuildState(boolean rebuild) {
Iterator iter = getConfigurationList().listIterator(); List<IConfigurationV2> configurationList = getConfigurationList();
while (iter.hasNext()) { for (IConfigurationV2 config : configurationList) {
((IConfigurationV2)iter.next()).setRebuildState(rebuild); config.setRebuildState(rebuild);
} }
} }
@ -993,9 +983,8 @@ public class Target extends BuildObject implements ITarget {
projectType.setIsTest(isTest); projectType.setIsTest(isTest);
// Add children // Add children
// Add configurations (Configuration -> ToolChain -> Builder -> TargetPlatform) // Add configurations (Configuration -> ToolChain -> Builder -> TargetPlatform)
Iterator iter = getConfigurationList().listIterator(); List<IConfigurationV2> configurationList = getConfigurationList();
while (iter.hasNext()) { for (IConfigurationV2 configV2 : configurationList) {
IConfigurationV2 configV2 = (IConfigurationV2)iter.next();
if (configV2.getCreatedConfig() != null) continue; if (configV2.getCreatedConfig() != null) continue;
// The new config's superClass needs to be the // The new config's superClass needs to be the
// Configuration created from the ConfigurationV2 parent... // Configuration created from the ConfigurationV2 parent...
@ -1056,7 +1045,7 @@ public class Target extends BuildObject implements ITarget {
IToolReference[] configToolRefs = configV2.getToolReferences(); IToolReference[] configToolRefs = configV2.getToolReferences();
// Add the "local" tool references (they are direct children of the target and // Add the "local" tool references (they are direct children of the target and
// its parent targets) // its parent targets)
Vector targetToolRefs = new Vector(); Vector<IToolReference> targetToolRefs = new Vector<IToolReference>();
addTargetToolReferences(targetToolRefs); addTargetToolReferences(targetToolRefs);
IToolReference[] toolRefs; IToolReference[] toolRefs;
if (targetToolRefs.size() > 0) { if (targetToolRefs.size() > 0) {
@ -1065,9 +1054,8 @@ public class Target extends BuildObject implements ITarget {
for (i = 0; i < configToolRefs.length; ++i) { for (i = 0; i < configToolRefs.length; ++i) {
toolRefs[i] = configToolRefs[i]; toolRefs[i] = configToolRefs[i];
} }
Iterator localToolRefIter = targetToolRefs.iterator(); for (IToolReference toolRef : targetToolRefs) {
while (localToolRefIter.hasNext()) { toolRefs[i++] = toolRef;
toolRefs[i++] = (IToolReference)localToolRefIter.next();
} }
} else { } else {
toolRefs = configToolRefs; toolRefs = configToolRefs;
@ -1083,9 +1071,8 @@ public class Target extends BuildObject implements ITarget {
newTool.setOutputFlag(toolRef.getRawOutputFlag()); newTool.setOutputFlag(toolRef.getRawOutputFlag());
newTool.setOutputsAttribute(toolRef.getRawOutputExtensions()); newTool.setOutputsAttribute(toolRef.getRawOutputExtensions());
// Handle ToolReference children (OptionReference) // Handle ToolReference children (OptionReference)
Iterator optRefIter = toolRef.getOptionReferenceList().listIterator(); List<OptionReference> optionReferenceList = toolRef.getOptionReferenceList();
while (optRefIter.hasNext()) { for (OptionReference optRef : optionReferenceList) {
OptionReference optRef = (OptionReference)optRefIter.next();
subId = id + "." + optRef.getId(); //$NON-NLS-1$ subId = id + "." + optRef.getId(); //$NON-NLS-1$
IOption newOption = newTool.createOption(optRef.getOption(), subId, optRef.getName(), true); IOption newOption = newTool.createOption(optRef.getOption(), subId, optRef.getName(), true);
// Set the option attributes // Set the option attributes

View file

@ -12,7 +12,6 @@ package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.settings.model.extension.CLanguageData; import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
@ -50,7 +49,7 @@ public class ToolReference implements IToolReference {
private String command; private String command;
private boolean isDirty = false; private boolean isDirty = false;
private List optionReferences; private List<OptionReference> optionReferences;
private IBuildObject owner; private IBuildObject owner;
private String outputExtensions; private String outputExtensions;
private String outputFlag; private String outputFlag;
@ -193,10 +192,8 @@ public class ToolReference implements IToolReference {
// Create a copy of the option references of the parent in the receiver // Create a copy of the option references of the parent in the receiver
if (tool instanceof ToolReference) { if (tool instanceof ToolReference) {
List parentRefs = ((ToolReference)tool).getOptionReferenceList(); List<OptionReference> parentRefs = ((ToolReference)tool).getOptionReferenceList();
Iterator iter = parentRefs.iterator(); for (OptionReference parent : parentRefs) {
while (iter.hasNext()) {
IOption parent = (IOption)iter.next();
OptionReference clone = createOptionReference(parent); OptionReference clone = createOptionReference(parent);
try { try {
switch (parent.getValueType()) { switch (parent.getValueType()) {
@ -265,9 +262,8 @@ public class ToolReference implements IToolReference {
((ToolReference)parent).resolveReferences(); ((ToolReference)parent).resolveReferences();
} }
Iterator it = getOptionReferenceList().iterator(); List<OptionReference> optionReferenceList = getOptionReferenceList();
while (it.hasNext()) { for (OptionReference optRef : optionReferenceList) {
OptionReference optRef = (OptionReference)it.next();
optRef.resolveReferences(); optRef.resolveReferences();
} }
} }
@ -327,7 +323,7 @@ public class ToolReference implements IToolReference {
/* (non-Javadoc) /* (non-Javadoc)
* @return * @return
*/ */
protected List getAllOptionRefs() { protected List<OptionReference> getAllOptionRefs() {
// First get all the option references this tool reference contains // First get all the option references this tool reference contains
if (owner instanceof ConfigurationV2) { if (owner instanceof ConfigurationV2) {
return ((ConfigurationV2)owner).getOptionReferences(parent); return ((ConfigurationV2)owner).getOptionReferences(parent);
@ -364,9 +360,9 @@ public class ToolReference implements IToolReference {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITool#getInputExtensions() * @see org.eclipse.cdt.managedbuilder.core.ITool#getInputExtensions()
*/ */
public List getInputExtensions() { public List<String> getInputExtensions() {
String[] exts = getPrimaryInputExtensions(); String[] exts = getPrimaryInputExtensions();
List extList = new ArrayList(); List<String> extList = new ArrayList<String>();
for (int i=0; i<exts.length; i++) { for (int i=0; i<exts.length; i++) {
extList.add(exts[i]); extList.add(exts[i]);
} }
@ -432,8 +428,8 @@ public class ToolReference implements IToolReference {
/* (non-Javadoc) /* (non-Javadoc)
* @return * @return
*/ */
private List getOutputsList() { private List<String> getOutputsList() {
ArrayList answer = new ArrayList(); ArrayList<String> answer = new ArrayList<String>();
if (outputExtensions != null) { if (outputExtensions != null) {
String[] exts = outputExtensions.split(DEFAULT_SEPARATOR); String[] exts = outputExtensions.split(DEFAULT_SEPARATOR);
answer.addAll(Arrays.asList(exts)); answer.addAll(Arrays.asList(exts));
@ -574,9 +570,8 @@ public class ToolReference implements IToolReference {
*/ */
private OptionReference getOptionReference(IOption option) { private OptionReference getOptionReference(IOption option) {
// Get all the option references for this option // Get all the option references for this option
Iterator iter = getAllOptionRefs().listIterator(); List<OptionReference> allOptionRefs = getAllOptionRefs();
while (iter.hasNext()) { for (OptionReference optionRef : allOptionRefs) {
OptionReference optionRef = (OptionReference) iter.next();
if (optionRef.references(option)) if (optionRef.references(option))
return optionRef; return optionRef;
} }
@ -605,9 +600,9 @@ public class ToolReference implements IToolReference {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IToolReference#getOptionReferenceList() * @see org.eclipse.cdt.managedbuilder.core.IToolReference#getOptionReferenceList()
*/ */
public List getOptionReferenceList() { public List<OptionReference> getOptionReferenceList() {
if (optionReferences == null) { if (optionReferences == null) {
optionReferences = new ArrayList(); optionReferences = new ArrayList<OptionReference>();
} }
return optionReferences; return optionReferences;
} }
@ -747,9 +742,8 @@ public class ToolReference implements IToolReference {
} }
// Output the option references // Output the option references
Iterator iter = getOptionReferenceList().listIterator(); List<OptionReference> optionReferenceList = getOptionReferenceList();
while (iter.hasNext()) { for (OptionReference optionRef : optionReferenceList) {
OptionReference optionRef = (OptionReference) iter.next();
Element optionRefElement = doc.createElement(ITool.OPTION_REF); Element optionRefElement = doc.createElement(ITool.OPTION_REF);
element.appendChild(optionRefElement); element.appendChild(optionRefElement);
optionRef.serialize(doc, optionRefElement); optionRef.serialize(doc, optionRefElement);