From e2f375fc86f2f2541d33d8b4af8871d524beb090 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Thu, 3 Dec 2015 18:59:45 -0800 Subject: [PATCH] Code cleanup. Change-Id: I8425c6995bad38758234a2bdb43f5bab8cb244d7 --- .../cdt/debug/mi/core/command/MICommand.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java index 33eeddcecfc..627d05ec139 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java @@ -8,15 +8,13 @@ * Contributors: * QNX Software Systems - Initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.debug.mi.core.command; /** - * * Represents a MI command. */ public class MICommand extends Command { - final static String[] empty = new String[0]; + final static String[] empty = {}; String[] fOptions = empty; String[] fParameters = empty; String fOperation = new String(); @@ -112,13 +110,13 @@ public class MICommand extends Command { protected String optionsToString() { String[] options = getOptions(); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (options != null && options.length > 0) { for (int i = 0; i < options.length; i++) { String option = options[i]; // If the option argument contains " or \ it must be escaped if (option.indexOf('"') != -1 || option.indexOf('\\') != -1) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int j = 0; j < option.length(); j++) { char c = option.charAt(j); if (c == '"' || c == '\\') { @@ -144,7 +142,7 @@ public class MICommand extends Command { protected String parametersToString() { String[] parameters = getParameters(); String[] options = getOptions(); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); if (parameters != null && parameters.length > 0) { // According to GDB/MI spec // Add a "--" separator if any parameters start with "-" @@ -157,7 +155,7 @@ public class MICommand extends Command { } } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0; i < parameters.length; i++) { // We need to escape the double quotes and the backslash. sb.setLength(0); @@ -184,7 +182,7 @@ public class MICommand extends Command { @Override public String toString() { - StringBuffer command = new StringBuffer(getToken() + getOperation()); + StringBuilder command = new StringBuilder(getToken() + getOperation()); String opt = optionsToString(); if (opt.length() > 0) { command.append(' ').append(opt);