1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

replace size()|length() > 0 with !isEmpty()

isEmpty is garantied to be as fast or faster than size and
length. It is also easier to read.

Change-Id: Ia768910c21313666aeab774963c0b6e82d825b44
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
This commit is contained in:
Matthew Khouzam 2015-02-27 23:10:10 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent 9105e2d42c
commit f517c704bc
49 changed files with 104 additions and 104 deletions

View file

@ -168,9 +168,9 @@ public class GdbPinProvider implements IPinProvider {
if (data != null) { if (data != null) {
String name = data.getName(); String name = data.getName();
String id = data.getId(); String id = data.getId();
if (name != null && name.length() > 0) if (name != null && !name.isEmpty())
label = name; label = name;
else if (id != null && id.length() > 0) else if (id != null && !id.isEmpty())
label = id; label = id;
} }
return label; return label;
@ -184,7 +184,7 @@ public class GdbPinProvider implements IPinProvider {
// get the execution (thread) context label // get the execution (thread) context label
if (execDmc != null) { if (execDmc != null) {
int threadId = execDmc.getThreadId(); int threadId = execDmc.getThreadId();
label += label.length() > 0 ? ": " : ""; //$NON-NLS-1$//$NON-NLS-2$ label += !label.isEmpty() ? ": " : ""; //$NON-NLS-1$//$NON-NLS-2$
label += "Thread [" + Integer.toString(threadId) + "]"; //$NON-NLS-1$//$NON-NLS-2$ label += "Thread [" + Integer.toString(threadId) + "]"; //$NON-NLS-1$//$NON-NLS-2$
} }
return label; return label;

View file

@ -469,7 +469,7 @@ public class GdbConnectCommand extends RefreshableDebugCommand implements IConne
} }
// Check that we have a process to attach to // Check that we have a process to attach to
if (procList.size() > 0) { if (!procList.isEmpty()) {
// Check that we can actually attach to the process. // Check that we can actually attach to the process.
// This is because some backends may not support multi-process. // This is because some backends may not support multi-process.

View file

@ -69,7 +69,7 @@ public class GdbStartTracingCommand extends AbstractDebugCommand implements ISta
final IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class); final IGDBTraceControl traceControl = fTracker.getService(IGDBTraceControl.class);
if (traceControl != null) { if (traceControl != null) {
String user = System.getProperty("user.name"); //$NON-NLS-1$ String user = System.getProperty("user.name"); //$NON-NLS-1$
if (user != null && user.length() > 0 && traceControl instanceof IGDBTraceControl2) { if (user != null && !user.isEmpty() && traceControl instanceof IGDBTraceControl2) {
((IGDBTraceControl2)traceControl).setTraceUser(dmc, user, new ImmediateRequestMonitor() { ((IGDBTraceControl2)traceControl).setTraceUser(dmc, user, new ImmediateRequestMonitor() {
@Override @Override
protected void handleCompleted() { protected void handleCompleted() {

View file

@ -208,7 +208,7 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
String content = text.getText().trim(); String content = text.getText().trim();
// bug #131513 - eliminate Windows \r line delimiter // bug #131513 - eliminate Windows \r line delimiter
content = content.replaceAll("\r\n", "\n"); //$NON-NLS-1$//$NON-NLS-2$ content = content.replaceAll("\r\n", "\n"); //$NON-NLS-1$//$NON-NLS-2$
if (content.length() > 0) { if (!content.isEmpty()) {
return content; return content;
} }
return null; return null;

View file

@ -298,7 +298,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu
String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null); String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
if (projectName != null) { if (projectName != null) {
projectName = projectName.trim(); projectName = projectName.trim();
if (projectName.length() > 0) { if (!projectName.isEmpty()) {
project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
} }
} }

View file

@ -212,7 +212,7 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
*/ */
protected IContainer getContainer() { protected IContainer getContainer() {
String path = fWorkingDirText.getText().trim(); String path = fWorkingDirText.getText().trim();
if (path.length() > 0) { if (!path.isEmpty()) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IResource res = root.findMember(path); IResource res = root.findMember(path);
if (res instanceof IContainer) { if (res instanceof IContainer) {
@ -288,7 +288,7 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
setErrorMessage(e.getMessage()); setErrorMessage(e.getMessage());
return false; return false;
} }
} else if (workingDirPath.length() > 0) { } else if (!workingDirPath.isEmpty()) {
IContainer container = getContainer(); IContainer container = getContainer();
if (container == null) { if (container == null) {
File dir = new File(workingDirPath); File dir = new File(workingDirPath);
@ -358,7 +358,7 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
*/ */
protected String getAttributeValueFrom(Text text) { protected String getAttributeValueFrom(Text text) {
String content = text.getText().trim(); String content = text.getText().trim();
if (content.length() > 0) { if (!content.isEmpty()) {
return content; return content;
} }
return null; return null;

View file

@ -230,7 +230,7 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
fWrongType = false; fWrongType = false;
if (s instanceof IStructuredSelection) { if (s instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) s; IStructuredSelection ss = (IStructuredSelection) s;
if (ss.size() > 0) { if (!ss.isEmpty()) {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
Iterator i = ss.iterator(); Iterator i = ss.iterator();
context = getCommandControlContext(i.next()); context = getCommandControlContext(i.next());

View file

@ -157,7 +157,7 @@ public class TracepointActionDialog extends Dialog {
actionPages = new IBreakpointActionPage[TRACEPOINT_ACTIONS_COUNT]; actionPages = new IBreakpointActionPage[TRACEPOINT_ACTIONS_COUNT];
actionComposites = new Composite[TRACEPOINT_ACTIONS_COUNT]; actionComposites = new Composite[TRACEPOINT_ACTIONS_COUNT];
if (tracepointActions.size() > 0) { if (!tracepointActions.isEmpty()) {
String lastTypeName = GdbUIPlugin.getDefault().getPreferenceStore().getString(TRACEPOINT_ACTION_DIALOG_LAST_SELECTED); String lastTypeName = GdbUIPlugin.getDefault().getPreferenceStore().getString(TRACEPOINT_ACTION_DIALOG_LAST_SELECTED);

View file

@ -306,7 +306,7 @@ public final class TraceVarDetailsDialog extends Dialog {
protected void handleCreate() { protected void handleCreate() {
String name = nameInput.getText(); String name = nameInput.getText();
if (name != null && name.length() > 0) { if (name != null && !name.isEmpty()) {
String value = valueInput.getText(); String value = valueInput.getText();
if (value != null && value.length() == 0) { if (value != null && value.length() == 0) {
value = null; // No value specified value = null; // No value specified

View file

@ -439,7 +439,7 @@ public class GDBTypeParser {
if (tokenType == '(') { if (tokenType == '(') {
dcl(); dcl();
if (tokenType != ')' /*&& name.length() > 0*/) { if (tokenType != ')' /*&& !name.isEmpty()*/) {
// Do we throw an exception on unterminated parentheses // Do we throw an exception on unterminated parentheses
// It should have been handle by getToken() // It should have been handle by getToken()
return; return;
@ -451,7 +451,7 @@ public class GDBTypeParser {
insertingChild(GDBType.FUNCTION); insertingChild(GDBType.FUNCTION);
} else if (tokenType == BRACKETS) { } else if (tokenType == BRACKETS) {
int len = 0; int len = 0;
if (token.length() > 0) { if (!token.isEmpty()) {
try { try {
len = Integer.parseInt(token); len = Integer.parseInt(token);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
@ -470,7 +470,7 @@ public class GDBTypeParser {
insertingChild(GDBType.FUNCTION); insertingChild(GDBType.FUNCTION);
} else { /* BRACKETS */ } else { /* BRACKETS */
int len = 0; int len = 0;
if (token.length() > 0) { if (!token.isEmpty()) {
try { try {
len = Integer.parseInt(token); len = Integer.parseInt(token);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {

View file

@ -51,8 +51,8 @@ public class GdbMemoryBlock extends DsfMemoryBlock implements IMemorySpaceAwareM
String modelId, String expression, BigInteger address, String modelId, String expression, BigInteger address,
int word_size, long length, String memorySpaceID) { int word_size, long length, String memorySpaceID) {
super(retrieval, context, modelId, expression, address, word_size, length); super(retrieval, context, modelId, expression, address, word_size, length);
fMemorySpaceID = (memorySpaceID != null && memorySpaceID.length() > 0) ? memorySpaceID : null; fMemorySpaceID = (memorySpaceID != null && !memorySpaceID.isEmpty()) ? memorySpaceID : null;
assert memorySpaceID == null || memorySpaceID.length() > 0; // callers shouldn't be passing in an empty string assert memorySpaceID == null || !memorySpaceID.isEmpty(); // callers shouldn't be passing in an empty string
//TODO: remove the memorySpaceID parameter from this method //TODO: remove the memorySpaceID parameter from this method
//after making sure it's not used in earlier implementations //after making sure it's not used in earlier implementations
@ -138,7 +138,7 @@ public class GdbMemoryBlock extends DsfMemoryBlock implements IMemorySpaceAwareM
@Override @Override
public String getExpression() { public String getExpression() {
if (fMemorySpaceID != null) { if (fMemorySpaceID != null) {
assert fMemorySpaceID.length() > 0; assert !fMemorySpaceID.isEmpty();
GdbMemoryBlockRetrieval retrieval = (GdbMemoryBlockRetrieval)getMemoryBlockRetrieval(); GdbMemoryBlockRetrieval retrieval = (GdbMemoryBlockRetrieval)getMemoryBlockRetrieval();
return retrieval.encodeAddress(super.getExpression(), fMemorySpaceID); return retrieval.encodeAddress(super.getExpression(), fMemorySpaceID);
} }

View file

@ -336,7 +336,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
try { try {
String gdbinitFile = fGDBBackend.getGDBInitFile(); String gdbinitFile = fGDBBackend.getGDBInitFile();
if (gdbinitFile != null && gdbinitFile.length() > 0) { if (gdbinitFile != null && !gdbinitFile.isEmpty()) {
String projectName = (String) fAttributes.get(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME); String projectName = (String) fAttributes.get(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME);
final String expandedGDBInitFile = new DebugStringVariableSubstitutor(projectName).performStringSubstitution(gdbinitFile); final String expandedGDBInitFile = new DebugStringVariableSubstitutor(projectName).performStringSubstitution(gdbinitFile);
@ -439,7 +439,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
try { try {
List<String> p = fGDBBackend.getSharedLibraryPaths(); List<String> p = fGDBBackend.getSharedLibraryPaths();
if (p.size() > 0) { if (!p.isEmpty()) {
String[] paths = p.toArray(new String[p.size()]); String[] paths = p.toArray(new String[p.size()]);
fCommandControl.queueCommand( fCommandControl.queueCommand(
fCommandFactory.createMIGDBSetSolibSearchPath(fCommandControl.getContext(), paths), fCommandFactory.createMIGDBSetSolibSearchPath(fCommandControl.getContext(), paths),

View file

@ -86,7 +86,7 @@ public class LaunchUtils {
return null; return null;
} }
ICProject cproject = getCProject(configuration); ICProject cproject = getCProject(configuration);
if (cproject == null && name.length() > 0) { if (cproject == null && !name.isEmpty()) {
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name); IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
if (!proj.exists()) { if (!proj.exists()) {
abort(LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_does_not_exist", name), null, //$NON-NLS-1$ abort(LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_does_not_exist", name), null, //$NON-NLS-1$
@ -203,7 +203,7 @@ public class LaunchUtils {
String projectName = getProjectName(configuration); String projectName = getProjectName(configuration);
if (projectName != null) { if (projectName != null) {
projectName = projectName.trim(); projectName = projectName.trim();
if (projectName.length() > 0) { if (!projectName.isEmpty()) {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project); ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project);
if (cProject != null && cProject.exists()) { if (cProject != null && cProject.exists()) {

View file

@ -168,7 +168,7 @@ public class DebugNewProcessSequence extends ReflectionSequence {
return; return;
} }
if (clear == true || properties.size() > 0) { if (clear == true || !properties.isEmpty()) {
// here we need to pass the proper container context // here we need to pass the proper container context
fCommandControl.setEnvironment(properties, clear, rm); fCommandControl.setEnvironment(properties, clear, rm);
} else { } else {
@ -186,7 +186,7 @@ public class DebugNewProcessSequence extends ReflectionSequence {
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP,
IGDBLaunchConfigurationConstants.DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT); IGDBLaunchConfigurationConstants.DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT);
if (!noFileCommand && fBinaryName != null && fBinaryName.length() > 0) { if (!noFileCommand && fBinaryName != null && !fBinaryName.isEmpty()) {
fCommandControl.queueCommand( fCommandControl.queueCommand(
fCommandFactory.createMIFileExecAndSymbols(getContainerContext(), fBinaryName), fCommandFactory.createMIFileExecAndSymbols(getContainerContext(), fBinaryName),
new ImmediateDataRequestMonitor<MIInfo>(rm)); new ImmediateDataRequestMonitor<MIInfo>(rm));

View file

@ -249,7 +249,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
if (location != null) { if (location != null) {
String expandedLocation = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(location); String expandedLocation = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(location);
if (expandedLocation.length() > 0) { if (!expandedLocation.isEmpty()) {
path = new Path(expandedLocation); path = new Path(expandedLocation);
} }
} }

View file

@ -784,7 +784,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
// append thread details (if any) to the thread ID // append thread details (if any) to the thread ID
// as for GDB 6.x with CLIInfoThreadsInfo#getOsId() // as for GDB 6.x with CLIInfoThreadsInfo#getOsId()
final String details = thread.getDetails(); final String details = thread.getDetails();
if (details != null && details.length() > 0) { if (details != null && !details.isEmpty()) {
if (!id.isEmpty()) id += " "; //$NON-NLS-1$ if (!id.isEmpty()) id += " "; //$NON-NLS-1$
id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$ id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$
} }

View file

@ -208,7 +208,7 @@ public class GDBProcesses_7_1 extends GDBProcesses_7_0 {
// append thread details (if any) to the thread ID // append thread details (if any) to the thread ID
// as for GDB 6.x with CLIInfoThreadsInfo#getOsId() // as for GDB 6.x with CLIInfoThreadsInfo#getOsId()
final String details = thread.getDetails(); final String details = thread.getDetails();
if (details != null && details.length() > 0) { if (details != null && !details.isEmpty()) {
if (!id.isEmpty()) id += " "; //$NON-NLS-1$ if (!id.isEmpty()) id += " "; //$NON-NLS-1$
id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$ id += "(" + details + ")"; //$NON-NLS-1$ //$NON-NLS-2$
} }

View file

@ -1395,7 +1395,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
protected void handleSuccess() { protected void handleSuccess() {
fOngoingOperation = false; fOngoingOperation = false;
if (fOperationsPending.size() > 0) { if (!fOperationsPending.isEmpty()) {
// Darn, more operations came in. Trigger their processing // Darn, more operations came in. Trigger their processing
// by calling executeWithTargetAvailable() on the last one // by calling executeWithTargetAvailable() on the last one
TargetAvailableOperationInfo info = fOperationsPending.removeLast(); TargetAvailableOperationInfo info = fOperationsPending.removeLast();
@ -1411,7 +1411,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
fOngoingOperation = false; fOngoingOperation = false;
// Complete each rm of the cancelled operations // Complete each rm of the cancelled operations
while (fOperationsPending.size() > 0) { while (!fOperationsPending.isEmpty()) {
RequestMonitor rm = fOperationsPending.poll().rm; RequestMonitor rm = fOperationsPending.poll().rm;
rm.setStatus(getStatus()); rm.setStatus(getStatus());
rm.done(); rm.done();
@ -1582,7 +1582,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
// All pending operations are independent of each other so we can // All pending operations are independent of each other so we can
// run them concurrently. // run them concurrently.
while (fOperationsPending.size() > 0) { while (!fOperationsPending.isEmpty()) {
executeSteps(fOperationsPending.poll()); executeSteps(fOperationsPending.poll());
} }
} }

View file

@ -613,7 +613,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
} else if (!function.equals(NULL_STRING)) { } else if (!function.equals(NULL_STRING)) {
// function location without source // function location without source
location = function; location = function;
} else if (location.length() > 0) { } else if (!location.isEmpty()) {
// address location // address location
if (Character.isDigit(location.charAt(0))) { if (Character.isDigit(location.charAt(0))) {
// numeric address needs '*' prefix // numeric address needs '*' prefix
@ -749,7 +749,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
boolean isRead = (Boolean) getProperty(attributes, READ, false); boolean isRead = (Boolean) getProperty(attributes, READ, false);
boolean isWrite = (Boolean) getProperty(attributes, WRITE, false); boolean isWrite = (Boolean) getProperty(attributes, WRITE, false);
if (expression.length() > 0 && Character.isDigit(expression.charAt(0))) { if (!expression.isEmpty() && Character.isDigit(expression.charAt(0))) {
// If expression is an address, we need the '*' prefix. // If expression is an address, we need the '*' prefix.
expression = "*" + expression; //$NON-NLS-1$ expression = "*" + expression; //$NON-NLS-1$
} }

View file

@ -345,7 +345,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
&& ((IMIExecutionDMContext)c).getThreadId() != threadId) && ((IMIExecutionDMContext)c).getThreadId() != threadId)
list.add(c); list.add(c);
} }
if (list.size() > 0) { if (!list.isEmpty()) {
bpExtension.setThreadFilters(list.toArray(new IExecutionDMContext[list.size()])); bpExtension.setThreadFilters(list.toArray(new IExecutionDMContext[list.size()]));
} }
else { else {

View file

@ -1773,7 +1773,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
int castingIndex = castInfo.getArrayStartIndex(); int castingIndex = castInfo.getArrayStartIndex();
// cast to type // cast to type
if (castType != null && castType.length() > 0) { if (castType != null && !castType.isEmpty()) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append('(').append(castType).append(')'); buffer.append('(').append(castType).append(')');
buffer.append('(').append(castExpression).append(')'); buffer.append('(').append(castExpression).append(')');

View file

@ -481,7 +481,7 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
List<MIRegisterDMC> regDmcList = new ArrayList<MIRegisters.MIRegisterDMC>( regNames.length ); List<MIRegisterDMC> regDmcList = new ArrayList<MIRegisters.MIRegisterDMC>( regNames.length );
int regNo = 0; int regNo = 0;
for (String regName : regNames) { for (String regName : regNames) {
if(regName != null && regName.length() > 0) { if(regName != null && !regName.isEmpty()) {
if(frameDmc != null) if(frameDmc != null)
regDmcList.add(new MIRegisterDMC(this, groupDmc, frameDmc, regNo, regName)); regDmcList.add(new MIRegisterDMC(this, groupDmc, frameDmc, regNo, regName));
else else

View file

@ -1202,7 +1202,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
protected void handleSuccess() { protected void handleSuccess() {
fOngoingOperation = false; fOngoingOperation = false;
if (fOperationsPending.size() > 0) { if (!fOperationsPending.isEmpty()) {
// Darn, more operations came in. Trigger their processing // Darn, more operations came in. Trigger their processing
// by calling executeWithTargetAvailable() on the last one // by calling executeWithTargetAvailable() on the last one
TargetAvailableOperationInfo info = fOperationsPending.removeLast(); TargetAvailableOperationInfo info = fOperationsPending.removeLast();
@ -1218,7 +1218,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
fOngoingOperation = false; fOngoingOperation = false;
// Complete each rm of the cancelled operations // Complete each rm of the cancelled operations
while (fOperationsPending.size() > 0) { while (!fOperationsPending.isEmpty()) {
RequestMonitor rm = fOperationsPending.poll().rm; RequestMonitor rm = fOperationsPending.poll().rm;
rm.setStatus(getStatus()); rm.setStatus(getStatus());
rm.done(); rm.done();
@ -1367,7 +1367,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
// All pending operations are independent of each other so we can // All pending operations are independent of each other so we can
// run them concurrently. // run them concurrently.
while (fOperationsPending.size() > 0) { while (!fOperationsPending.isEmpty()) {
executeSteps(fOperationsPending.poll()); executeSteps(fOperationsPending.poll());
} }
} }

View file

@ -760,7 +760,7 @@ public class MIVariableManager implements ICommandControl {
private void unlock() { private void unlock() {
locked = false; locked = false;
while (operationsPending.size() > 0) { while (!operationsPending.isEmpty()) {
operationsPending.poll().done(); operationsPending.poll().done();
} }
} }
@ -777,7 +777,7 @@ public class MIVariableManager implements ICommandControl {
// can tell any pending monitors that updates are done // can tell any pending monitors that updates are done
if (success) { if (success) {
currentState = STATE_READY; currentState = STATE_READY;
while (updatesPending.size() > 0) { while (!updatesPending.isEmpty()) {
DataRequestMonitor<Boolean> rm = updatesPending.poll(); DataRequestMonitor<Boolean> rm = updatesPending.poll();
// Nothing to be re-created // Nothing to be re-created
rm.setData(false); rm.setData(false);
@ -787,7 +787,7 @@ public class MIVariableManager implements ICommandControl {
currentState = STATE_CREATION_FAILED; currentState = STATE_CREATION_FAILED;
// Creation failed, inform anyone waiting. // Creation failed, inform anyone waiting.
while (updatesPending.size() > 0) { while (!updatesPending.isEmpty()) {
RequestMonitor rm = updatesPending.poll(); RequestMonitor rm = updatesPending.poll();
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE,
"Unable to create variable object", null)); //$NON-NLS-1$ "Unable to create variable object", null)); //$NON-NLS-1$
@ -828,7 +828,7 @@ public class MIVariableManager implements ICommandControl {
// All the other request monitors must be notified but must // All the other request monitors must be notified but must
// not re-create the object, even if it is out-of-scope // not re-create the object, even if it is out-of-scope
while (updatesPending.size() > 0) { while (!updatesPending.isEmpty()) {
DataRequestMonitor<Boolean> pendingRm = updatesPending.poll(); DataRequestMonitor<Boolean> pendingRm = updatesPending.poll();
pendingRm.setData(false); pendingRm.setData(false);
pendingRm.done(); pendingRm.done();
@ -837,7 +837,7 @@ public class MIVariableManager implements ICommandControl {
rm.setStatus(getStatus()); rm.setStatus(getStatus());
rm.done(); rm.done();
while (updatesPending.size() > 0) { while (!updatesPending.isEmpty()) {
DataRequestMonitor<Boolean> pendingRm = updatesPending.poll(); DataRequestMonitor<Boolean> pendingRm = updatesPending.poll();
pendingRm.setStatus(getStatus()); pendingRm.setStatus(getStatus());
pendingRm.done(); pendingRm.done();
@ -1274,7 +1274,7 @@ public class MIVariableManager implements ICommandControl {
rm.setData(getData()); rm.setData(getData());
rm.done(); rm.done();
while (fetchChildrenPending.size() > 0) { while (!fetchChildrenPending.isEmpty()) {
DataRequestMonitor<ChildrenInfo> pendingRm = fetchChildrenPending.poll(); DataRequestMonitor<ChildrenInfo> pendingRm = fetchChildrenPending.poll();
pendingRm.setData(getData()); pendingRm.setData(getData());
pendingRm.done(); pendingRm.done();
@ -1283,7 +1283,7 @@ public class MIVariableManager implements ICommandControl {
rm.setStatus(getStatus()); rm.setStatus(getStatus());
rm.done(); rm.done();
while (fetchChildrenPending.size() > 0) { while (!fetchChildrenPending.isEmpty()) {
DataRequestMonitor<ChildrenInfo> pendingRm = fetchChildrenPending.poll(); DataRequestMonitor<ChildrenInfo> pendingRm = fetchChildrenPending.poll();
pendingRm.setStatus(getStatus()); pendingRm.setStatus(getStatus());
pendingRm.done(); pendingRm.done();
@ -2285,7 +2285,7 @@ public class MIVariableManager implements ICommandControl {
rm.setData(true); rm.setData(true);
rm.done(); rm.done();
while (updatesPending.size() > 0) { while (!updatesPending.isEmpty()) {
DataRequestMonitor<Boolean> pendingRm = updatesPending.poll(); DataRequestMonitor<Boolean> pendingRm = updatesPending.poll();
pendingRm.setData(false); pendingRm.setData(false);
pendingRm.done(); pendingRm.done();
@ -2309,7 +2309,7 @@ public class MIVariableManager implements ICommandControl {
} }
rm.done(); rm.done();
while (updatesPending.size() > 0) { while (!updatesPending.isEmpty()) {
DataRequestMonitor<Boolean> pendingRm = updatesPending.poll(); DataRequestMonitor<Boolean> pendingRm = updatesPending.poll();
if (isSuccess()) { if (isSuccess()) {
pendingRm.setData(false); pendingRm.setData(false);
@ -2328,7 +2328,7 @@ public class MIVariableManager implements ICommandControl {
rm.setData(false); rm.setData(false);
rm.done(); rm.done();
while (updatesPending.size() > 0) { while (!updatesPending.isEmpty()) {
DataRequestMonitor<Boolean> pendingRm = updatesPending.poll(); DataRequestMonitor<Boolean> pendingRm = updatesPending.poll();
pendingRm.setStatus(getStatus()); pendingRm.setStatus(getStatus());
pendingRm.done(); pendingRm.done();

View file

@ -360,7 +360,7 @@ public abstract class AbstractMIControl extends AbstractDsfService
} }
private void processNextQueuedCommand() { private void processNextQueuedCommand() {
if (fCommandQueue.size() > 0) { if (!fCommandQueue.isEmpty()) {
final CommandHandle handle = fCommandQueue.remove(0); final CommandHandle handle = fCommandQueue.remove(0);
if (handle != null) { if (handle != null) {
processCommandSent(handle); processCommandSent(handle);

View file

@ -106,7 +106,7 @@ public class MIBreakInsert extends MICommand<MIBreakInsertInfo>
if (isHardware) { if (isHardware) {
i++; i++;
} }
if (condition != null && condition.length() > 0) { if (condition != null && !condition.isEmpty()) {
i += 2; i += 2;
} }
if (ignoreCount > 0) { if (ignoreCount > 0) {
@ -138,7 +138,7 @@ public class MIBreakInsert extends MICommand<MIBreakInsertInfo>
opts[i] = "-h"; //$NON-NLS-1$ opts[i] = "-h"; //$NON-NLS-1$
i++; i++;
} }
if (condition != null && condition.length() > 0) { if (condition != null && !condition.isEmpty()) {
opts[i] = "-c"; //$NON-NLS-1$ opts[i] = "-c"; //$NON-NLS-1$
i++; i++;
opts[i] = condition; opts[i] = condition;

View file

@ -166,11 +166,11 @@ public class MICommand<V extends MIInfo> implements ICommand<V> {
} }
String opt = optionsToString(); String opt = optionsToString();
if (opt.length() > 0) { if (!opt.isEmpty()) {
command.append(' ').append(opt); command.append(' ').append(opt);
} }
String p = parametersToString(); String p = parametersToString();
if (p.length() > 0) { if (!p.isEmpty()) {
command.append(' ').append(p); command.append(' ').append(p);
} }
command.append('\n'); command.append('\n');
@ -212,7 +212,7 @@ public class MICommand<V extends MIInfo> implements ICommand<V> {
protected String optionsToString() { protected String optionsToString() {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if (fOptions != null && fOptions.size() > 0) { if (fOptions != null && !fOptions.isEmpty()) {
for (Adjustable option : fOptions) { for (Adjustable option : fOptions) {
sb.append(option.getAdjustedValue()); sb.append(option.getAdjustedValue());
} }
@ -223,7 +223,7 @@ public class MICommand<V extends MIInfo> implements ICommand<V> {
protected String parametersToString() { protected String parametersToString() {
String[] options = getOptions(); String[] options = getOptions();
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
if (fParameters != null && fParameters.size() > 0) { if (fParameters != null && !fParameters.isEmpty()) {
// According to GDB/MI spec // According to GDB/MI spec
// Add a "--" separator if any parameters start with "-" // Add a "--" separator if any parameters start with "-"
if (options != null && options.length > 0) { if (options != null && options.length > 0) {

View file

@ -71,7 +71,7 @@ public class MIDPrintfInsert extends MICommand<MIBreakInsertInfo>
if (isTemporary) { if (isTemporary) {
i++; i++;
} }
if (condition != null && condition.length() > 0) { if (condition != null && !condition.isEmpty()) {
i += 2; i += 2;
} }
if (ignoreCount > 0) { if (ignoreCount > 0) {
@ -95,7 +95,7 @@ public class MIDPrintfInsert extends MICommand<MIBreakInsertInfo>
opts[i] = "-t"; //$NON-NLS-1$ opts[i] = "-t"; //$NON-NLS-1$
i++; i++;
} }
if (condition != null && condition.length() > 0) { if (condition != null && !condition.isEmpty()) {
opts[i] = "-c"; //$NON-NLS-1$ opts[i] = "-c"; //$NON-NLS-1$
i++; i++;
opts[i] = condition; opts[i] = condition;

View file

@ -57,7 +57,7 @@ public class CLIInfoProgramInfo extends MIInfo {
// Program stopped at 0x4012f5. // Program stopped at 0x4012f5.
// It stopped at a breakpoint that has since been deleted. // It stopped at a breakpoint that has since been deleted.
if (str != null && str.length() > 0) { if (str != null && !str.isEmpty()) {
str = str.replace('.', ' ').trim(); str = str.replace('.', ' ').trim();
if (str.startsWith("Using")) { //$NON-NLS-1$ if (str.startsWith("Using")) { //$NON-NLS-1$
StringTokenizer st = new StringTokenizer(str); StringTokenizer st = new StringTokenizer(str);

View file

@ -88,7 +88,7 @@ public class CLIInfoSharedLibraryInfo extends MIInfo {
} }
void parseShared(String str, List<DsfMISharedInfo> aList) { void parseShared(String str, List<DsfMISharedInfo> aList) {
if (str.length() > 0) { if (!str.isEmpty()) {
// Parsing pattern of type ~"0x40000970 0x4001331f Yes /lib/ld-linux.so.2\n" // Parsing pattern of type ~"0x40000970 0x4001331f Yes /lib/ld-linux.so.2\n"
Pattern pattern = Pattern.compile("(0x.*)(0x.*)(Yes|No)(\\s*)(.*)", Pattern.MULTILINE); //$NON-NLS-1$ Pattern pattern = Pattern.compile("(0x.*)(0x.*)(Yes|No)(\\s*)(.*)", Pattern.MULTILINE); //$NON-NLS-1$
Matcher matcher = pattern.matcher(str); Matcher matcher = pattern.matcher(str);

View file

@ -141,7 +141,7 @@ public class CLIInfoThreadsInfo extends MIInfo {
// The original code favored the format in example A and so we will // The original code favored the format in example A and so we will
// continue to give it precedence. The newly added support for formats // continue to give it precedence. The newly added support for formats
// B and C will have lower precedence. // B and C will have lower precedence.
if(str.length() > 0 ){ if(!str.isEmpty() ){
Matcher matcher = RESULT_PATTERN_LWP.matcher(str); // example A Matcher matcher = RESULT_PATTERN_LWP.matcher(str); // example A
boolean isCurrentThread = false; boolean isCurrentThread = false;
if (matcher.find()) { if (matcher.find()) {

View file

@ -51,7 +51,7 @@ public class CLIThreadInfo extends MIInfo {
protected void parseThreadInfo(String str) { protected void parseThreadInfo(String str) {
// Fetch the OS ThreadId & Find the current thread // Fetch the OS ThreadId & Find the current thread
if(str.length() > 0 ){ if(!str.isEmpty() ){
Pattern pattern = Pattern.compile("Current thread is (\\d+)", Pattern.MULTILINE); //$NON-NLS-1$ Pattern pattern = Pattern.compile("Current thread is (\\d+)", Pattern.MULTILINE); //$NON-NLS-1$
Matcher matcher = pattern.matcher(str); Matcher matcher = pattern.matcher(str);
if (matcher.find()) { if (matcher.find()) {

View file

@ -42,7 +42,7 @@ public class CLITraceInfo extends MIInfo {
if (oobs[i] instanceof MIConsoleStreamOutput) { if (oobs[i] instanceof MIConsoleStreamOutput) {
MIStreamRecord cons = (MIStreamRecord) oobs[i]; MIStreamRecord cons = (MIStreamRecord) oobs[i];
String str = cons.getString().trim(); String str = cons.getString().trim();
if(str.length() > 0 ){ if(!str.isEmpty() ){
Pattern pattern = Pattern.compile("^Tracepoint\\s(\\d+)", Pattern.MULTILINE); //$NON-NLS-1$ Pattern pattern = Pattern.compile("^Tracepoint\\s(\\d+)", Pattern.MULTILINE); //$NON-NLS-1$
Matcher matcher = pattern.matcher(str); Matcher matcher = pattern.matcher(str);
if (matcher.find()) { if (matcher.find()) {

View file

@ -67,7 +67,7 @@ public class MIDataListRegisterNamesInfo extends MIInfo {
/* this cannot filter nulls because index is critical in retreival /* this cannot filter nulls because index is critical in retreival
* and index is assigned in the layers above. The MI spec allows * and index is assigned in the layers above. The MI spec allows
* empty returns, for some register names. */ * empty returns, for some register names. */
if (str != null && str.length() > 0) { if (str != null && !str.isEmpty()) {
realNameCount++; realNameCount++;
aList.add(str); aList.add(str);
} else { } else {

View file

@ -245,7 +245,7 @@ public class MIListThreadGroupsInfo extends MIInfo {
// The brackets indicate that the startup parameters are not available // The brackets indicate that the startup parameters are not available
// We handle this case by removing the brackets and the core indicator // We handle this case by removing the brackets and the core indicator
// since GDB already tells us the core separately. // since GDB already tells us the core separately.
if (desc.length() > 0 && desc.charAt(0) == '[') { if (!desc.isEmpty() && desc.charAt(0) == '[') {
// Remove brackets // Remove brackets
name = desc.substring(1, desc.length()-1); name = desc.substring(1, desc.length()-1);

View file

@ -42,7 +42,7 @@ public class MIResult {
if (value != null) { if (value != null) {
String v = value.toString(); String v = value.toString();
buffer.append('='); buffer.append('=');
if (v.length() > 0 && (v.charAt(0) == '[' || v.charAt(0) =='{')) { if (!v.isEmpty() && (v.charAt(0) == '[' || v.charAt(0) =='{')) {
buffer.append(v); buffer.append(v);
} else { } else {
buffer.append("\"" + value.toString() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("\"" + value.toString() + "\""); //$NON-NLS-1$ //$NON-NLS-2$

View file

@ -105,7 +105,7 @@ public class CSourceNotFoundDescriptionFactory implements IAdapterFactory {
String file = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FILE); String file = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FILE);
String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION); String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION);
String module = (String)properties.get(ILaunchVMConstants.PROP_FRAME_MODULE); String module = (String)properties.get(ILaunchVMConstants.PROP_FRAME_MODULE);
if (line != null && line >= 0 && file != null && file.length() > 0) if (line != null && line >= 0 && file != null && !file.isEmpty())
{ {
if (function != null && function.contains(")")) //$NON-NLS-1$ if (function != null && function.contains(")")) //$NON-NLS-1$
formatString = MessagesForLaunchVM.StackFramesVMNode_No_columns__text_format; formatString = MessagesForLaunchVM.StackFramesVMNode_No_columns__text_format;
@ -119,7 +119,7 @@ public class CSourceNotFoundDescriptionFactory implements IAdapterFactory {
ILaunchVMConstants.PROP_FRAME_COLUMN, ILaunchVMConstants.PROP_FRAME_COLUMN,
ILaunchVMConstants.PROP_FRAME_MODULE}; ILaunchVMConstants.PROP_FRAME_MODULE};
} }
else if (function != null && function.length() > 0 && module != null && module.length() > 0) else if (function != null && !function.isEmpty() && module != null && !module.isEmpty())
{ {
if (function.contains(")")) //$NON-NLS-1$ if (function.contains(")")) //$NON-NLS-1$
formatString = MessagesForLaunchVM.StackFramesVMNode_No_columns__No_line__text_format; formatString = MessagesForLaunchVM.StackFramesVMNode_No_columns__No_line__text_format;
@ -130,14 +130,14 @@ public class CSourceNotFoundDescriptionFactory implements IAdapterFactory {
ILaunchVMConstants.PROP_FRAME_FUNCTION, ILaunchVMConstants.PROP_FRAME_FUNCTION,
ILaunchVMConstants.PROP_FRAME_MODULE}; ILaunchVMConstants.PROP_FRAME_MODULE};
} }
else if (module != null && module.length() > 0) else if (module != null && !module.isEmpty())
{ {
formatString = MessagesForLaunchVM.StackFramesVMNode_No_columns__No_function__text_format; formatString = MessagesForLaunchVM.StackFramesVMNode_No_columns__No_function__text_format;
propertyNames = new String[] { propertyNames = new String[] {
ILaunchVMConstants.PROP_FRAME_ADDRESS, ILaunchVMConstants.PROP_FRAME_ADDRESS,
ILaunchVMConstants.PROP_FRAME_MODULE}; ILaunchVMConstants.PROP_FRAME_MODULE};
} }
else if (function != null && function.length() > 0) else if (function != null && !function.isEmpty())
{ {
if (function.contains(")")) //$NON-NLS-1$ if (function.contains(")")) //$NON-NLS-1$
formatString = MessagesForLaunchVM.StackFramesVMNode_No_columns__No_module__text_format; formatString = MessagesForLaunchVM.StackFramesVMNode_No_columns__No_module__text_format;

View file

@ -716,7 +716,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
String compilationPath= null; String compilationPath= null;
// insert symbol label // insert symbol label
final String functionName= instruction.getFuntionName(); final String functionName= instruction.getFuntionName();
if (functionName != null && functionName.length() > 0 && instruction.getOffset() == 0) { if (functionName != null && !functionName.isEmpty() && instruction.getOffset() == 0) {
p = fCallback.getDocument().insertLabel(p, address, functionName, showSymbols && (!hasSource || showDisassembly)); p = fCallback.getDocument().insertLabel(p, address, functionName, showSymbols && (!hasSource || showDisassembly));
} }
// determine instruction byte length // determine instruction byte length
@ -735,7 +735,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
} }
final String functionOffset; // Renamed from opCode to avoid confusion final String functionOffset; // Renamed from opCode to avoid confusion
// insert function name+offset instead of opcode bytes // insert function name+offset instead of opcode bytes
if (functionName != null && functionName.length() > 0) { if (functionName != null && !functionName.isEmpty()) {
functionOffset= functionName + '+' + instruction.getOffset(); functionOffset= functionName + '+' + instruction.getOffset();
} else { } else {
functionOffset= ""; //$NON-NLS-1$ functionOffset= ""; //$NON-NLS-1$
@ -843,7 +843,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
} }
// insert symbol label // insert symbol label
final String functionName= instruction.getFuntionName(); final String functionName= instruction.getFuntionName();
if (functionName != null && functionName.length() > 0 && instruction.getOffset() == 0) { if (functionName != null && !functionName.isEmpty() && instruction.getOffset() == 0) {
p = fCallback.getDocument().insertLabel(p, address, functionName, showSymbols && (!hasSource || showDisassembly)); p = fCallback.getDocument().insertLabel(p, address, functionName, showSymbols && (!hasSource || showDisassembly));
} }
// determine instruction byte length // determine instruction byte length
@ -875,7 +875,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
} }
final String funcOffset; final String funcOffset;
// insert function name+offset instead of opcode bytes // insert function name+offset instead of opcode bytes
if (functionName != null && functionName.length() > 0) { if (functionName != null && !functionName.isEmpty()) {
funcOffset= functionName + '+' + instruction.getOffset(); funcOffset= functionName + '+' + instruction.getOffset();
} else { } else {
funcOffset= ""; //$NON-NLS-1$ funcOffset= ""; //$NON-NLS-1$

View file

@ -2195,7 +2195,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
bpList.add(bp); bpList.add(bp);
} }
} }
if (bpList.size() > 0) { if (!bpList.isEmpty()) {
return bpList.toArray(new IBreakpoint[bpList.size()]); return bpList.toArray(new IBreakpoint[bpList.size()]);
} }
} }
@ -2422,7 +2422,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
return; return;
} }
AddressRangePosition first = null; AddressRangePosition first = null;
if (fPCHistory.size() > 0) { if (!fPCHistory.isEmpty()) {
first = fPCHistory.getFirst(); first = fPCHistory.getFirst();
if (first.fAddressOffset == pcPos.fAddressOffset) { if (first.fAddressOffset == pcPos.fAddressOffset) {
if (first.offset != pcPos.offset || first.length != pcPos.length) { if (first.offset != pcPos.offset || first.length != pcPos.length) {
@ -2898,7 +2898,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
} }
} }
} }
if (styleRanges.size() > 0) { if (!styleRanges.isEmpty()) {
for (Iterator<StyleRange> iter = styleRanges.iterator(); iter.hasNext();) { for (Iterator<StyleRange> iter = styleRanges.iterator(); iter.hasNext();) {
textPresentation.addStyleRange(iter.next()); textPresentation.addStyleRange(iter.next());
} }

View file

@ -241,7 +241,7 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
if (string.startsWith("0x")) { //$NON-NLS-1$ if (string.startsWith("0x")) { //$NON-NLS-1$
return new BigInteger(string.substring(2), 16); return new BigInteger(string.substring(2), 16);
} }
if (string.length() > 0) { if (!string.isEmpty()) {
return new BigInteger(string); return new BigInteger(string);
} }
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
@ -263,7 +263,7 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
*/ */
@Override @Override
public void documentChanged(DocumentEvent event) { public void documentChanged(DocumentEvent event) {
if (fCatchup == null && event.fText != null && event.fText.length() > 0) { if (fCatchup == null && event.fText != null && !event.fText.isEmpty()) {
fCatchup= new Runnable() { fCatchup= new Runnable() {
@Override @Override
public void run() { public void run() {

View file

@ -1052,7 +1052,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
buf.append(':'); buf.append(':');
buf.append(' '); buf.append(' ');
} }
if (fShowFunctionOffset && functionOffset != null && functionOffset.length() > 0) { if (fShowFunctionOffset && functionOffset != null && !functionOffset.isEmpty()) {
buf.append(functionOffset); buf.append(functionOffset);
int tab = 16; int tab = 16;
if (functionOffset.length() >= 16) { if (functionOffset.length() >= 16) {
@ -1215,7 +1215,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
// System.out.println("insertSource at "+getAddressText(pos.fAddressOffset)); // System.out.println("insertSource at "+getAddressText(pos.fAddressOffset));
// System.out.println(source); // System.out.println(source);
String sourceLines = source; String sourceLines = source;
if (source.length() > 0 && sourceLines.charAt(source.length() - 1) != '\n') { if (!source.isEmpty() && sourceLines.charAt(source.length() - 1) != '\n') {
sourceLines += "\n"; //$NON-NLS-1$ sourceLines += "\n"; //$NON-NLS-1$
} }
try { try {
@ -1413,7 +1413,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
public boolean hasInvalidSourcePositions() { public boolean hasInvalidSourcePositions() {
assert isGuiThread(); assert isGuiThread();
return fInvalidSource.size() > 0; return !fInvalidSource.isEmpty();
} }
public void invalidateDisassemblyWithSource(boolean removeDisassembly) { public void invalidateDisassemblyWithSource(boolean removeDisassembly) {

View file

@ -35,7 +35,7 @@ public class REDRun implements CharSequence {
/** /**
* @pre rider != null * @pre rider != null
* @pre style != null * @pre style != null
* @pre str.length() > 0 * @pre !str.isEmpty()
*/ */
public REDRun(IFileRider rider, String str) throws IOException { public REDRun(IFileRider rider, String str) throws IOException {
fRider = rider; fRider = rider;

View file

@ -218,7 +218,7 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
// see also getHoverControlCreator() // see also getHoverControlCreator()
final String text; final String text;
text= getExpressionText(textViewer, hoverRegion); text= getExpressionText(textViewer, hoverRegion);
if (text != null && text.length() > 0) { if (text != null && !text.isEmpty()) {
final IFrameDMContext frameDmc = getFrame(); final IFrameDMContext frameDmc = getFrame();
if (frameDmc != null) { if (frameDmc != null) {
final DsfSession dsfSession = DsfSession.getSession(frameDmc.getSessionId()); final DsfSession dsfSession = DsfSession.getSession(frameDmc.getSessionId());

View file

@ -173,7 +173,7 @@ public class StackFramesVMNode extends AbstractDMVMNode
Integer line = (Integer)properties.get(ILaunchVMConstants.PROP_FRAME_LINE); Integer line = (Integer)properties.get(ILaunchVMConstants.PROP_FRAME_LINE);
String file = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FILE); String file = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FILE);
String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION); String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION);
return line != null && line >= 0 && file != null && file.length() > 0 && return line != null && line >= 0 && file != null && !file.isEmpty() &&
function != null && function.contains(")"); //$NON-NLS-1$ function != null && function.contains(")"); //$NON-NLS-1$
}; };
}, },
@ -192,7 +192,7 @@ public class StackFramesVMNode extends AbstractDMVMNode
Integer line = (Integer)properties.get(ILaunchVMConstants.PROP_FRAME_LINE); Integer line = (Integer)properties.get(ILaunchVMConstants.PROP_FRAME_LINE);
String file = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FILE); String file = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FILE);
String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION); String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION);
return line != null && line >= 0 && file != null && file.length() > 0 && return line != null && line >= 0 && file != null && !file.isEmpty() &&
(function == null || !function.contains(")")); //$NON-NLS-1$ (function == null || !function.contains(")")); //$NON-NLS-1$
}; };
}, },
@ -207,8 +207,8 @@ public class StackFramesVMNode extends AbstractDMVMNode
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) { public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION); String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION);
String module = (String)properties.get(ILaunchVMConstants.PROP_FRAME_MODULE); String module = (String)properties.get(ILaunchVMConstants.PROP_FRAME_MODULE);
return function != null && function.length() > 0 && function.contains(")") && //$NON-NLS-1$ return function != null && !function.isEmpty() && function.contains(")") && //$NON-NLS-1$
module != null && module.length() > 0; module != null && !module.isEmpty();
}; };
}, },
new LabelText( new LabelText(
@ -222,8 +222,8 @@ public class StackFramesVMNode extends AbstractDMVMNode
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) { public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION); String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION);
String module = (String)properties.get(ILaunchVMConstants.PROP_FRAME_MODULE); String module = (String)properties.get(ILaunchVMConstants.PROP_FRAME_MODULE);
return function != null && function.length() > 0 && !function.contains(")") && //$NON-NLS-1$ return function != null && !function.isEmpty() && !function.contains(")") && //$NON-NLS-1$
module != null && module.length() > 0; module != null && !module.isEmpty();
}; };
}, },
new LabelText( new LabelText(
@ -235,7 +235,7 @@ public class StackFramesVMNode extends AbstractDMVMNode
@Override @Override
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) { public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
String module = (String)properties.get(ILaunchVMConstants.PROP_FRAME_MODULE); String module = (String)properties.get(ILaunchVMConstants.PROP_FRAME_MODULE);
return module != null && module.length() > 0; return module != null && !module.isEmpty();
}; };
}, },
new LabelText( new LabelText(
@ -247,7 +247,7 @@ public class StackFramesVMNode extends AbstractDMVMNode
@Override @Override
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) { public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION); String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION);
return function != null && function.length() > 0 && function.contains(")"); //$NON-NLS-1$ return function != null && !function.isEmpty() && function.contains(")"); //$NON-NLS-1$
}; };
}, },
new LabelText( new LabelText(
@ -259,7 +259,7 @@ public class StackFramesVMNode extends AbstractDMVMNode
@Override @Override
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) { public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION); String function = (String)properties.get(ILaunchVMConstants.PROP_FRAME_FUNCTION);
return function != null && function.length() > 0 && !function.contains(")"); //$NON-NLS-1$ return function != null && !function.isEmpty() && !function.contains(")"); //$NON-NLS-1$
}; };
}, },
new LabelText( new LabelText(

View file

@ -156,7 +156,7 @@ public class ElementNumberFormatProvider implements IElementFormatProvider
final CountingRequestMonitor crm = new ImmediateCountingRequestMonitor() { final CountingRequestMonitor crm = new ImmediateCountingRequestMonitor() {
@Override @Override
protected void handleCompleted() { protected void handleCompleted() {
if (elementsToRefresh.size() > 0) { if (!elementsToRefresh.isEmpty()) {
// Send the event to all DSF sessions as they share the same view and the // Send the event to all DSF sessions as they share the same view and the
// change of format will affect them as well. This is because they key // change of format will affect them as well. This is because they key
// we use from this implementation of getElementKey() is not specific to // we use from this implementation of getElementKey() is not specific to

View file

@ -129,7 +129,7 @@ public class VMChildrenUpdate extends VMViewerUpdate implements IChildrenUpdate
if (VMViewerUpdateTracing.DEBUG_VMUPDATES && !isCanceled() && VMViewerUpdateTracing.matchesFilterRegex(this.getClass())) { if (VMViewerUpdateTracing.DEBUG_VMUPDATES && !isCanceled() && VMViewerUpdateTracing.matchesFilterRegex(this.getClass())) {
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
str.append(DsfPlugin.getDebugTime() + " " + LoggingUtils.toString(this) + " marked done; element = " + LoggingUtils.toString(getElement())); //$NON-NLS-1$ //$NON-NLS-2$ str.append(DsfPlugin.getDebugTime() + " " + LoggingUtils.toString(this) + " marked done; element = " + LoggingUtils.toString(getElement())); //$NON-NLS-1$ //$NON-NLS-2$
if (fElements != null && fElements.size() > 0) { if (fElements != null && !fElements.isEmpty()) {
for (Object element : fElements) { for (Object element : fElements) {
str.append(" " + LoggingUtils.toString(element) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ str.append(" " + LoggingUtils.toString(element) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
} }

View file

@ -650,7 +650,7 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
DsfUIPlugin.debug("cachePartialHitChildren(node = " + node + ", update = " + update + ", missing = " + childrenMissingFromCache + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ DsfUIPlugin.debug("cachePartialHitChildren(node = " + node + ", update = " + update + ", missing = " + childrenMissingFromCache + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} }
if (childrenMissingFromCache.size() > 0) { if (!childrenMissingFromCache.isEmpty()) {
// Note: it is possible that entry.fAllChildrenKnown == true at this point. // Note: it is possible that entry.fAllChildrenKnown == true at this point.
// This can happen if the node's has children implementation returns true // This can happen if the node's has children implementation returns true
// while the actual children update returns with no elements. A node // while the actual children update returns with no elements. A node
@ -662,12 +662,12 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
// proxy updates for the continuous ranges of missing children. // proxy updates for the continuous ranges of missing children.
List<IChildrenUpdate> partialUpdates = new ArrayList<IChildrenUpdate>(2); List<IChildrenUpdate> partialUpdates = new ArrayList<IChildrenUpdate>(2);
final CountingRequestMonitor multiRm = new ViewerCountingRequestMonitor(getExecutor(), update); final CountingRequestMonitor multiRm = new ViewerCountingRequestMonitor(getExecutor(), update);
while(childrenMissingFromCache.size() > 0) while(!childrenMissingFromCache.isEmpty())
{ {
final int offset = childrenMissingFromCache.get(0); final int offset = childrenMissingFromCache.get(0);
childrenMissingFromCache.remove(0); childrenMissingFromCache.remove(0);
int length = 1; int length = 1;
while(childrenMissingFromCache.size() > 0 && childrenMissingFromCache.get(0) == offset + length) while(!childrenMissingFromCache.isEmpty() && childrenMissingFromCache.get(0) == offset + length)
{ {
length++; length++;
childrenMissingFromCache.remove(0); childrenMissingFromCache.remove(0);

View file

@ -478,7 +478,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
Map<IBreakpoint, List<ITargetBreakpointInfo>> platformBPs = fPlatformBPs.get(bpContext); Map<IBreakpoint, List<ITargetBreakpointInfo>> platformBPs = fPlatformBPs.get(bpContext);
if (platformBPs != null && platformBPs.size() > 0) if (platformBPs != null && !platformBPs.isEmpty())
{ {
for(Map.Entry<IBreakpoint, List<ITargetBreakpointInfo>> e: platformBPs.entrySet()) for(Map.Entry<IBreakpoint, List<ITargetBreakpointInfo>> e: platformBPs.entrySet())
{ {
@ -531,7 +531,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
@Override @Override
protected void handleCompleted() { protected void handleCompleted() {
// Store successful targetBPs with the platform breakpoint // Store successful targetBPs with the platform breakpoint
if (targetBPsInstalled.size() > 0) if (!targetBPsInstalled.isEmpty())
platformBPs.put(breakpoint, targetBPsInstalled); platformBPs.put(breakpoint, targetBPsInstalled);
// Store all targetBPs, success or failure, in the rm. // Store all targetBPs, success or failure, in the rm.
@ -871,7 +871,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
final PlatformBreakpointInfo[] oneBPInfo = new PlatformBreakpointInfo[] {bpinfo}; final PlatformBreakpointInfo[] oneBPInfo = new PlatformBreakpointInfo[] {bpinfo};
IBreakpoint[] oneBP = new IBreakpoint[] {bpinfo.breakpoint}; IBreakpoint[] oneBP = new IBreakpoint[] {bpinfo.breakpoint};
if (reinstallContexts.size() > 0) { if (!reinstallContexts.isEmpty()) {
// Check if it's only enablement change (user click enable/disable // Check if it's only enablement change (user click enable/disable
// button or "Skip all breakpoints" button), which is common operation. // button or "Skip all breakpoints" button), which is common operation.
// //
@ -897,7 +897,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
} }
} }
if (updateContexts.size() > 0) if (!updateContexts.isEmpty())
modifyTargetBreakpoints(bpinfo.breakpoint, updateContexts, attrDelta); modifyTargetBreakpoints(bpinfo.breakpoint, updateContexts, attrDelta);
} }
} }
@ -1101,7 +1101,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
pendingEventsList = new LinkedList<PendingEventInfo>(); pendingEventsList = new LinkedList<PendingEventInfo>();
fPendingEvents.put(breakpoint, pendingEventsList); fPendingEvents.put(breakpoint, pendingEventsList);
} }
if (pendingEventsList.size() > 0 && if (!pendingEventsList.isEmpty() &&
pendingEventsList.getLast().fEventType == BreakpointEventType.MODIFIED) { pendingEventsList.getLast().fEventType == BreakpointEventType.MODIFIED) {
pendingEventsList.removeLast(); pendingEventsList.removeLast();
} }