mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 20:55:44 +02:00
Bug 567966 - CDT code clean up: type safety warnings
Use Map<String, String> instead of raw Map Use Entry<String, String> instead of raw Entry Change-Id: I6e9ffc4dad34fcb8d2b0b1db04cfc901d9225f74 Signed-off-by: Alexander Fedorov <alexander.fedorov@arsysop.ru>
This commit is contained in:
parent
4849609c6d
commit
aca757df28
1 changed files with 21 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2016 QNX Software Systems and others.
|
* Copyright (c) 2005, 2020 QNX Software Systems and others.
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials
|
* This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License 2.0
|
* are made available under the terms of the Eclipse Public License 2.0
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
* Alex Collins (Broadcom Corp.) - choose build config automatically
|
* Alex Collins (Broadcom Corp.) - choose build config automatically
|
||||||
* James Blackburn (Broadcom Corp.)
|
* James Blackburn (Broadcom Corp.)
|
||||||
* Philip Langer (EclipseSource Services GmbH) - bug 506843
|
* Philip Langer (EclipseSource Services GmbH) - bug 506843
|
||||||
|
* Alexander Fedorov (ArSysOp) - bug 567966
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.launch;
|
package org.eclipse.cdt.launch;
|
||||||
|
|
||||||
|
@ -870,11 +871,13 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
|
||||||
protected String[] getEnvironment(ILaunchConfiguration config) throws CoreException {
|
protected String[] getEnvironment(ILaunchConfiguration config) throws CoreException {
|
||||||
try {
|
try {
|
||||||
// Migrate old env settings to new.
|
// Migrate old env settings to new.
|
||||||
Map map = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map) null);
|
Map<String, String> map = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP,
|
||||||
|
(Map<String, String>) null);
|
||||||
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
|
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
|
wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
|
||||||
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map) null);
|
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP,
|
||||||
|
(Map<String, String>) null);
|
||||||
config = wc.doSave();
|
config = wc.doSave();
|
||||||
}
|
}
|
||||||
boolean append = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_INHERIT,
|
boolean append = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_INHERIT,
|
||||||
|
@ -897,20 +900,21 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected String[] getEnvironmentArray(ILaunchConfiguration config) {
|
protected String[] getEnvironmentArray(ILaunchConfiguration config) {
|
||||||
Map env = null;
|
Map<String, String> env = null;
|
||||||
try {
|
try {
|
||||||
env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map) null);
|
env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP,
|
||||||
|
(Map<String, String>) null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
if (env == null) {
|
if (env == null) {
|
||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
String[] array = new String[env.size()];
|
String[] array = new String[env.size()];
|
||||||
Iterator entries = env.entrySet().iterator();
|
Iterator<Entry<String, String>> entries = env.entrySet().iterator();
|
||||||
Entry entry;
|
Entry<String, String> entry;
|
||||||
for (int i = 0; entries.hasNext() && i < array.length; i++) {
|
for (int i = 0; entries.hasNext() && i < array.length; i++) {
|
||||||
entry = (Entry) entries.next();
|
entry = entries.next();
|
||||||
array[i] = ((String) entry.getKey()) + "=" + ((String) entry.getValue()); //$NON-NLS-1$
|
array[i] = (entry.getKey()) + "=" + (entry.getValue()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
@ -923,18 +927,19 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected Properties getEnvironmentProperty(ILaunchConfiguration config) {
|
protected Properties getEnvironmentProperty(ILaunchConfiguration config) {
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
Map env = null;
|
Map<String, String> env = null;
|
||||||
try {
|
try {
|
||||||
env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map) null);
|
env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP,
|
||||||
|
(Map<String, String>) null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
if (env == null)
|
if (env == null)
|
||||||
return prop;
|
return prop;
|
||||||
Iterator entries = env.entrySet().iterator();
|
Iterator<Entry<String, String>> entries = env.entrySet().iterator();
|
||||||
Entry entry;
|
Entry<String, String> entry;
|
||||||
while (entries.hasNext()) {
|
while (entries.hasNext()) {
|
||||||
entry = (Entry) entries.next();
|
entry = entries.next();
|
||||||
prop.setProperty((String) entry.getKey(), (String) entry.getValue());
|
prop.setProperty(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
@ -945,7 +950,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
|
||||||
* @return default process attribute map for C/C++ processes
|
* @return default process attribute map for C/C++ processes
|
||||||
*/
|
*/
|
||||||
protected Map getDefaultProcessMap() {
|
protected Map getDefaultProcessMap() {
|
||||||
Map map = new HashMap();
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put(IProcess.ATTR_PROCESS_TYPE, ICDTLaunchConfigurationConstants.ID_PROGRAM_PROCESS_TYPE);
|
map.put(IProcess.ATTR_PROCESS_TYPE, ICDTLaunchConfigurationConstants.ID_PROGRAM_PROCESS_TYPE);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue