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

bug 319512: Missing type arguments on managedbuilder.core

This commit is contained in:
Andrew Gvozdev 2010-07-29 15:31:39 +00:00
parent 3a67847b2b
commit dc91dc34b3
9 changed files with 59 additions and 66 deletions

View file

@ -40,8 +40,8 @@ public class BuildPropertyManager implements IBuildPropertyManager{
private static BuildPropertyManager fInstance;
private List fTypeCfgElements;
private List fValueCfgElements;
private List<IConfigurationElement> fTypeCfgElements;
private List<IConfigurationElement> fValueCfgElements;
private BuildPropertyManager(){
loadExtensions();
@ -61,10 +61,10 @@ public class BuildPropertyManager implements IBuildPropertyManager{
return properties.toString();
}
private Map fPropertyTypeMap = new HashMap();
private Map<String, IBuildPropertyType> fPropertyTypeMap = new HashMap<String, IBuildPropertyType>();
public IBuildPropertyType getPropertyType(String id){
return (BuildPropertyType)fPropertyTypeMap.get(id);
return fPropertyTypeMap.get(id);
}
public IBuildPropertyType createPropertyType(String id, String name) throws CoreException{
@ -108,7 +108,7 @@ public class BuildPropertyManager implements IBuildPropertyManager{
}
public IBuildPropertyType[] getPropertyTypes(){
return (BuildPropertyType[])fPropertyTypeMap.values().toArray(new BuildPropertyType[fPropertyTypeMap.size()]);
return fPropertyTypeMap.values().toArray(new BuildPropertyType[fPropertyTypeMap.size()]);
}
public IBuildProperty createProperty(String id, String value) throws CoreException {
@ -134,15 +134,15 @@ public class BuildPropertyManager implements IBuildPropertyManager{
return false;
}
private List getTypeElList(boolean create){
private List<IConfigurationElement> getTypeElList(boolean create){
if(fTypeCfgElements == null && create)
fTypeCfgElements = new ArrayList();
fTypeCfgElements = new ArrayList<IConfigurationElement>();
return fTypeCfgElements;
}
private List getValueElList(boolean create){
private List<IConfigurationElement> getValueElList(boolean create){
if(fValueCfgElements == null && create)
fValueCfgElements = new ArrayList();
fValueCfgElements = new ArrayList<IConfigurationElement>();
return fValueCfgElements;
}
@ -164,10 +164,9 @@ public class BuildPropertyManager implements IBuildPropertyManager{
private void resolveConfigElements(){
List typeEls = getTypeElList(false);
List<IConfigurationElement> typeEls = getTypeElList(false);
if(typeEls != null){
for(int i = 0; i < typeEls.size(); i++){
IConfigurationElement el = (IConfigurationElement)typeEls.get(i);
for (IConfigurationElement el : typeEls) {
try {
createPropertyType(el);
} catch (CoreException e) {
@ -175,10 +174,9 @@ public class BuildPropertyManager implements IBuildPropertyManager{
}
}
List valEls = getValueElList(false);
List<IConfigurationElement> valEls = getValueElList(false);
if(valEls != null){
for(int i = 0; i < valEls.size(); i++){
IConfigurationElement el = (IConfigurationElement)valEls.get(i);
for (IConfigurationElement el : valEls) {
try {
createPropertyValue(el);
} catch (CoreException e) {

View file

@ -18,7 +18,7 @@ import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
public class BuildPropertyType extends PropertyBase implements IBuildPropertyType{
private Map fValuesMap = new HashMap();
private Map<String, BuildPropertyValue> fValuesMap = new HashMap<String, BuildPropertyValue>();
BuildPropertyType(String id, String name){
super(id, name);
@ -29,10 +29,10 @@ public class BuildPropertyType extends PropertyBase implements IBuildPropertyTyp
}
public IBuildPropertyValue[] getSupportedValues(){
return (BuildPropertyValue[])fValuesMap.values().toArray(new BuildPropertyValue[fValuesMap.size()]);
return fValuesMap.values().toArray(new BuildPropertyValue[fValuesMap.size()]);
}
public IBuildPropertyValue getSupportedValue(String id){
return (BuildPropertyValue)fValuesMap.get(id);
return fValuesMap.get(id);
}
}

View file

@ -12,7 +12,6 @@ package org.eclipse.cdt.managedbuilder.internal.envvar;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
@ -33,7 +32,7 @@ import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
/**
* This class implements the IEnvironmentVariableProvider interface and provides all
* build environment funvtionality to the MBS
* build environment functionality to the MBS
*
* @since 3.0
*
@ -46,7 +45,7 @@ public class EnvironmentVariableProvider implements
// private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$
private static EnvironmentVariableProvider fInstance = null;
private List fListeners = null;
private List<IEnvironmentBuildPathsChangeListener> fListeners = null;
private IEnvironmentVariableManager fMngr;
private boolean fBuildPathVarCheckAllowed;
@ -74,8 +73,8 @@ public class EnvironmentVariableProvider implements
if(fDelimiter == null || "".equals(fDelimiter)) //$NON-NLS-1$
return new String[]{variableValue};
List list = EnvVarOperationProcessor.convertToList(variableValue,fDelimiter);
return (String[]) list.toArray(new String[list.size()]);
List<String> list = EnvVarOperationProcessor.convertToList(variableValue,fDelimiter);
return list.toArray(new String[list.size()]);
}
}
@ -208,7 +207,7 @@ public class EnvironmentVariableProvider implements
public String[] getBuildPaths(IConfiguration configuration,
int buildPathType) {
ITool tools[] = configuration.getFilteredTools();
List list = new ArrayList();
List<String> list = new ArrayList<String>();
for(int i = 0; i < tools.length; i++){
IEnvVarBuildPath pathDescriptors[] = tools[i].getEnvVarBuildPaths();
@ -248,15 +247,15 @@ public class EnvironmentVariableProvider implements
}
}
return (String[])list.toArray(new String[list.size()]);
return list.toArray(new String[list.size()]);
}
/*
* returns a list of registered listeners
*/
private List getListeners(){
private List<IEnvironmentBuildPathsChangeListener> getListeners(){
if(fListeners == null)
fListeners = new ArrayList();
fListeners = new ArrayList<IEnvironmentBuildPathsChangeListener>();
return fListeners;
}
@ -264,10 +263,10 @@ public class EnvironmentVariableProvider implements
* notifies registered listeners
*/
private void notifyListeners(IConfiguration configuration, int buildPathType){
List listeners = getListeners();
Iterator iterator = listeners.iterator();
while(iterator.hasNext())
((IEnvironmentBuildPathsChangeListener)iterator.next()).buildPathsChanged(configuration,buildPathType);
List<IEnvironmentBuildPathsChangeListener> listeners = getListeners();
for (IEnvironmentBuildPathsChangeListener listener : listeners) {
listener.buildPathsChanged(configuration,buildPathType);
}
}
/* (non-Javadoc)
@ -277,7 +276,7 @@ public class EnvironmentVariableProvider implements
if(listener == null)
return;
List listeners = getListeners();
List<IEnvironmentBuildPathsChangeListener> listeners = getListeners();
if(!listeners.contains(listener))
listeners.add(listener);
@ -290,7 +289,7 @@ public class EnvironmentVariableProvider implements
if(listener == null)
return;
List listeners = getListeners();
List<IEnvironmentBuildPathsChangeListener> listeners = getListeners();
listeners.remove(listener);
}

View file

@ -78,7 +78,7 @@ public class MbsEnvironmentSupplier implements IEnvironmentVariableSupplier {
*/
public IEnvironmentVariable[] getVariables(Object context) {
if(context instanceof IConfiguration){
List variables = new ArrayList(2);
List<IBuildEnvironmentVariable> variables = new ArrayList<IBuildEnvironmentVariable>(2);
IBuildEnvironmentVariable var = getConfigurationVariable("CWD",(IConfiguration)context); //$NON-NLS-1$
if(var != null){
variables.add(var);
@ -86,7 +86,7 @@ public class MbsEnvironmentSupplier implements IEnvironmentVariableSupplier {
} else {
return null;
}
return (IEnvironmentVariable[])variables.toArray(new IBuildEnvironmentVariable[variables.size()]);
return variables.toArray(new IBuildEnvironmentVariable[variables.size()]);
}
return null;
}

View file

@ -251,7 +251,7 @@ public class StoredBuildPathEnvironmentContainer extends
private String[] getBuildPathVarNames(IConfiguration configuration,int buildPathType){
ITool tools[] = configuration.getFilteredTools();
List list = new ArrayList();
List<String> list = new ArrayList<String>();
for(int i = 0; i < tools.length; i++){
IEnvVarBuildPath pathDescriptors[] = tools[i].getEnvVarBuildPaths();
@ -272,6 +272,6 @@ public class StoredBuildPathEnvironmentContainer extends
}
}
return (String[])list.toArray(new String[list.size()]);
return list.toArray(new String[list.size()]);
}
}

View file

@ -116,12 +116,12 @@ public class BuildMacroProvider implements IBuildMacroProvider, IMacroContextInf
}
private static IBuildMacroSupplier[] filterMacroSuppliers(ICdtVariableSupplier suppliers[]){
List list = new ArrayList(suppliers.length);
List<ICdtVariableSupplier> list = new ArrayList<ICdtVariableSupplier>(suppliers.length);
for(int i = 0; i < suppliers.length; i++){
if(suppliers[i] instanceof IBuildMacroSupplier)
list.add(suppliers[i]);
}
return (IBuildMacroSupplier[])list.toArray(new IBuildMacroSupplier[list.size()]);
return list.toArray(new IBuildMacroSupplier[list.size()]);
}
public IMacroContextInfo getMacroContextInfo(
@ -150,9 +150,9 @@ public class BuildMacroProvider implements IBuildMacroProvider, IMacroContextInf
fVariable = var;
}
public ICdtVariable getVariable(){
return fVariable;
}
// public ICdtVariable getVariable(){
// return fVariable;
// }
public int getMacroValueType() {
return fVariable.getValueType();

View file

@ -50,7 +50,7 @@ public class BuildfileMacroSubstitutor extends SupplierBasedCdtVariableSubstitut
private static final String PATTERN_MACRO_NAME = "="; //$NON-NLS-1$
private IConfiguration fConfiguration;
private IBuilder fBuilder;
private HashSet fCaseInsensitiveReferencedNames;
private HashSet<String> fCaseInsensitiveReferencedNames;
private ICdtVariableManager fVarMngr;
private ICConfigurationDescription fCfgDes;
@ -91,7 +91,7 @@ public class BuildfileMacroSubstitutor extends SupplierBasedCdtVariableSubstitut
protected String[] getConfigurationReservedNames(IConfiguration configuration){
ITool tools[] = configuration.getFilteredTools();
if(tools != null){
Set set = new HashSet();
Set<String> set = new HashSet<String>();
for(int i = 0; i < tools.length; i++){
IOutputType ots[] = tools[i].getOutputTypes();
if(ots != null){
@ -115,7 +115,7 @@ public class BuildfileMacroSubstitutor extends SupplierBasedCdtVariableSubstitut
}
return (String[])set.toArray(new String[set.size()]);
return set.toArray(new String[set.size()]);
}
return null;
}
@ -268,9 +268,9 @@ public class BuildfileMacroSubstitutor extends SupplierBasedCdtVariableSubstitut
return ref;
}
protected Set getCaseInsensitiveReferencedNames(){
protected Set<String> getCaseInsensitiveReferencedNames(){
if(fCaseInsensitiveReferencedNames == null)
fCaseInsensitiveReferencedNames = new HashSet();
fCaseInsensitiveReferencedNames = new HashSet<String>();
return fCaseInsensitiveReferencedNames;
}

View file

@ -27,7 +27,7 @@ import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableSubstitutor;
public class ExplicitFileMacroCollector extends SupplierBasedCdtVariableSubstitutor {
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private List fMacrosList = new ArrayList();
private List<ICdtVariable> fMacrosList = new ArrayList<ICdtVariable>();
/* public ExplicitFileMacroCollector(int contextType, Object contextData){
super(contextType, contextData, EMPTY_STRING, EMPTY_STRING);
@ -65,7 +65,7 @@ public class ExplicitFileMacroCollector extends SupplierBasedCdtVariableSubstitu
}
public IBuildMacro[] getExplicisFileMacros(){
return (IBuildMacro[])fMacrosList.toArray(new IBuildMacro[fMacrosList.size()]);
return fMacrosList.toArray(new IBuildMacro[fMacrosList.size()]);
}
}

View file

@ -11,8 +11,7 @@
package org.eclipse.cdt.managedbuilder.internal.macros;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
@ -30,8 +29,8 @@ public class FileContextBuildMacroValues implements
private IBuilder fBuilder;
private IFileContextBuildMacroValues fSupperClassValues;
private HashMap fValues = new HashMap();
private HashMap fAllValues = new HashMap();
private HashMap<String, String> fValues = new HashMap<String, String>();
private HashMap<String, String> fAllValues = new HashMap<String, String>();
private boolean fInitialized;
public FileContextBuildMacroValues(IBuilder builder, IManagedConfigElement element){
@ -56,17 +55,16 @@ public class FileContextBuildMacroValues implements
if(supperValues != null) {
String names[] = MbsMacroSupplier.getInstance().getMacroNames(IBuildMacroProvider.CONTEXT_FILE);
for(int i = 0; i < names.length; i++){
String value = (String)fValues.get(names[i]);
String value = fValues.get(names[i]);
if(value == null)
value = supperValues.getMacroValue(names[i]);
if(value != null && value.length() > 0)
fAllValues.put(names[i],value);
}
} else {
Iterator iter = fValues.entrySet().iterator();
while(iter.hasNext()){
Map.Entry entry = (Map.Entry)iter.next();
String value = (String)entry.getValue();
Set<Entry<String, String>> entrySet = fValues.entrySet();
for (Entry<String, String> entry : entrySet) {
String value = entry.getValue();
if(value != null && value.length() > 0)
fAllValues.put(entry.getKey(),value);
}
@ -80,11 +78,8 @@ public class FileContextBuildMacroValues implements
*/
public String[] getSupportedMacros() {
load();
Set set = fAllValues.keySet();
String names[] = new String[set.size()];
Iterator iter = set.iterator();
for(int i = 0; i < names.length; i++)
names[i] = (String)iter.next();
Set<String> set = fAllValues.keySet();
String names[] = set.toArray(new String[set.size()]);
return names;
}
@ -93,7 +88,7 @@ public class FileContextBuildMacroValues implements
*/
public String getMacroValue(String macroName) {
load();
return (String)fAllValues.get(macroName);
return fAllValues.get(macroName);
}
public IFileContextBuildMacroValues getSupperClassValues(){
@ -113,13 +108,14 @@ public class FileContextBuildMacroValues implements
/* (non-Javadoc)
* @see java.lang.Object#clone()
*/
@SuppressWarnings("unchecked")
@Override
public Object clone(){
FileContextBuildMacroValues cloned = null;
try{
cloned = (FileContextBuildMacroValues)super.clone();
cloned.fValues = (HashMap)fValues.clone();
cloned.fAllValues = (HashMap)fAllValues.clone();
cloned.fValues = (HashMap<String, String>)fValues.clone();
cloned.fAllValues = (HashMap<String, String>)fAllValues.clone();
} catch (CloneNotSupportedException e){
}