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

cleanup: Java generics warnings

This commit is contained in:
Andrew Gvozdev 2009-09-11 22:20:39 +00:00
parent a86e6485f4
commit 198d23ed16

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.StringTokenizer; import java.util.StringTokenizer;
import java.util.Vector; import java.util.Vector;
@ -53,8 +52,8 @@ public class InputType extends BuildObject implements IInputType {
private String superClassId; private String superClassId;
// Parent and children // Parent and children
private ITool parent; private ITool parent;
private Vector inputOrderList; private Vector<InputOrder> inputOrderList;
private Vector additionalInputList; private Vector<AdditionalInput> additionalInputList;
// Managed Build model attributes // Managed Build model attributes
private String[] sourceContentTypeIds; private String[] sourceContentTypeIds;
private IContentType[] sourceContentTypes; private IContentType[] sourceContentTypes;
@ -64,7 +63,7 @@ public class InputType extends BuildObject implements IInputType {
private String[] headerExtensions; private String[] headerExtensions;
private String dependencyContentTypeId; private String dependencyContentTypeId;
private IContentType dependencyContentType; private IContentType dependencyContentType;
private List dependencyExtensions; private List<String> dependencyExtensions;
private String optionId; private String optionId;
private String assignToOptionId; private String assignToOptionId;
private String buildVariable; private String buildVariable;
@ -145,11 +144,11 @@ public class InputType extends BuildObject implements IInputType {
* This constructor is called to create an InputType whose attributes and children will be * This constructor is called to create an InputType whose attributes and children will be
* added by separate calls. * added by separate calls.
* *
* @param Tool The parent of the an InputType * @param parent - The parent of the an InputType
* @param InputType The superClass, if any * @param superClass - The superClass, if any
* @param String The id for the new InputType * @param Id - The id for the new InputType
* @param String The name for the new InputType * @param name - The name for the new InputType
* @param boolean Indicates whether this is an extension element or a managed project element * @param isExtensionElement - Indicates whether this is an extension element or a managed project element
*/ */
public InputType(Tool parent, IInputType superClass, String Id, String name, boolean isExtensionElement) { public InputType(Tool parent, IInputType superClass, String Id, String name, boolean isExtensionElement) {
this.parent = parent; this.parent = parent;
@ -246,7 +245,7 @@ public class InputType extends BuildObject implements IInputType {
} }
dependencyContentType = inputType.dependencyContentType; dependencyContentType = inputType.dependencyContentType;
if (inputType.dependencyExtensions != null) { if (inputType.dependencyExtensions != null) {
dependencyExtensions = new ArrayList(inputType.dependencyExtensions); dependencyExtensions = new ArrayList<String>(inputType.dependencyExtensions);
} }
if (inputType.optionId != null) { if (inputType.optionId != null) {
optionId = new String(inputType.optionId); optionId = new String(inputType.optionId);
@ -274,17 +273,13 @@ public class InputType extends BuildObject implements IInputType {
// Clone the children // Clone the children
if (inputType.inputOrderList != null) { if (inputType.inputOrderList != null) {
Iterator iter = inputType.getInputOrderList().listIterator(); for (InputOrder inputOrder : inputType.getInputOrderList()) {
while (iter.hasNext()) {
InputOrder inputOrder = (InputOrder) iter.next();
InputOrder newInputOrder = new InputOrder(this, inputOrder); InputOrder newInputOrder = new InputOrder(this, inputOrder);
getInputOrderList().add(newInputOrder); getInputOrderList().add(newInputOrder);
} }
} }
if (inputType.additionalInputList != null) { if (inputType.additionalInputList != null) {
Iterator iter = inputType.getAdditionalInputList().listIterator(); for (AdditionalInput additionalInput : inputType.getAdditionalInputList()) {
while (iter.hasNext()) {
AdditionalInput additionalInput = (AdditionalInput) iter.next();
AdditionalInput newAdditionalInput = new AdditionalInput(this, additionalInput); AdditionalInput newAdditionalInput = new AdditionalInput(this, additionalInput);
getAdditionalInputList().add(newAdditionalInput); getAdditionalInputList().add(newAdditionalInput);
} }
@ -322,15 +317,15 @@ public class InputType extends BuildObject implements IInputType {
superClassId = element.getAttribute(IProjectType.SUPERCLASS); superClassId = element.getAttribute(IProjectType.SUPERCLASS);
// sourceContentType // sourceContentType
List list = new ArrayList(); List<String> list = new ArrayList<String>();
String ids = element.getAttribute(IInputType.SOURCE_CONTENT_TYPE); String ids = element.getAttribute(IInputType.SOURCE_CONTENT_TYPE);
if(ids != null){ if(ids != null){
StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add(tokenizer.nextElement()); list.add(tokenizer.nextToken());
} }
if(list.size() != 0){ if(list.size() != 0){
sourceContentTypeIds = (String[])list.toArray(new String[list.size()]); sourceContentTypeIds = list.toArray(new String[list.size()]);
list.clear(); list.clear();
} }
} }
@ -340,11 +335,11 @@ public class InputType extends BuildObject implements IInputType {
if (inputs != null) { if (inputs != null) {
StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add(tokenizer.nextElement()); list.add(tokenizer.nextToken());
} }
if(list.size() != 0){ if(list.size() != 0){
inputExtensions = (String[])list.toArray(new String[list.size()]); inputExtensions = list.toArray(new String[list.size()]);
list.clear(); list.clear();
} }
} }
@ -354,10 +349,10 @@ public class InputType extends BuildObject implements IInputType {
if(ids != null){ if(ids != null){
StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add(tokenizer.nextElement()); list.add(tokenizer.nextToken());
} }
if(list.size() != 0){ if(list.size() != 0){
headerContentTypeIds = (String[])list.toArray(new String[list.size()]); headerContentTypeIds = list.toArray(new String[list.size()]);
list.clear(); list.clear();
} }
} }
@ -367,11 +362,11 @@ public class InputType extends BuildObject implements IInputType {
if (hs != null) { if (hs != null) {
StringTokenizer tokenizer = new StringTokenizer(hs, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(hs, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add(tokenizer.nextElement()); list.add(tokenizer.nextToken());
} }
if(list.size() != 0){ if(list.size() != 0){
headerExtensions = (String[])list.toArray(new String[list.size()]); headerExtensions = list.toArray(new String[list.size()]);
list.clear(); list.clear();
} }
} }
@ -384,7 +379,7 @@ public class InputType extends BuildObject implements IInputType {
if (headers != null) { if (headers != null) {
StringTokenizer tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
getDependencyExtensionsList().add(tokenizer.nextElement()); getDependencyExtensionsList().add(tokenizer.nextToken());
} }
} }
@ -453,30 +448,30 @@ public class InputType extends BuildObject implements IInputType {
// sourceContentType // sourceContentType
IContentTypeManager manager = Platform.getContentTypeManager(); IContentTypeManager manager = Platform.getContentTypeManager();
List list = new ArrayList(); List<String> list = new ArrayList<String>();
if (element.getAttribute(IInputType.SOURCE_CONTENT_TYPE) != null) { if (element.getAttribute(IInputType.SOURCE_CONTENT_TYPE) != null) {
String ids = element.getAttribute(IInputType.SOURCE_CONTENT_TYPE); String ids = element.getAttribute(IInputType.SOURCE_CONTENT_TYPE);
if (ids != null) { if (ids != null) {
StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add(tokenizer.nextElement()); list.add(tokenizer.nextToken());
} }
if(list.size() != 0){ if(list.size() != 0){
sourceContentTypeIds = (String[])list.toArray(new String[list.size()]); sourceContentTypeIds = list.toArray(new String[list.size()]);
list.clear(); list.clear();
} }
if(sourceContentTypeIds != null){ if(sourceContentTypeIds != null){
List<IContentType> types = new ArrayList<IContentType>();
for (String sourceContentTypeId : sourceContentTypeIds) { for (String sourceContentTypeId : sourceContentTypeIds) {
IContentType type = manager.getContentType(sourceContentTypeId); IContentType type = manager.getContentType(sourceContentTypeId);
if(type != null) if(type != null)
list.add(type); types.add(type);
} }
if(list.size() != 0){ if(types.size() != 0){
sourceContentTypes = (IContentType[])list.toArray(new IContentType[list.size()]); sourceContentTypes = types.toArray(new IContentType[types.size()]);
list.clear();
} }
} }
} }
@ -488,11 +483,11 @@ public class InputType extends BuildObject implements IInputType {
if (inputs != null) { if (inputs != null) {
StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add(tokenizer.nextElement()); list.add(tokenizer.nextToken());
} }
if(list.size() != 0){ if(list.size() != 0){
inputExtensions = (String[])list.toArray(new String[list.size()]); inputExtensions = list.toArray(new String[list.size()]);
list.clear(); list.clear();
} }
} }
@ -504,24 +499,24 @@ public class InputType extends BuildObject implements IInputType {
if (ids != null) { if (ids != null) {
StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add(tokenizer.nextElement()); list.add(tokenizer.nextToken());
} }
if(list.size() != 0){ if(list.size() != 0){
headerContentTypeIds = (String[])list.toArray(new String[list.size()]); headerContentTypeIds = list.toArray(new String[list.size()]);
list.clear(); list.clear();
} }
if(headerContentTypeIds != null){ if(headerContentTypeIds != null){
List<IContentType> types = new ArrayList<IContentType>();
for (String headerContentTypeId : headerContentTypeIds) { for (String headerContentTypeId : headerContentTypeIds) {
IContentType type = manager.getContentType(headerContentTypeId); IContentType type = manager.getContentType(headerContentTypeId);
if(type != null) if(type != null)
list.add(type); types.add(type);
} }
if(list.size() != 0){ if(types.size() != 0){
headerContentTypes = (IContentType[])list.toArray(new IContentType[list.size()]); headerContentTypes = types.toArray(new IContentType[types.size()]);
list.clear();
} }
} }
} }
@ -533,11 +528,11 @@ public class InputType extends BuildObject implements IInputType {
if (inputs != null) { if (inputs != null) {
StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add(tokenizer.nextElement()); list.add(tokenizer.nextToken());
} }
if(list.size() != 0){ if(list.size() != 0){
headerExtensions = (String[])list.toArray(new String[list.size()]); headerExtensions = list.toArray(new String[list.size()]);
list.clear(); list.clear();
} }
} }
@ -558,7 +553,7 @@ public class InputType extends BuildObject implements IInputType {
if (headers != null) { if (headers != null) {
StringTokenizer tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
getDependencyExtensionsList().add(tokenizer.nextElement()); getDependencyExtensionsList().add(tokenizer.nextToken());
} }
} }
} }
@ -625,7 +620,6 @@ public class InputType extends BuildObject implements IInputType {
/** /**
* Persist the InputType to the project file. * Persist the InputType to the project file.
* *
* @param doc
* @param element * @param element
*/ */
public void serialize(ICStorageElement element) { public void serialize(ICStorageElement element) {
@ -669,13 +663,11 @@ public class InputType extends BuildObject implements IInputType {
// dependency (header file) extensions // dependency (header file) extensions
if (getDependencyExtensionsList().size() > 0) { if (getDependencyExtensionsList().size() > 0) {
String headers; String headers=""; //$NON-NLS-1$
List list = getDependencyExtensionsList(); for (String header : getDependencyExtensionsList()) {
Iterator iter = list.listIterator(); if (headers.length()>0)
headers = (String)iter.next();
while (iter.hasNext()) {
headers += DEFAULT_SEPARATOR; headers += DEFAULT_SEPARATOR;
headers += iter.next(); headers += header;
} }
element.setAttribute(IInputType.DEPENDENCY_EXTENSIONS, headers); element.setAttribute(IInputType.DEPENDENCY_EXTENSIONS, headers);
} }
@ -716,17 +708,11 @@ public class InputType extends BuildObject implements IInputType {
} }
// Serialize my children // Serialize my children
List childElements = getInputOrderList(); for (InputOrder io : getInputOrderList()) {
Iterator iter = childElements.listIterator();
while (iter.hasNext()) {
InputOrder io = (InputOrder) iter.next();
ICStorageElement ioElement = element.createChild(IInputOrder.INPUT_ORDER_ELEMENT_NAME); ICStorageElement ioElement = element.createChild(IInputOrder.INPUT_ORDER_ELEMENT_NAME);
io.serialize(ioElement); io.serialize(ioElement);
} }
childElements = getAdditionalInputList(); for (AdditionalInput ai : getAdditionalInputList()) {
iter = childElements.listIterator();
while (iter.hasNext()) {
AdditionalInput ai = (AdditionalInput) iter.next();
ICStorageElement aiElement = element.createChild(IAdditionalInput.ADDITIONAL_INPUT_ELEMENT_NAME); ICStorageElement aiElement = element.createChild(IAdditionalInput.ADDITIONAL_INPUT_ELEMENT_NAME);
ai.serialize(aiElement); ai.serialize(aiElement);
} }
@ -761,10 +747,7 @@ public class InputType extends BuildObject implements IInputType {
* @see org.eclipse.cdt.core.build.managed.IInputType#getInputOrders() * @see org.eclipse.cdt.core.build.managed.IInputType#getInputOrders()
*/ */
public IInputOrder[] getInputOrders() { public IInputOrder[] getInputOrders() {
IInputOrder[] orders; return getInputOrderList().toArray(new IInputOrder[0]);
Vector ours = getInputOrderList();
orders = (IInputOrder[])ours.toArray(new IInputOrder[ours.size()]);
return orders;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -772,10 +755,7 @@ public class InputType extends BuildObject implements IInputType {
*/ */
public IInputOrder getInputOrder(String path) { public IInputOrder getInputOrder(String path) {
// TODO Convert both paths to absolute? // TODO Convert both paths to absolute?
List orders = getInputOrderList(); for (InputOrder io : getInputOrderList()) {
Iterator iter = orders.listIterator();
while (iter.hasNext()) {
InputOrder io = (InputOrder) iter.next();
if (path.compareToIgnoreCase(io.getPath()) != 0) { if (path.compareToIgnoreCase(io.getPath()) != 0) {
return io; return io;
} }
@ -821,10 +801,7 @@ public class InputType extends BuildObject implements IInputType {
* @see org.eclipse.cdt.core.build.managed.IInputType#getAdditionalInputs() * @see org.eclipse.cdt.core.build.managed.IInputType#getAdditionalInputs()
*/ */
public IAdditionalInput[] getAdditionalInputs() { public IAdditionalInput[] getAdditionalInputs() {
IAdditionalInput[] inputs; return getAdditionalInputList().toArray(new IAdditionalInput[0]);
Vector ours = getAdditionalInputList();
inputs = (IAdditionalInput[])ours.toArray(new IAdditionalInput[ours.size()]);
return inputs;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -834,10 +811,7 @@ public class InputType extends BuildObject implements IInputType {
// TODO Convert both paths to absolute? // TODO Convert both paths to absolute?
// Must match all strings // Must match all strings
String[] inputTokens = paths.split(";"); //$NON-NLS-1$ String[] inputTokens = paths.split(";"); //$NON-NLS-1$
List inputs = getInputOrderList(); for (AdditionalInput ai : getAdditionalInputList()) {
Iterator iter = inputs.listIterator();
while (iter.hasNext()) {
AdditionalInput ai = (AdditionalInput) iter.next();
boolean match = false; boolean match = false;
String[] tokens = ai.getPaths(); String[] tokens = ai.getPaths();
if (tokens.length == inputTokens.length) { if (tokens.length == inputTokens.length) {
@ -874,14 +848,12 @@ public class InputType extends BuildObject implements IInputType {
* @see org.eclipse.cdt.core.build.managed.IInputType#getAdditionalDependencies() * @see org.eclipse.cdt.core.build.managed.IInputType#getAdditionalDependencies()
*/ */
public IPath[] getAdditionalDependencies() { public IPath[] getAdditionalDependencies() {
List deps = new ArrayList(); List<IPath> deps = new ArrayList<IPath>();
Iterator typeIter = getAdditionalInputList().iterator(); for (AdditionalInput additionalInput : getAdditionalInputList()) {
while (typeIter.hasNext()) { int kind = additionalInput.getKind();
AdditionalInput current = (AdditionalInput)typeIter.next();
int kind = current.getKind();
if (kind == IAdditionalInput.KIND_ADDITIONAL_DEPENDENCY || if (kind == IAdditionalInput.KIND_ADDITIONAL_DEPENDENCY ||
kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) { kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
String[] paths = current.getPaths(); String[] paths = additionalInput.getPaths();
if (paths != null) { if (paths != null) {
for (String path : paths) { for (String path : paths) {
if (path.length() > 0) { if (path.length() > 0) {
@ -891,21 +863,19 @@ public class InputType extends BuildObject implements IInputType {
} }
} }
} }
return (IPath[])deps.toArray(new IPath[deps.size()]); return deps.toArray(new IPath[deps.size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IInputType#getAdditionalResources() * @see org.eclipse.cdt.core.build.managed.IInputType#getAdditionalResources()
*/ */
public IPath[] getAdditionalResources() { public IPath[] getAdditionalResources() {
List ins = new ArrayList(); List<IPath> ins = new ArrayList<IPath>();
Iterator typeIter = getAdditionalInputList().iterator(); for (AdditionalInput additionalInput : getAdditionalInputList()) {
while (typeIter.hasNext()) { int kind = additionalInput.getKind();
AdditionalInput current = (AdditionalInput)typeIter.next();
int kind = current.getKind();
if (kind == IAdditionalInput.KIND_ADDITIONAL_INPUT || if (kind == IAdditionalInput.KIND_ADDITIONAL_INPUT ||
kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) { kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
String[] paths = current.getPaths(); String[] paths = additionalInput.getPaths();
if (paths != null) { if (paths != null) {
for (String path : paths) { for (String path : paths) {
if (path.length() > 0) { if (path.length() > 0) {
@ -915,15 +885,15 @@ public class InputType extends BuildObject implements IInputType {
} }
} }
} }
return (IPath[])ins.toArray(new IPath[ins.size()]); return ins.toArray(new IPath[ins.size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)
* Memory-safe way to access the list of input orders * Memory-safe way to access the list of input orders
*/ */
private Vector getInputOrderList() { private Vector<InputOrder> getInputOrderList() {
if (inputOrderList == null) { if (inputOrderList == null) {
inputOrderList = new Vector(); inputOrderList = new Vector<InputOrder>();
} }
return inputOrderList; return inputOrderList;
} }
@ -931,9 +901,9 @@ public class InputType extends BuildObject implements IInputType {
/* (non-Javadoc) /* (non-Javadoc)
* Memory-safe way to access the list of input orders * Memory-safe way to access the list of input orders
*/ */
private Vector getAdditionalInputList() { private Vector<AdditionalInput> getAdditionalInputList() {
if (additionalInputList == null) { if (additionalInputList == null) {
additionalInputList = new Vector(); additionalInputList = new Vector<AdditionalInput>();
} }
return additionalInputList; return additionalInputList;
} }
@ -1025,11 +995,11 @@ public class InputType extends BuildObject implements IInputType {
return superClass.getDependencyExtensionsAttribute(); return superClass.getDependencyExtensionsAttribute();
} else { } else {
if (dependencyExtensions == null) { if (dependencyExtensions == null) {
dependencyExtensions = new ArrayList(); dependencyExtensions = new ArrayList<String>();
} }
} }
} }
return (String[])dependencyExtensions.toArray(new String[dependencyExtensions.size()]); return dependencyExtensions.toArray(new String[dependencyExtensions.size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -1040,7 +1010,7 @@ public class InputType extends BuildObject implements IInputType {
if (extensions != null) { if (extensions != null) {
StringTokenizer tokenizer = new StringTokenizer(extensions, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(extensions, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
getDependencyExtensionsList().add(tokenizer.nextElement()); getDependencyExtensionsList().add(tokenizer.nextToken());
} }
} }
setDirty(true); setDirty(true);
@ -1092,9 +1062,9 @@ public class InputType extends BuildObject implements IInputType {
return false; return false;
} }
private List getDependencyExtensionsList() { private List<String> getDependencyExtensionsList() {
if (dependencyExtensions == null) { if (dependencyExtensions == null) {
dependencyExtensions = new ArrayList(); dependencyExtensions = new ArrayList<String>();
} }
return dependencyExtensions; return dependencyExtensions;
} }
@ -1422,15 +1392,13 @@ public class InputType extends BuildObject implements IInputType {
setRebuildState(true); setRebuildState(true);
} }
} else { } else {
List list = new ArrayList(); List<String> list = new ArrayList<String>();
if (extensions != null) {
StringTokenizer tokenizer = new StringTokenizer(extensions, DEFAULT_SEPARATOR); StringTokenizer tokenizer = new StringTokenizer(extensions, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add(tokenizer.nextElement()); list.add(tokenizer.nextToken());
}
} }
String[] newExts = (String[])list.toArray(new String[list.size()]); String[] newExts = list.toArray(new String[list.size()]);
if(!Arrays.equals(newExts, inputExtensions)){ if(!Arrays.equals(newExts, inputExtensions)){
inputExtensions = newExts; inputExtensions = newExts;
setDirty(true); setDirty(true);
@ -1462,11 +1430,11 @@ public class InputType extends BuildObject implements IInputType {
// Use content type if specified and registered with Eclipse // Use content type if specified and registered with Eclipse
IContentType types[] = getSourceContentTypes(); IContentType types[] = getSourceContentTypes();
if (types.length != 0) { if (types.length != 0) {
List list = new ArrayList(); List<String> list = new ArrayList<String>();
for (IContentType type : types) { for (IContentType type : types) {
list.addAll(Arrays.asList(((Tool)tool).getContentTypeFileSpecs(type, project))); list.addAll(Arrays.asList(((Tool)tool).getContentTypeFileSpecs(type, project)));
} }
return (String[])list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
return getSourceExtensionsAttribute(); return getSourceExtensionsAttribute();
} }
@ -1475,11 +1443,11 @@ public class InputType extends BuildObject implements IInputType {
public String[] getHeaderExtensions(ITool tool) { public String[] getHeaderExtensions(ITool tool) {
IContentType types[] = getHeaderContentTypes(); IContentType types[] = getHeaderContentTypes();
if (types.length != 0) { if (types.length != 0) {
List list = new ArrayList(); List<String> list = new ArrayList<String>();
for (IContentType type : types) { for (IContentType type : types) {
list.addAll(Arrays.asList(((Tool)tool).getContentTypeFileSpecs(type))); list.addAll(Arrays.asList(((Tool)tool).getContentTypeFileSpecs(type)));
} }
return (String[])list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
return getHeaderExtensionsAttribute(); return getHeaderExtensionsAttribute();
} }
@ -1518,15 +1486,11 @@ public class InputType extends BuildObject implements IInputType {
if (isExtensionInputType) return false; if (isExtensionInputType) return false;
// Check my children // Check my children
Iterator typeIter = getInputOrderList().iterator(); for (InputOrder inputOrder : getInputOrderList()) {
while (typeIter.hasNext()) { if (inputOrder.isDirty()) return true;
InputOrder current = (InputOrder)typeIter.next();
if (current.isDirty()) return true;
} }
typeIter = getAdditionalInputList().iterator(); for (AdditionalInput additionalInput : getAdditionalInputList()) {
while (typeIter.hasNext()) { if (additionalInput.isDirty()) return true;
AdditionalInput current = (AdditionalInput)typeIter.next();
if (current.isDirty()) return true;
} }
return isDirty; return isDirty;
@ -1539,15 +1503,11 @@ public class InputType extends BuildObject implements IInputType {
this.isDirty = isDirty; this.isDirty = isDirty;
// Propagate "false" to the children // Propagate "false" to the children
if (!isDirty) { if (!isDirty) {
Iterator typeIter = getInputOrderList().iterator(); for (InputOrder inputOrder : getInputOrderList()) {
while (typeIter.hasNext()) { inputOrder.setDirty(false);
InputOrder current = (InputOrder)typeIter.next();
current.setDirty(false);
} }
typeIter = getAdditionalInputList().iterator(); for (AdditionalInput additionalInput : getAdditionalInputList()) {
while (typeIter.hasNext()) { additionalInput.setDirty(false);
AdditionalInput current = (AdditionalInput)typeIter.next();
current.setDirty(false);
} }
} }
} }
@ -1573,7 +1533,7 @@ public class InputType extends BuildObject implements IInputType {
// Resolve content types // Resolve content types
IContentTypeManager manager = Platform.getContentTypeManager(); IContentTypeManager manager = Platform.getContentTypeManager();
List list = new ArrayList(); List<IContentType> list = new ArrayList<IContentType>();
if (sourceContentTypeIds != null) { if (sourceContentTypeIds != null) {
for (String sourceContentTypeId : sourceContentTypeIds) { for (String sourceContentTypeId : sourceContentTypeIds) {
IContentType type = manager.getContentType(sourceContentTypeId); IContentType type = manager.getContentType(sourceContentTypeId);
@ -1581,7 +1541,7 @@ public class InputType extends BuildObject implements IInputType {
list.add(type); list.add(type);
} }
if(list.size() != 0){ if(list.size() != 0){
sourceContentTypes = (IContentType[])list.toArray(new IContentType[list.size()]); sourceContentTypes = list.toArray(new IContentType[list.size()]);
list.clear(); list.clear();
} else { } else {
sourceContentTypes = new IContentType[0]; sourceContentTypes = new IContentType[0];
@ -1595,7 +1555,7 @@ public class InputType extends BuildObject implements IInputType {
list.add(type); list.add(type);
} }
if(list.size() != 0){ if(list.size() != 0){
headerContentTypes = (IContentType[])list.toArray(new IContentType[list.size()]); headerContentTypes = list.toArray(new IContentType[list.size()]);
list.clear(); list.clear();
} else { } else {
headerContentTypes = new IContentType[0]; headerContentTypes = new IContentType[0];
@ -1607,15 +1567,11 @@ public class InputType extends BuildObject implements IInputType {
} }
// Call resolveReferences on our children // Call resolveReferences on our children
Iterator typeIter = getInputOrderList().iterator(); for (InputOrder inputOrder : getInputOrderList()) {
while (typeIter.hasNext()) { inputOrder.resolveReferences();
InputOrder current = (InputOrder)typeIter.next();
current.resolveReferences();
} }
typeIter = getAdditionalInputList().iterator(); for (AdditionalInput additionalInput : getAdditionalInputList()) {
while (typeIter.hasNext()) { additionalInput.resolveReferences();
AdditionalInput current = (AdditionalInput)typeIter.next();
current.resolveReferences();
} }
} }
} }
@ -1655,15 +1611,11 @@ public class InputType extends BuildObject implements IInputType {
if(rebuildState) if(rebuildState)
return true; return true;
Iterator typeIter = getInputOrderList().iterator(); for (InputOrder inputOrder : getInputOrderList()) {
while (typeIter.hasNext()) { if (inputOrder.needsRebuild()) return true;
InputOrder current = (InputOrder)typeIter.next();
if (current.needsRebuild()) return true;
} }
typeIter = getAdditionalInputList().iterator(); for (AdditionalInput additionalInput : getAdditionalInputList()) {
while (typeIter.hasNext()) { if (additionalInput.needsRebuild()) return true;
AdditionalInput current = (AdditionalInput)typeIter.next();
if (current.needsRebuild()) return true;
} }
return rebuildState; return rebuildState;
@ -1677,18 +1629,13 @@ public class InputType extends BuildObject implements IInputType {
// Propagate "false" to the children // Propagate "false" to the children
if (!rebuild) { if (!rebuild) {
Iterator typeIter = getInputOrderList().iterator(); for (InputOrder inputOrder : getInputOrderList()) {
while (typeIter.hasNext()) { inputOrder.setRebuildState(false);
InputOrder current = (InputOrder)typeIter.next();
current.setRebuildState(false);
} }
typeIter = getAdditionalInputList().iterator(); for (AdditionalInput additionalInput : getAdditionalInputList()) {
while (typeIter.hasNext()) { additionalInput.setRebuildState(false);
AdditionalInput current = (AdditionalInput)typeIter.next();
current.setRebuildState(false);
} }
} }
} }
public IResourceInfo getRcInfo(ITool tool) { public IResourceInfo getRcInfo(ITool tool) {