mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 20:35:38 +02:00
Fix some trivial sonar warnings
Change-Id: I3da053a5fb4186a8cbbef73f58dc50d8b89bbd8e
This commit is contained in:
parent
fb9547a46c
commit
7a16ca18f5
7 changed files with 39 additions and 28 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2014 Ericsson and others.
|
||||
* Copyright (c) 2008, 2015 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -174,8 +174,10 @@ public class FinalLaunchSequence extends ReflectionSequence {
|
|||
*/
|
||||
@RollBack("stepInitializeFinalLaunchSequence")
|
||||
public void rollBackInitializeFinalLaunchSequence(RequestMonitor requestMonitor) {
|
||||
if (fTracker != null) fTracker.dispose();
|
||||
fTracker = null;
|
||||
if (fTracker != null) {
|
||||
fTracker.dispose();
|
||||
fTracker = null;
|
||||
}
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
|
@ -481,7 +483,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
|
|||
sourceLookup.setSourceLookupPath(sourceLookupDmc, locator.getSourceContainers(), requestMonitor);
|
||||
}
|
||||
|
||||
private final static String INVALID = "invalid"; //$NON-NLS-1$
|
||||
private static final String INVALID = "invalid"; //$NON-NLS-1$
|
||||
/**
|
||||
* If we are dealing with a remote-attach debugging session, connect to the target.
|
||||
* @since 4.0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2013 Wind River Systems and others.
|
||||
* Copyright (c) 2006, 2015 Wind River Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -195,7 +195,7 @@ public class GdbLaunch extends DsfLaunch
|
|||
// ITerminate
|
||||
|
||||
static class LaunchCommandRequest extends CRequest implements IDebugCommandRequest {
|
||||
Object[] elements;
|
||||
private Object[] elements;
|
||||
|
||||
public LaunchCommandRequest(Object[] objects) {
|
||||
elements = objects;
|
||||
|
@ -323,8 +323,9 @@ public class GdbLaunch extends DsfLaunch
|
|||
// updating of some of the Debug view actions.
|
||||
// 'DebugEvent.TERMINATE' will be fired when each of the corresponding processes
|
||||
// exits and handled by 'handleDebugEvents()' method.
|
||||
if (isTerminated())
|
||||
if (isTerminated()) {
|
||||
fireTerminate();
|
||||
}
|
||||
|
||||
rm.setStatus(getStatus());
|
||||
rm.done();
|
||||
|
@ -363,7 +364,7 @@ public class GdbLaunch extends DsfLaunch
|
|||
|
||||
@Override
|
||||
public <T> T getAdapter(Class<T> adapter) {
|
||||
if (adapter.equals(ITerminateHandler.class) == false) {
|
||||
if (!adapter.equals(ITerminateHandler.class)) {
|
||||
// Must force adapters to be loaded.
|
||||
// Except in the case of terminate. Terminate can be used
|
||||
// when running headless (no UI) and therefore we should not
|
||||
|
|
|
@ -63,14 +63,14 @@ import org.eclipse.debug.core.model.ISourceLocator;
|
|||
@ThreadSafe
|
||||
public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
|
||||
{
|
||||
public final static String GDB_DEBUG_MODEL_ID = "org.eclipse.cdt.dsf.gdb"; //$NON-NLS-1$
|
||||
public static final String GDB_DEBUG_MODEL_ID = "org.eclipse.cdt.dsf.gdb"; //$NON-NLS-1$
|
||||
|
||||
private final static String NON_STOP_FIRST_VERSION = "6.8.50"; //$NON-NLS-1$
|
||||
private static final String NON_STOP_FIRST_VERSION = "6.8.50"; //$NON-NLS-1$
|
||||
|
||||
// Can be removed once we remove the deprecated newServiceFactory(String)
|
||||
private boolean fIsNonStopSession = false;
|
||||
|
||||
private final static String TRACING_FIRST_VERSION = "7.1.50"; //$NON-NLS-1$
|
||||
private static final String TRACING_FIRST_VERSION = "7.1.50"; //$NON-NLS-1$
|
||||
|
||||
private GdbLaunch fGdbLaunch;
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ public class InferiorRuntimeProcess extends RuntimeProcess {
|
|||
try {
|
||||
type = config.getType().getName();
|
||||
} catch (CoreException e) {
|
||||
type = null;
|
||||
}
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(config.getName());
|
||||
|
|
|
@ -449,39 +449,45 @@ public class LaunchUtils {
|
|||
return null;
|
||||
}
|
||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
||||
if (project == null || !project.isAccessible())
|
||||
if (project == null || !project.isAccessible()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project, false);
|
||||
|
||||
// Not a CDT project?
|
||||
if (projDesc == null)
|
||||
if (projDesc == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String buildConfigID = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, ""); //$NON-NLS-1$
|
||||
ICConfigurationDescription cfg = null;
|
||||
if (buildConfigID.length() != 0)
|
||||
if (buildConfigID.length() != 0) {
|
||||
cfg = projDesc.getConfigurationById(buildConfigID);
|
||||
}
|
||||
|
||||
// if configuration is null fall-back to active
|
||||
if (cfg == null)
|
||||
if (cfg == null) {
|
||||
cfg = projDesc.getActiveConfiguration();
|
||||
}
|
||||
|
||||
// Environment variables and inherited vars
|
||||
HashMap<String, String> envMap = new HashMap<String, String>();
|
||||
IEnvironmentVariable[] vars = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cfg, true);
|
||||
for (IEnvironmentVariable var : vars)
|
||||
for (IEnvironmentVariable var : vars) {
|
||||
envMap.put(var.getName(), var.getValue());
|
||||
}
|
||||
|
||||
// Add variables from build info
|
||||
ICdtVariable[] build_vars = CCorePlugin.getDefault().getCdtVariableManager().getVariables(cfg);
|
||||
for (ICdtVariable var : build_vars) {
|
||||
ICdtVariable[] buildVars = CCorePlugin.getDefault().getCdtVariableManager().getVariables(cfg);
|
||||
for (ICdtVariable var : buildVars) {
|
||||
try {
|
||||
// The project_classpath variable contributed by JDT is useless for running C/C++
|
||||
// binaries, but it can be lethal if it has a very large value that exceeds shell
|
||||
// limit. See http://bugs.eclipse.org/bugs/show_bug.cgi?id=408522
|
||||
if (!"project_classpath".equals(var.getName())) //$NON-NLS-1$
|
||||
if (!"project_classpath".equals(var.getName())) {//$NON-NLS-1$
|
||||
envMap.put(var.getName(), var.getStringValue());
|
||||
}
|
||||
} catch (CdtVariableException e) {
|
||||
// Some Eclipse dynamic variables can't be resolved dynamically... we don't care.
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2012 Wind River Systems and others.
|
||||
* Copyright (c) 2006, 2015 Wind River Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -40,13 +40,13 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
|
||||
public class ServicesLaunchSequence extends Sequence {
|
||||
|
||||
DsfSession fSession;
|
||||
GdbLaunch fLaunch;
|
||||
private DsfSession fSession;
|
||||
private GdbLaunch fLaunch;
|
||||
|
||||
ICommandControlService fCommandControl;
|
||||
CSourceLookup fSourceLookup;
|
||||
private ICommandControlService fCommandControl;
|
||||
private CSourceLookup fSourceLookup;
|
||||
|
||||
Step[] fSteps = new Step[] {
|
||||
private Step[] fSteps = new Step[] {
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
fLaunch.getServiceFactory().createService(IMIBackend.class, fSession, fLaunch.getLaunchConfiguration()).initialize(requestMonitor);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2010 Wind River Systems and others.
|
||||
* Copyright (c) 2006, 2015 Wind River Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -27,7 +27,7 @@ public class ShutdownSequence extends Sequence {
|
|||
|
||||
class ServiceShutdownStep extends Step {
|
||||
|
||||
IDsfService fService;
|
||||
private IDsfService fService;
|
||||
|
||||
ServiceShutdownStep( IDsfService service ) {
|
||||
super();
|
||||
|
@ -73,8 +73,9 @@ public class ShutdownSequence extends Sequence {
|
|||
private Step[] createSteps() {
|
||||
IDsfService[] services = getServices();
|
||||
ServiceShutdownStep[] steps = new ServiceShutdownStep[services.length];
|
||||
for ( int i = 0; i < steps.length; ++i )
|
||||
for ( int i = 0; i < steps.length; ++i ) {
|
||||
steps[i] = new ServiceShutdownStep( services[i] );
|
||||
}
|
||||
return steps;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue