1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 02:36: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 static BuildPropertyManager fInstance;
private List fTypeCfgElements; private List<IConfigurationElement> fTypeCfgElements;
private List fValueCfgElements; private List<IConfigurationElement> fValueCfgElements;
private BuildPropertyManager(){ private BuildPropertyManager(){
loadExtensions(); loadExtensions();
@ -61,10 +61,10 @@ public class BuildPropertyManager implements IBuildPropertyManager{
return properties.toString(); return properties.toString();
} }
private Map fPropertyTypeMap = new HashMap(); private Map<String, IBuildPropertyType> fPropertyTypeMap = new HashMap<String, IBuildPropertyType>();
public IBuildPropertyType getPropertyType(String id){ public IBuildPropertyType getPropertyType(String id){
return (BuildPropertyType)fPropertyTypeMap.get(id); return fPropertyTypeMap.get(id);
} }
public IBuildPropertyType createPropertyType(String id, String name) throws CoreException{ public IBuildPropertyType createPropertyType(String id, String name) throws CoreException{
@ -108,7 +108,7 @@ public class BuildPropertyManager implements IBuildPropertyManager{
} }
public IBuildPropertyType[] getPropertyTypes(){ 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 { public IBuildProperty createProperty(String id, String value) throws CoreException {
@ -134,15 +134,15 @@ public class BuildPropertyManager implements IBuildPropertyManager{
return false; return false;
} }
private List getTypeElList(boolean create){ private List<IConfigurationElement> getTypeElList(boolean create){
if(fTypeCfgElements == null && create) if(fTypeCfgElements == null && create)
fTypeCfgElements = new ArrayList(); fTypeCfgElements = new ArrayList<IConfigurationElement>();
return fTypeCfgElements; return fTypeCfgElements;
} }
private List getValueElList(boolean create){ private List<IConfigurationElement> getValueElList(boolean create){
if(fValueCfgElements == null && create) if(fValueCfgElements == null && create)
fValueCfgElements = new ArrayList(); fValueCfgElements = new ArrayList<IConfigurationElement>();
return fValueCfgElements; return fValueCfgElements;
} }
@ -164,10 +164,9 @@ public class BuildPropertyManager implements IBuildPropertyManager{
private void resolveConfigElements(){ private void resolveConfigElements(){
List typeEls = getTypeElList(false); List<IConfigurationElement> typeEls = getTypeElList(false);
if(typeEls != null){ if(typeEls != null){
for(int i = 0; i < typeEls.size(); i++){ for (IConfigurationElement el : typeEls) {
IConfigurationElement el = (IConfigurationElement)typeEls.get(i);
try { try {
createPropertyType(el); createPropertyType(el);
} catch (CoreException e) { } catch (CoreException e) {
@ -175,10 +174,9 @@ public class BuildPropertyManager implements IBuildPropertyManager{
} }
} }
List valEls = getValueElList(false); List<IConfigurationElement> valEls = getValueElList(false);
if(valEls != null){ if(valEls != null){
for(int i = 0; i < valEls.size(); i++){ for (IConfigurationElement el : valEls) {
IConfigurationElement el = (IConfigurationElement)valEls.get(i);
try { try {
createPropertyValue(el); createPropertyValue(el);
} catch (CoreException e) { } catch (CoreException e) {

View file

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

View file

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

View file

@ -251,7 +251,7 @@ public class StoredBuildPathEnvironmentContainer extends
private String[] getBuildPathVarNames(IConfiguration configuration,int buildPathType){ private String[] getBuildPathVarNames(IConfiguration configuration,int buildPathType){
ITool tools[] = configuration.getFilteredTools(); ITool tools[] = configuration.getFilteredTools();
List list = new ArrayList(); List<String> list = new ArrayList<String>();
for(int i = 0; i < tools.length; i++){ for(int i = 0; i < tools.length; i++){
IEnvVarBuildPath pathDescriptors[] = tools[i].getEnvVarBuildPaths(); 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[]){ 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++){ for(int i = 0; i < suppliers.length; i++){
if(suppliers[i] instanceof IBuildMacroSupplier) if(suppliers[i] instanceof IBuildMacroSupplier)
list.add(suppliers[i]); list.add(suppliers[i]);
} }
return (IBuildMacroSupplier[])list.toArray(new IBuildMacroSupplier[list.size()]); return list.toArray(new IBuildMacroSupplier[list.size()]);
} }
public IMacroContextInfo getMacroContextInfo( public IMacroContextInfo getMacroContextInfo(
@ -150,9 +150,9 @@ public class BuildMacroProvider implements IBuildMacroProvider, IMacroContextInf
fVariable = var; fVariable = var;
} }
public ICdtVariable getVariable(){ // public ICdtVariable getVariable(){
return fVariable; // return fVariable;
} // }
public int getMacroValueType() { public int getMacroValueType() {
return fVariable.getValueType(); 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 static final String PATTERN_MACRO_NAME = "="; //$NON-NLS-1$
private IConfiguration fConfiguration; private IConfiguration fConfiguration;
private IBuilder fBuilder; private IBuilder fBuilder;
private HashSet fCaseInsensitiveReferencedNames; private HashSet<String> fCaseInsensitiveReferencedNames;
private ICdtVariableManager fVarMngr; private ICdtVariableManager fVarMngr;
private ICConfigurationDescription fCfgDes; private ICConfigurationDescription fCfgDes;
@ -91,7 +91,7 @@ public class BuildfileMacroSubstitutor extends SupplierBasedCdtVariableSubstitut
protected String[] getConfigurationReservedNames(IConfiguration configuration){ protected String[] getConfigurationReservedNames(IConfiguration configuration){
ITool tools[] = configuration.getFilteredTools(); ITool tools[] = configuration.getFilteredTools();
if(tools != null){ if(tools != null){
Set set = new HashSet(); Set<String> set = new HashSet<String>();
for(int i = 0; i < tools.length; i++){ for(int i = 0; i < tools.length; i++){
IOutputType ots[] = tools[i].getOutputTypes(); IOutputType ots[] = tools[i].getOutputTypes();
if(ots != null){ 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; return null;
} }
@ -268,9 +268,9 @@ public class BuildfileMacroSubstitutor extends SupplierBasedCdtVariableSubstitut
return ref; return ref;
} }
protected Set getCaseInsensitiveReferencedNames(){ protected Set<String> getCaseInsensitiveReferencedNames(){
if(fCaseInsensitiveReferencedNames == null) if(fCaseInsensitiveReferencedNames == null)
fCaseInsensitiveReferencedNames = new HashSet(); fCaseInsensitiveReferencedNames = new HashSet<String>();
return fCaseInsensitiveReferencedNames; return fCaseInsensitiveReferencedNames;
} }

View file

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