1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-21 16:05:25 +02:00

cleanup: generics

This commit is contained in:
Andrew Gvozdev 2010-02-09 02:01:02 +00:00
parent ec0f826863
commit e17ccaca75

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2009 IBM Corporation and others. * Copyright (c) 2003, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -14,9 +14,7 @@ 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.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.ListIterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -57,16 +55,16 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
private String unusedChildren; private String unusedChildren;
private Integer browseType; private Integer browseType;
private String[] browseFilterExtensions; private String[] browseFilterExtensions;
private List builtIns; private List<OptionStringValue> builtIns;
private IOptionCategory category; private IOptionCategory category;
private String categoryId; private String categoryId;
private String command; private String command;
private String commandFalse; private String commandFalse;
private String tip; private String tip;
private String contextId; private String contextId;
private List enumList; private List<String> enumList;
private Map enumCommands; private Map<String, String> enumCommands;
private Map enumNames; private Map<String, String> enumNames;
private Object value; private Object value;
private Object defaultValue; private Object defaultValue;
private Integer valueType; private Integer valueType;
@ -198,7 +196,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
categoryId = new String(option.categoryId); categoryId = new String(option.categoryId);
} }
if (option.builtIns != null) { if (option.builtIns != null) {
builtIns = new ArrayList(option.builtIns); builtIns = new ArrayList<OptionStringValue>(option.builtIns);
} }
if (option.browseType != null) { if (option.browseType != null) {
browseType = new Integer(option.browseType.intValue()); browseType = new Integer(option.browseType.intValue());
@ -210,9 +208,9 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
resourceFilter = new Integer(option.resourceFilter.intValue()); resourceFilter = new Integer(option.resourceFilter.intValue());
} }
if (option.enumList != null) { if (option.enumList != null) {
enumList = new ArrayList(option.enumList); enumList = new ArrayList<String>(option.enumList);
enumCommands = new HashMap(option.enumCommands); enumCommands = new HashMap<String, String>(option.enumCommands);
enumNames = new HashMap(option.enumNames); enumNames = new HashMap<String, String>(option.enumNames);
} }
if (option.valueType != null) { if (option.valueType != null) {
@ -221,7 +219,6 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
Integer vType = null; Integer vType = null;
try { try {
vType = new Integer(option.getValueType()); vType = new Integer(option.getValueType());
if (vType != null) {
switch (vType.intValue()) { switch (vType.intValue()) {
case BOOLEAN: case BOOLEAN:
if (option.value != null) { if (option.value != null) {
@ -256,14 +253,13 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
case UNDEF_LIBRARY_FILES: case UNDEF_LIBRARY_FILES:
case UNDEF_MACRO_FILES: case UNDEF_MACRO_FILES:
if (option.value != null) { if (option.value != null) {
value = new ArrayList((ArrayList)option.value); value = new ArrayList<OptionStringValue>((ArrayList<OptionStringValue>)option.value);
} }
if (option.defaultValue != null) { if (option.defaultValue != null) {
defaultValue = new ArrayList((ArrayList)option.defaultValue); defaultValue = new ArrayList<OptionStringValue>((ArrayList<OptionStringValue>)option.defaultValue);
} }
break; break;
} }
}
} catch (BuildException be) { } catch (BuildException be) {
// TODO: should we ignore this?? // TODO: should we ignore this??
} }
@ -510,7 +506,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
ICStorageElement configElement = configNode; ICStorageElement configElement = configNode;
String optId = configElement.getAttribute(ID); String optId = configElement.getAttribute(ID);
if (i == 0) { if (i == 0) {
enumList = new ArrayList(); enumList = new ArrayList<String>();
if (defaultValue == null) { if (defaultValue == null) {
defaultValue = optId; // Default value to be overridden is default is specified defaultValue = optId; // Default value to be overridden is default is specified
} }
@ -549,14 +545,15 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
// Note: These string-list options do not load either the "value" or // Note: These string-list options do not load either the "value" or
// "defaultValue" attributes. Instead, the ListOptionValue children // "defaultValue" attributes. Instead, the ListOptionValue children
// are loaded in the value field. // are loaded in the value field.
List vList = null; List<OptionStringValue> vList = null;
List biList = null; List<OptionStringValue> biList = null;
configElements = element.getChildren(); configElements = element.getChildren();
for (int i = 0; i < configElements.length; ++i) { for (int i = 0; i < configElements.length; ++i) {
if (i == 0) { if (vList==null)
vList = new ArrayList(); vList = new ArrayList<OptionStringValue>();
biList = new ArrayList(); if (biList==null)
} biList = new ArrayList<OptionStringValue>();
ICStorageElement veNode = configElements[i]; ICStorageElement veNode = configElements[i];
if (veNode.getName().equals(LIST_VALUE)) { if (veNode.getName().equals(LIST_VALUE)) {
OptionStringValue ve = new OptionStringValue(veNode); OptionStringValue ve = new OptionStringValue(veNode);
@ -757,21 +754,17 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
case UNDEF_LIBRARY_FILES: case UNDEF_LIBRARY_FILES:
case UNDEF_MACRO_FILES: case UNDEF_MACRO_FILES:
if (value != null) { if (value != null) {
ArrayList stringList = (ArrayList)value; ArrayList<OptionStringValue> stringList = (ArrayList<OptionStringValue>)value;
ListIterator iter = stringList.listIterator(); for (OptionStringValue optValue : stringList) {
while (iter.hasNext()) {
ICStorageElement valueElement = element.createChild(LIST_VALUE); ICStorageElement valueElement = element.createChild(LIST_VALUE);
OptionStringValue ve = (OptionStringValue)iter.next(); optValue.serialize(valueElement);
ve.serialize(valueElement);
} }
} }
// Serialize the built-ins that have been overridden // Serialize the built-ins that have been overridden
if (builtIns != null) { if (builtIns != null) {
ListIterator iter = builtIns.listIterator(); for (OptionStringValue optionValue : builtIns) {
while (iter.hasNext()) {
ICStorageElement valueElement = element.createChild(LIST_VALUE); ICStorageElement valueElement = element.createChild(LIST_VALUE);
OptionStringValue ve = (OptionStringValue)iter.next(); optionValue.serialize(valueElement);
ve.serialize(valueElement);
} }
} }
break; break;
@ -965,6 +958,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getName() * @see org.eclipse.cdt.managedbuilder.core.IOption#getName()
*/ */
@Override
public String getName() { public String getName() {
return (name == null && superClass != null) ? superClass.getName() : name; return (name == null && superClass != null) ? superClass.getName() : name;
} }
@ -988,7 +982,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
// Return the elements in the order they are specified in the manifest // Return the elements in the order they are specified in the manifest
String[] enumNames = new String[enumList.size()]; String[] enumNames = new String[enumList.size()];
for (int index = 0; index < enumList.size(); ++ index) { for (int index = 0; index < enumList.size(); ++ index) {
enumNames[index] = (String) getEnumNameMap().get(enumList.get(index)); enumNames[index] = getEnumNameMap().get(enumList.get(index));
} }
return enumNames; return enumNames;
} }
@ -1084,15 +1078,15 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
*/ */
public String[] getBuiltIns() { public String[] getBuiltIns() {
// Return the list of built-ins as an array // Return the list of built-ins as an array
List list = getExactBuiltinsList(); List<OptionStringValue> list = getExactBuiltinsList();
List valueList = listValueListToValueList(list); List<String> valueList = listValueListToValueList(list);
if(valueList == null) if(valueList == null)
return EMPTY_STRING_ARRAY; return EMPTY_STRING_ARRAY;
return (String[])valueList.toArray(new String[valueList.size()]); return valueList.toArray(new String[valueList.size()]);
} }
public List getExactBuiltinsList() { public List<OptionStringValue> getExactBuiltinsList() {
// Return the list of built-ins as an array // Return the list of built-ins as an array
if (builtIns == null) { if (builtIns == null) {
if (superClass != null) { if (superClass != null) {
@ -1184,12 +1178,12 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
if (getValueType() != PREPROCESSOR_SYMBOLS) { if (getValueType() != PREPROCESSOR_SYMBOLS) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
} }
ArrayList v = (ArrayList)getValue(); ArrayList<String> v = (ArrayList<String>)getValue();
if (v == null) { if (v == null) {
return EMPTY_STRING_ARRAY; return EMPTY_STRING_ARRAY;
} else { } else {
v.trimToSize(); v.trimToSize();
return (String[]) v.toArray(new String[v.size()]); return v.toArray(new String[v.size()]);
} }
} }
@ -1213,17 +1207,15 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
} }
// First check for the command in ID->command map // First check for the command in ID->command map
String cmd = (String) getEnumCommandMap().get(id); String cmd = getEnumCommandMap().get(id);
if (cmd == null) { if (cmd == null) {
// This may be a 1.2 project or plugin manifest. If so, the argument is the human readable // This may be a 1.2 project or plugin manifest. If so, the argument is the human readable
// name of the enumeration. Search for the ID that maps to the name and use that to find the // name of the enumeration. Search for the ID that maps to the name and use that to find the
// command. // command.
ListIterator iter = enumList.listIterator(); for (String realID : enumList) {
while (iter.hasNext()) { String name = getEnumNameMap().get(realID);
String realID = (String) iter.next();
String name = (String) getEnumNameMap().get(realID);
if (id.equals(name)) { if (id.equals(name)) {
cmd = (String) getEnumCommandMap().get(realID); cmd = getEnumCommandMap().get(realID);
break; break;
} }
} }
@ -1251,7 +1243,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
} }
// First check for the command in ID->name map // First check for the command in ID->name map
String name = (String) getEnumNameMap().get(id); String name = getEnumNameMap().get(id);
if (name == null) { if (name == null) {
// This may be a 1.2 project or plugin manifest. If so, the argument is the human readable // This may be a 1.2 project or plugin manifest. If so, the argument is the human readable
// name of the enumeration. // name of the enumeration.
@ -1267,9 +1259,9 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
* @return a Map of enumerated option value IDs to actual commands that are passed * @return a Map of enumerated option value IDs to actual commands that are passed
* to a tool on the command line. * to a tool on the command line.
*/ */
private Map getEnumCommandMap() { private Map<String, String> getEnumCommandMap() {
if (enumCommands == null) { if (enumCommands == null) {
enumCommands = new HashMap(); enumCommands = new HashMap<String, String>();
} }
return enumCommands; return enumCommands;
} }
@ -1292,11 +1284,9 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
} }
Set idSet = getEnumNameMap().keySet(); Set<String> idSet = getEnumNameMap().keySet();
Iterator iter = idSet.iterator(); for (String id : idSet) {
while (iter.hasNext()) { String enumName = getEnumNameMap().get(id);
String id = (String) iter.next();
String enumName = (String) getEnumNameMap().get(id);
if (name.equals(enumName)) { if (name.equals(enumName)) {
return id; return id;
} }
@ -1308,9 +1298,9 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
* *
* @return a Map of enumerated option value IDs to the selection displayed to the user. * @return a Map of enumerated option value IDs to the selection displayed to the user.
*/ */
private Map getEnumNameMap() { private Map<String, String> getEnumNameMap() {
if (enumNames == null) { if (enumNames == null) {
enumNames = new HashMap(); enumNames = new HashMap<String, String>();
} }
return enumNames; return enumNames;
} }
@ -1322,12 +1312,12 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
if (getValueType() != INCLUDE_PATH) { if (getValueType() != INCLUDE_PATH) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
} }
ArrayList v = (ArrayList)getValue(); ArrayList<String> v = (ArrayList<String>)getValue();
if (v == null) { if (v == null) {
return EMPTY_STRING_ARRAY; return EMPTY_STRING_ARRAY;
} else { } else {
v.trimToSize(); v.trimToSize();
return (String[]) v.toArray(new String[v.size()]); return v.toArray(new String[v.size()]);
} }
} }
@ -1338,12 +1328,12 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
if (getValueType() != LIBRARIES) { if (getValueType() != LIBRARIES) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
} }
ArrayList v = (ArrayList)getValue(); ArrayList<String> v = (ArrayList<String>)getValue();
if (v == null) { if (v == null) {
return EMPTY_STRING_ARRAY; return EMPTY_STRING_ARRAY;
} else { } else {
v.trimToSize(); v.trimToSize();
return (String[]) v.toArray(new String[v.size()]); return v.toArray(new String[v.size()]);
} }
} }
@ -1364,12 +1354,12 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
if (getValueType() != STRING_LIST) { if (getValueType() != STRING_LIST) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
} }
ArrayList v = (ArrayList)getValue(); ArrayList<String> v = (ArrayList<String>)getValue();
if (v == null) { if (v == null) {
return EMPTY_STRING_ARRAY; return EMPTY_STRING_ARRAY;
} else { } else {
v.trimToSize(); v.trimToSize();
return (String[]) v.toArray(new String[v.size()]); return v.toArray(new String[v.size()]);
} }
} }
@ -1391,12 +1381,12 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
} }
// This is the right puppy, so return its list value // This is the right puppy, so return its list value
ArrayList v = (ArrayList)getValue(); ArrayList<String> v = (ArrayList<String>)getValue();
if (v == null) { if (v == null) {
return EMPTY_STRING_ARRAY; return EMPTY_STRING_ARRAY;
} else { } else {
v.trimToSize(); v.trimToSize();
return (String[]) v.toArray(new String[v.size()]); return v.toArray(new String[v.size()]);
} }
} }
@ -1421,11 +1411,11 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
/* /*
* In order to determine the current value of an option, perform the following steps until a value is found: * In order to determine the current value of an option, perform the following steps until a value is found:
* 1. Examine the value attribute of the option. * 1. Examine the value attribute of the option.
* 2. Examine the value attribute of the options superClass recursively. * 2. Examine the value attribute of the option's superClass recursively.
* 3. Examine the dynamicDefaultValue attribute of the option and invoke it if specified. (not yet implemented) * 3. Examine the dynamicDefaultValue attribute of the option and invoke it if specified. (not yet implemented)
* 4. Examine the defaultValue attribute of the option. * 4. Examine the defaultValue attribute of the option.
* 5. Examine the dynamicDefaultValue attribute of the options superClass and invoke it if specified. (not yet implemented) * 5. Examine the dynamicDefaultValue attribute of the option's superClass and invoke it if specified. (not yet implemented)
* 6. Examine the defaultValue attribute of the options superClass. * 6. Examine the defaultValue attribute of the option's superClass.
* 7. Go to step 5 recursively until no more super classes. * 7. Go to step 5 recursively until no more super classes.
* 8. Use the default value for the option type. * 8. Use the default value for the option type.
*/ */
@ -1466,7 +1456,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
case UNDEF_LIBRARY_PATHS: case UNDEF_LIBRARY_PATHS:
case UNDEF_LIBRARY_FILES: case UNDEF_LIBRARY_FILES:
case UNDEF_MACRO_FILES: case UNDEF_MACRO_FILES:
val = new ArrayList(); val = new ArrayList<String>();
break; break;
default: default:
val = EMPTY_STRING; val = EMPTY_STRING;
@ -1481,11 +1471,11 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
/* /*
* In order to determine the current value of an option, perform the following steps until a value is found: * In order to determine the current value of an option, perform the following steps until a value is found:
* 1. Examine the value attribute of the option. * 1. Examine the value attribute of the option.
* 2. Examine the value attribute of the options superClass recursively. * 2. Examine the value attribute of the option's superClass recursively.
* 3. Examine the dynamicDefaultValue attribute of the option and invoke it if specified. (not yet implemented) * 3. Examine the dynamicDefaultValue attribute of the option and invoke it if specified. (not yet implemented)
* 4. Examine the defaultValue attribute of the option. * 4. Examine the defaultValue attribute of the option.
* 5. Examine the dynamicDefaultValue attribute of the options superClass and invoke it if specified. (not yet implemented) * 5. Examine the dynamicDefaultValue attribute of the option's superClass and invoke it if specified. (not yet implemented)
* 6. Examine the defaultValue attribute of the options superClass. * 6. Examine the defaultValue attribute of the option's superClass.
* 7. Go to step 5 recursively until no more super classes. * 7. Go to step 5 recursively until no more super classes.
* 8. Use the default value for the option type. * 8. Use the default value for the option type.
*/ */
@ -1526,7 +1516,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
case UNDEF_LIBRARY_PATHS: case UNDEF_LIBRARY_PATHS:
case UNDEF_LIBRARY_FILES: case UNDEF_LIBRARY_FILES:
case UNDEF_MACRO_FILES: case UNDEF_MACRO_FILES:
val = new ArrayList(); val = new ArrayList<OptionStringValue>();
break; break;
default: default:
val = EMPTY_STRING; val = EMPTY_STRING;
@ -1542,8 +1532,10 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
*/ */
public Object getRawValue() { public Object getRawValue() {
Object ev = getExactRawValue(); Object ev = getExactRawValue();
if(ev instanceof List) if(ev instanceof List<?>) {
ev = listValueListToValueList((List)ev); List<String> evList = listValueListToValueList((List<OptionStringValue>)ev);
return evList;
}
return ev; return ev;
} }
@ -1557,25 +1549,25 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
return value; return value;
} }
private List listValueListToValueList(List list){ private List<String> listValueListToValueList(List<OptionStringValue> list){
if(list == null) if(list == null)
return null; return null;
List valueList = new ArrayList(list.size()); List<String> valueList = new ArrayList<String>(list.size());
for(int i = 0; i < list.size(); i++){ for(int i = 0; i < list.size(); i++){
OptionStringValue el = (OptionStringValue)list.get(i); OptionStringValue el = list.get(i);
valueList.add(el.getValue()); valueList.add(el.getValue());
} }
return valueList; return valueList;
} }
private List valueListToListValueList(List list, boolean builtIn){ private List<OptionStringValue> valueListToListValueList(List<String> list, boolean builtIn){
if(list == null) if(list == null)
return null; return null;
List lvList = new ArrayList(list.size()); List<OptionStringValue> lvList = new ArrayList<OptionStringValue>(list.size());
for(int i = 0; i < list.size(); i++){ for(int i = 0; i < list.size(); i++){
String v = (String)list.get(i); String v = list.get(i);
lvList.add(new OptionStringValue(v, builtIn)); lvList.add(new OptionStringValue(v, builtIn));
} }
return lvList; return lvList;
@ -1587,8 +1579,10 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
*/ */
public Object getDefaultValue() { public Object getDefaultValue() {
Object ev = getExactDefaultValue(); Object ev = getExactDefaultValue();
if(ev instanceof List) if(ev instanceof List<?>) {
ev = listValueListToValueList((List)ev); List<String> evList = listValueListToValueList((List<OptionStringValue>)ev);
return evList;
}
return ev; return ev;
} }
@ -1606,9 +1600,12 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(Object) * @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(Object)
*/ */
public void setDefaultValue(Object v) { public void setDefaultValue(Object v) {
if(v instanceof List) if(v instanceof List<?>) {
v = valueListToListValueList((List)v, false); List<OptionStringValue> vList = valueListToListValueList((List<String>)v, false);
defaultValue = vList;
} else {
defaultValue = v; defaultValue = v;
}
if(!isExtensionElement()){ if(!isExtensionElement()){
setDirty(true); setDirty(true);
rebuildState = true; rebuildState = true;
@ -1819,7 +1816,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
if(value == null) if(value == null)
this.value = null; this.value = null;
else else
this.value = new ArrayList(Arrays.asList(value)); this.value = new ArrayList<OptionStringValue>(Arrays.asList(value));
} }
else { else {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
@ -1834,9 +1831,12 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(Object) * @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(Object)
*/ */
public void setValue(Object v) { public void setValue(Object v) {
if(v instanceof List) if(v instanceof List<?>) {
v = valueListToListValueList((List)v, false); List<OptionStringValue> vList = valueListToListValueList((List<String>)v, false);
value = vList;
} else {
value = v; value = v;
}
if(!isExtensionElement()){ if(!isExtensionElement()){
setDirty(true); setDirty(true);
rebuildState = true; rebuildState = true;
@ -2051,7 +2051,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
for (int i = 0; i < enumElements.length; ++i) { for (int i = 0; i < enumElements.length; ++i) {
String optId = enumElements[i].getAttribute(ID); String optId = enumElements[i].getAttribute(ID);
if (i == 0) { if (i == 0) {
enumList = new ArrayList(); enumList = new ArrayList<String>();
if (defaultValue == null) { if (defaultValue == null) {
defaultValue = optId; // Default value to be overridden if default is specified defaultValue = optId; // Default value to be overridden if default is specified
} }
@ -2083,12 +2083,12 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
// Note: These string-list options do not load either the "value" or // Note: These string-list options do not load either the "value" or
// "defaultValue" attributes. Instead, the ListOptionValue children // "defaultValue" attributes. Instead, the ListOptionValue children
// are loaded in the value field. // are loaded in the value field.
List vList = null; List<OptionStringValue> vList = null;
IManagedConfigElement[] vElements = element.getChildren(LIST_VALUE); IManagedConfigElement[] vElements = element.getChildren(LIST_VALUE);
for (int i = 0; i < vElements.length; ++i) { for (int i = 0; i < vElements.length; ++i) {
if (i == 0) { if (vList==null) {
vList = new ArrayList(); vList = new ArrayList<OptionStringValue>();
builtIns = new ArrayList(); builtIns = new ArrayList<OptionStringValue>();
} }
OptionStringValue ve = new OptionStringValue(vElements[i]); OptionStringValue ve = new OptionStringValue(vElements[i]);
if(ve.isBuiltIn()) { if(ve.isBuiltIn()) {
@ -2112,6 +2112,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
/** /**
* @return Returns the managedBuildRevision. * @return Returns the managedBuildRevision.
*/ */
@Override
public String getManagedBuildRevision() { public String getManagedBuildRevision() {
if ( managedBuildRevision == null) { if ( managedBuildRevision == null) {
if ( getParent() != null) { if ( getParent() != null) {
@ -2208,6 +2209,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
/** /**
* @return Returns the version. * @return Returns the version.
*/ */
@Override
public PluginVersionIdentifier getVersion() { public PluginVersionIdentifier getVersion() {
if ( version == null) { if ( version == null) {
if ( getParent() != null) { if ( getParent() != null) {
@ -2217,6 +2219,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
return version; return version;
} }
@Override
public void setVersion(PluginVersionIdentifier version) { public void setVersion(PluginVersionIdentifier version) {
// Do nothing // Do nothing
} }
@ -2339,24 +2342,24 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
if (getBasicValueType() != STRING_LIST) { if (getBasicValueType() != STRING_LIST) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
} }
ArrayList v = (ArrayList)getValue(); ArrayList<String> v = (ArrayList<String>)getValue();
if (v == null) { if (v == null) {
return EMPTY_STRING_ARRAY; return EMPTY_STRING_ARRAY;
} }
return (String[]) v.toArray(new String[v.size()]); return v.toArray(new String[v.size()]);
} }
public OptionStringValue[] getBasicStringListValueElements() throws BuildException { public OptionStringValue[] getBasicStringListValueElements() throws BuildException {
if (getBasicValueType() != STRING_LIST) { if (getBasicValueType() != STRING_LIST) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
} }
ArrayList v = (ArrayList)getExactValue(); ArrayList<OptionStringValue> v = (ArrayList<OptionStringValue>)getExactValue();
if (v == null) { if (v == null) {
return EMPTY_LV_ARRAY; return EMPTY_LV_ARRAY;
} }
return (OptionStringValue[]) v.toArray(new OptionStringValue[v.size()]); return v.toArray(new OptionStringValue[v.size()]);
} }