1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 492230 - Replace buffer.append(a+b) calls

When using a `StringBuilder` or `StringBuffer` to create a string message,
using implicit string concatenation inside an `.append()` call will
create a nested StringBuilder for the purposes of creating the arguments,
which will subsequently be converted to a String and then passed to
the outer StringBuilder.

Skip the creation of the intermediate object and String by simply
replacing such calls with `buffer.append(a).append(b)`.

Where values are compile time String constants, leave as is so
that the javac compiler can perform compile-time String concatenation.
Ensure that NEWLINE isn't appended in such a way since it is not
a compile time constant `System.getProperty("line.separator")`

Change-Id: I4126aefb2272f06b08332e004d7ea76b6f02cdba
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
This commit is contained in:
Alex Blewitt 2016-04-23 00:00:51 +01:00 committed by Sergey Prigogin
parent e21fc12f90
commit 6bdca5f4a2
72 changed files with 344 additions and 330 deletions

View file

@ -303,12 +303,12 @@ public class AutotoolsConfiguration implements IAConfiguration {
IConfigureOption childOption = getOption(childOptions[j].getName()); IConfigureOption childOption = getOption(childOptions[j].getName());
String parameter = childOption.getParameter(); String parameter = childOption.getParameter();
if (!parameter.isEmpty()) if (!parameter.isEmpty())
buf.append(" " + parameter); buf.append(' ').append(parameter);
} }
} else { } else {
String parameter = option.getParameter(); String parameter = option.getParameter();
if (!parameter.isEmpty()) if (!parameter.isEmpty())
buf.append(" " + parameter); buf.append(' ').append(parameter);
} }
} }
return buf.toString(); return buf.toString();

View file

@ -44,23 +44,23 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
for (String flagName : flagNames) { for (String flagName : flagNames) {
parms.append(flagSeparator); parms.append(flagSeparator);
flagSeparator = " "; //$NON-NLS-1$ flagSeparator = " "; //$NON-NLS-1$
StringBuilder parm = new StringBuilder(flagName+"=\""); //$NON-NLS-1$ StringBuilder parm = new StringBuilder(flagName).append("=\""); //$NON-NLS-1$
boolean haveParm = false; boolean haveParm = false;
if (isParmSet()) { if (isParmSet()) {
String separator = ""; String separator = ""; //$NON-NLS-1$
for (int i = 0; i < children.size(); ++i) { for (int i = 0; i < children.size(); ++i) {
String fvname = children.get(i); String fvname = children.get(i);
IConfigureOption o = cfg.getOption(fvname); IConfigureOption o = cfg.getOption(fvname);
if (o.isParmSet()) { if (o.isParmSet()) {
if (o instanceof IFlagConfigureValueOption) { if (o instanceof IFlagConfigureValueOption) {
parm.append(separator + ((IFlagConfigureValueOption)o).getFlags()); //$NON-NLS-1$ parm.append(separator).append(((IFlagConfigureValueOption)o).getFlags());
separator = " "; separator = " "; //$NON-NLS-1$
haveParm = true; haveParm = true;
} }
} }
} }
if (haveParm) { if (haveParm) {
parm.append("\""); //$NON-NLS-1$ parm.append('"');
parms.append(parm); parms.append(parm);
} }
} }

View file

@ -41,25 +41,21 @@ public class AutoconfPartitioner extends FastPartitioner {
public void printPartitions(ITypedRegion[] partitions) public void printPartitions(ITypedRegion[] partitions)
{ {
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < partitions.length; i++) for (int i = 0; i < partitions.length; i++)
{ {
try try
{ {
buffer.append("Partition type: " + partitions[i].getType() //$NON-NLS-1$ System.out.print("Partition type: " + partitions[i].getType() //$NON-NLS-1$
+ ", offset: " + partitions[i].getOffset() //$NON-NLS-1$ + ", offset: " + partitions[i].getOffset() //$NON-NLS-1$
+ ", length: " + partitions[i].getLength()); //$NON-NLS-1$ + ", length: " + partitions[i].getLength() //$NON-NLS-1$
buffer.append("\n"); //$NON-NLS-1$ +"\nText:\n" //$NON-NLS-1$
buffer.append("Text:\n"); //$NON-NLS-1$ + super.fDocument.get(partitions[i].getOffset(), partitions[i].getLength())
buffer.append(super.fDocument.get(partitions[i].getOffset(), partitions[i].getLength())); + "\n---------------------------\n\n\n"); //$NON-NLS-1$
buffer.append("\n---------------------------\n\n\n"); //$NON-NLS-1$
} }
catch (BadLocationException e) catch (BadLocationException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
} }
System.out.print(buffer);
} }
} }

View file

@ -130,7 +130,7 @@ public abstract class AbstractAutotoolsHandler extends AbstractHandler {
if (currentWord.startsWith("'")) { //$NON-NLS-1$ if (currentWord.startsWith("'")) { //$NON-NLS-1$
StringBuilder tmpTarget = new StringBuilder(); StringBuilder tmpTarget = new StringBuilder();
while (!currentWord.endsWith("'")) { //$NON-NLS-1$ while (!currentWord.endsWith("'")) { //$NON-NLS-1$
tmpTarget.append(currentWord + " "); //$NON-NLS-1$ tmpTarget.append(currentWord).append(' ');
if (!st.hasMoreTokens()) { if (!st.hasMoreTokens()) {
// quote not closed properly, so return null // quote not closed properly, so return null
return null; return null;
@ -146,7 +146,7 @@ public abstract class AbstractAutotoolsHandler extends AbstractHandler {
if (currentWord.startsWith("\"")) { //$NON-NLS-1$ if (currentWord.startsWith("\"")) { //$NON-NLS-1$
StringBuilder tmpTarget = new StringBuilder(); StringBuilder tmpTarget = new StringBuilder();
while (!currentWord.endsWith("\"")) { //$NON-NLS-1$ while (!currentWord.endsWith("\"")) { //$NON-NLS-1$
tmpTarget.append(currentWord + " "); //$NON-NLS-1$ tmpTarget.append(currentWord).append(' ');
if (!st.hasMoreTokens()) { if (!st.hasMoreTokens()) {
// double quote not closed properly, so return null // double quote not closed properly, so return null
return null; return null;
@ -340,7 +340,7 @@ public abstract class AbstractAutotoolsHandler extends AbstractHandler {
// POSIX-compliant shells. // POSIX-compliant shells.
StringBuilder command1 = new StringBuilder(strippedCommand); StringBuilder command1 = new StringBuilder(strippedCommand);
for (String arg : argumentList) { for (String arg : argumentList) {
command1.append(" " + arg); command1.append(' ').append(arg);
} }
newArgumentList = new String[] { "-c", command1.toString() }; newArgumentList = new String[] { "-c", command1.toString() };

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2016 Red Hat Inc.. * Copyright (c) 2006, 2016 Red Hat Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -76,7 +76,7 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
StringBuilder toReturn = new StringBuilder(); StringBuilder toReturn = new StringBuilder();
toReturn.append(preReqs[0]); toReturn.append(preReqs[0]);
for (int i = 1; i < preReqs.length; i++) { for (int i = 1; i < preReqs.length; i++) {
toReturn.append(" " + preReqs[i]); toReturn.append(' ').append(preReqs[i]);
} }
return toReturn.toString(); return toReturn.toString();
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2016 Red Hat, Inc. * Copyright (c) 2006, 2016 Red Hat, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -294,7 +294,7 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
Element elem = document.getElementById(name); Element elem = document.getElementById(name);
if (null != elem) { if (null != elem) {
int prototypeCount = 0; int prototypeCount = 0;
buffer.append("<B>Macro:</B> " + name); buffer.append("<B>Macro:</B> ").append(name);
NodeList nl = elem.getChildNodes(); NodeList nl = elem.getChildNodes();
for (int i = 0; i < nl.getLength(); ++i) { for (int i = 0; i < nl.getLength(); ++i) {
Node n = nl.item(i); Node n = nl.item(i);
@ -304,8 +304,11 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
++prototypeCount; ++prototypeCount;
if (prototypeCount == 1) { if (prototypeCount == 1) {
buffer.append(" ("); buffer.append(" (");
} else } else {
buffer.append(" <B>or</B> " + name + " (<I>"); //$NON-NLS-2$ buffer.append(" <B>or</B> "); //$NON-NLS-2$
buffer.append(name);
buffer.append(" (<I>"); //$NON-NLS-2$
}
NodeList varList = n.getChildNodes(); NodeList varList = n.getChildNodes();
for (int j = 0; j < varList.getLength(); ++j) { for (int j = 0; j < varList.getLength(); ++j) {
Node v = varList.item(j); Node v = varList.item(j);
@ -317,10 +320,10 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
if (prototype.length() == 0) if (prototype.length() == 0)
prototype.append(parm); prototype.append(parm);
else else
prototype.append(", " + parm); prototype.append(", ").append(parm);
} }
} }
buffer.append(prototype.toString() + "</I>)<br>"); //$NON-NLS-1$ buffer.append(prototype).append("</I>)<br>"); //$NON-NLS-1$
} }
if (nodeName.equals("synopsis")) { //$NON-NLS-1$ if (nodeName.equals("synopsis")) { //$NON-NLS-1$
Node textNode = n.getLastChild(); Node textNode = n.getLastChild();

View file

@ -77,7 +77,9 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider {
buffer.append(DENDL); buffer.append(DENDL);
buffer.append("COMMANDS := "); //$NON-NLS-1$ buffer.append("COMMANDS := "); //$NON-NLS-1$
for (CCommandDSC cmd : commands) { for (CCommandDSC cmd : commands) {
buffer.append("\t\\"+ENDL+"\t scd_cmd_"); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("\t\\"); //$NON-NLS-1$
buffer.append(ENDL);
buffer.append("\t scd_cmd_"); //$NON-NLS-1$
buffer.append(cmd.getCommandId()); buffer.append(cmd.getCommandId());
} }
buffer.append(DENDL); buffer.append(DENDL);
@ -88,7 +90,9 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider {
buffer.append(cmd.getCommandId()); buffer.append(cmd.getCommandId());
buffer.append(':'); buffer.append(':');
buffer.append(ENDL); buffer.append(ENDL);
buffer.append("\t@echo begin generating scanner info for $@"+ENDL+"\t"); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("\t@echo begin generating scanner info for $@"); //$NON-NLS-1$
buffer.append(ENDL);
buffer.append('\t');
buffer.append(cmd.getSCDRunnableCommand(true, true)); // quote includes and defines buffer.append(cmd.getSCDRunnableCommand(true, true)); // quote includes and defines
for (String arg : prepareArguments(buildInfo.isUseDefaultProviderCommand(providerId))) { for (String arg : prepareArguments(buildInfo.isUseDefaultProviderCommand(providerId))) {
buffer.append(' '); buffer.append(' ');

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2011, 2012 Broadcom Corporation and others. * Copyright (c) 2011, 2016 Broadcom Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -236,7 +236,7 @@ public abstract class AbstractBuilderTest extends TestCase {
int i = 0; int i = 0;
// line number // line number
if (attrs[i] != null) if (attrs[i] != null)
sb.append(" line " + attrs[i]); sb.append(" line ").append(attrs[i]); //$NON-NLS-1$
// severity // severity
if (attrs[++i] != null) { if (attrs[++i] != null) {
switch ((Integer)attrs[i++]) { switch ((Integer)attrs[i++]) {
@ -254,7 +254,7 @@ public abstract class AbstractBuilderTest extends TestCase {
// append the rest of the string fields // append the rest of the string fields
do { do {
if (attrs[i] != null) if (attrs[i] != null)
sb.append(" " + attrs[i]); sb.append(' ').append(attrs[i]);
} while (++i < attrs.length); } while (++i < attrs.length);
// Finally print the string // Finally print the string
System.err.println(sb.toString()); System.err.println(sb.toString());

View file

@ -463,10 +463,10 @@ public class ManagedBuildTestHelper {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("File ").append(testFileLocation.lastSegment()).append(" does not match its benchmark.\n "); buffer.append("File ").append(testFileLocation.lastSegment()).append(" does not match its benchmark.\n ");
buffer.append("expected:\n "); buffer.append("expected:\n ");
buffer.append("\"").append(benchmarkBuffer).append("\""); buffer.append('"').append(benchmarkBuffer).append('"');
buffer.append("\n\n "); buffer.append("\n\n ");
buffer.append("but was:\n "); buffer.append("but was:\n ");
buffer.append("\"").append(testBuffer).append("\""); buffer.append('"').append(testBuffer).append('"');
buffer.append("\n\n "); buffer.append("\n\n ");
buffer.append(">>>>>>>>>>>>>>>start diff: \n"); buffer.append(">>>>>>>>>>>>>>>start diff: \n");
@ -787,10 +787,10 @@ public class ManagedBuildTestHelper {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("File ").append(tFile.getName()).append(" does not match its benchmark.\n "); buffer.append("File ").append(tFile.getName()).append(" does not match its benchmark.\n ");
buffer.append("expected:\n "); buffer.append("expected:\n ");
buffer.append("\"").append(benchmarkBuffer).append("\""); buffer.append('"').append(benchmarkBuffer).append('"');
buffer.append("\n\n "); buffer.append("\n\n ");
buffer.append("but was:\n "); buffer.append("but was:\n ");
buffer.append("\"").append(testBuffer).append("\""); buffer.append('"').append(testBuffer).append('"');
buffer.append("\n\n "); buffer.append("\n\n ");
buffer.append(">>>>>>>>>>>>>>>start diff: \n"); buffer.append(">>>>>>>>>>>>>>>start diff: \n");

View file

@ -538,7 +538,8 @@ public class ResourceDeltaVerifier extends Assert implements IResourceChangeList
checkChildren(delta); checkChildren(delta);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
fMessage.append("Exception during event notification:" + e.getMessage()); fMessage.append("Exception during event notification:");
fMessage.append(e.getMessage());
fIsDeltaValid = false; fIsDeltaValid = false;
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2011 Texas Instruments and others. * Copyright (c) 2011, 2016 Texas Instruments and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -34,11 +34,14 @@ public class CustomOptionCommandGenerator implements IOptionCommandGenerator
if(list != null) { if(list != null) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(option.getCommand()).append('"');
for(String entry : list) { for(String entry : list) {
sb.append(entry + ';'); sb.append(entry).append(';');
} }
return option.getCommand() + '\"' + sb.toString() + '\"'; sb.append('"');
return sb.toString();
} }
} }
catch(Exception x) { catch(Exception x) {

View file

@ -102,7 +102,7 @@ public class Test30_2_CommandLineGenerator implements
else if( varName.compareToIgnoreCase( OUTPUT_PREFIX_PRM_NAME ) == 0 ) sb.append( info.commandOutputPrefix.trim() ); else if( varName.compareToIgnoreCase( OUTPUT_PREFIX_PRM_NAME ) == 0 ) sb.append( info.commandOutputPrefix.trim() );
else if( varName.compareToIgnoreCase( OUTPUT_PRM_NAME ) == 0 ) sb.append( info.commandOutput.trim() ); else if( varName.compareToIgnoreCase( OUTPUT_PRM_NAME ) == 0 ) sb.append( info.commandOutput.trim() );
else if( varName.compareToIgnoreCase( INPUTS_PRM_NAME ) == 0 ) sb.append( info.commandInputs ); else if( varName.compareToIgnoreCase( INPUTS_PRM_NAME ) == 0 ) sb.append( info.commandInputs );
else sb.append( VAR_FIRST_CHAR + VAR_SECOND_CHAR + varName + VAR_FINAL_CHAR ); else sb.append(VAR_FIRST_CHAR).append(VAR_SECOND_CHAR).append(varName).append(VAR_FINAL_CHAR);
} catch( Exception ex ) { } catch( Exception ex ) {
// do nothing for a while // do nothing for a while
} }

View file

@ -87,10 +87,10 @@ public class DbgUtil {
IBuildIOType types[] = inputs ? step.getInputIOTypes() : step.getOutputIOTypes(); IBuildIOType types[] = inputs ? step.getInputIOTypes() : step.getOutputIOTypes();
buf.append("\n"); //$NON-NLS-1$ buf.append('\n');
for(int i = 0; i < types.length; i++){ for(int i = 0; i < types.length; i++){
buf.append("ioType " + i + ":"); //$NON-NLS-1$ //$NON-NLS-2$ buf.append("ioType ").append(i).append(':'); //$NON-NLS-1$
buf.append(ioTypeResources(types[i])); buf.append(ioTypeResources(types[i]));
} }

View file

@ -114,10 +114,13 @@ public class ManagedCommandLineGenerator implements
} }
private String stringArrayToString( String[] array ) { private String stringArrayToString( String[] array ) {
if( array == null || array.length <= 0 ) return ""; // $NON-NLS-1$ if( array == null || array.length <= 0 ) return ""; //$NON-NLS-1$
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for( int i = 0; i < array.length; i++ ) for( int i = 0; i < array.length; i++ ) {
sb.append( array[i] + WHITESPACE ); if(i > 0) // we add whitespace after each but not first so .trim() is a no-op
sb.append(WHITESPACE);
sb.append(array[i]);
}
return sb.toString().trim(); return sb.toString().trim();
} }

View file

@ -996,7 +996,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
if (browseFilterExtensions != null) { if (browseFilterExtensions != null) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for(String ext : browseFilterExtensions) { for(String ext : browseFilterExtensions) {
sb.append(ext + ','); sb.append(ext).append(',');
} }
element.setAttribute(BROWSE_FILTER_EXTENSIONS, sb.toString()); element.setAttribute(BROWSE_FILTER_EXTENSIONS, sb.toString());
} }

View file

@ -2707,7 +2707,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
if(list != null){ if(list != null){
for (String temp : list) { for (String temp : list) {
if(temp.length() > 0 && !temp.equals(EMPTY_QUOTED_STRING)) if(temp.length() > 0 && !temp.equals(EMPTY_QUOTED_STRING))
sb.append( evaluateCommand( listCmd, temp ) + WHITE_SPACE ); sb.append( evaluateCommand( listCmd, temp ) ).append( WHITE_SPACE );
} }
} }
} }

View file

@ -510,21 +510,21 @@ public class ToolReference implements IToolReference {
boolCmd = option.getCommandFalse(); boolCmd = option.getCommandFalse();
} }
if (boolCmd != null && boolCmd.length() > 0) { if (boolCmd != null && boolCmd.length() > 0) {
buf.append(boolCmd + WHITE_SPACE); buf.append(boolCmd).append(WHITE_SPACE);
} }
break; break;
case IOption.ENUMERATED : case IOption.ENUMERATED :
String enumVal = option.getEnumCommand(option.getSelectedEnum()); String enumVal = option.getEnumCommand(option.getSelectedEnum());
if (enumVal.length() > 0) { if (enumVal.length() > 0) {
buf.append(enumVal + WHITE_SPACE); buf.append(enumVal).append(WHITE_SPACE);
} }
break; break;
case IOption.TREE : case IOption.TREE :
String treeVal = option.getCommand(option.getStringValue()); String treeVal = option.getCommand(option.getStringValue());
if (treeVal.length() > 0) { if (treeVal.length() > 0) {
buf.append(treeVal + WHITE_SPACE); buf.append(treeVal).append(WHITE_SPACE);
} }
break; break;
@ -533,7 +533,7 @@ public class ToolReference implements IToolReference {
String val = option.getStringValue(); String val = option.getStringValue();
if (val.length() > 0) { if (val.length() > 0) {
if (strCmd != null) buf.append(strCmd); if (strCmd != null) buf.append(strCmd);
buf.append(val + WHITE_SPACE); buf.append(val).append(WHITE_SPACE);
} }
break; break;
@ -543,7 +543,7 @@ public class ToolReference implements IToolReference {
for (int j = 0; j < list.length; j++) { for (int j = 0; j < list.length; j++) {
String temp = list[j]; String temp = list[j];
if (cmd != null) buf.append(cmd); if (cmd != null) buf.append(cmd);
buf.append(temp + WHITE_SPACE); buf.append(temp).append(WHITE_SPACE);
} }
break; break;
@ -552,7 +552,7 @@ public class ToolReference implements IToolReference {
String[] paths = option.getIncludePaths(); String[] paths = option.getIncludePaths();
for (int j = 0; j < paths.length; j++) { for (int j = 0; j < paths.length; j++) {
String temp = paths[j]; String temp = paths[j];
buf.append(incCmd + temp + WHITE_SPACE); buf.append(incCmd).append(temp).append(WHITE_SPACE);
} }
break; break;
@ -561,7 +561,7 @@ public class ToolReference implements IToolReference {
String[] symbols = option.getDefinedSymbols(); String[] symbols = option.getDefinedSymbols();
for (int j = 0; j < symbols.length; j++) { for (int j = 0; j < symbols.length; j++) {
String temp = symbols[j]; String temp = symbols[j];
buf.append(defCmd + temp + WHITE_SPACE); buf.append(defCmd).append(temp).append(WHITE_SPACE);
} }
break; break;

View file

@ -35,7 +35,6 @@ import org.eclipse.core.resources.IResource;
*/ */
public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerator { public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerator {
private static final String EMPTY_STRING = ""; // $NON-NLS-1$
private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final String[] EMPTY_STRING_ARRAY = new String[0];
public final String WHITESPACE = " "; //$NON-NLS-1$ public final String WHITESPACE = " "; //$NON-NLS-1$
@ -80,7 +79,7 @@ public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerat
// Work out the build-relative path for the output files // Work out the build-relative path for the output files
IContainer resourceLocation = resource.getParent(); IContainer resourceLocation = resource.getParent();
String relativePath = ""; // $NON-NLS-1$ String relativePath = ""; //$NON-NLS-1$
if (resourceLocation != null) { if (resourceLocation != null) {
relativePath += resourceLocation.getProjectRelativePath().toString(); relativePath += resourceLocation.getProjectRelativePath().toString();
} }
@ -96,23 +95,24 @@ public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerat
IManagedBuilderMakefileGenerator.DEP_EXT + IManagedBuilderMakefileGenerator.DEP_EXT +
")'"; //$NON-NLS-1$ ")'"; //$NON-NLS-1$
// Note that X + Y are in-lineable constants by the compiler
// Add the rule that will actually create the right format for the dep // Add the rule that will actually create the right format for the dep
buffer.append(IManagedBuilderMakefileGenerator.TAB + buffer.append(IManagedBuilderMakefileGenerator.TAB
IManagedBuilderMakefileGenerator.ECHO + + IManagedBuilderMakefileGenerator.ECHO
IManagedBuilderMakefileGenerator.WHITESPACE + + IManagedBuilderMakefileGenerator.WHITESPACE
"-n" + //$NON-NLS-1$ + "-n" //$NON-NLS-1$
IManagedBuilderMakefileGenerator.WHITESPACE + + IManagedBuilderMakefileGenerator.WHITESPACE)
depRule + .append(depRule)
IManagedBuilderMakefileGenerator.WHITESPACE + .append(IManagedBuilderMakefileGenerator.WHITESPACE
"$(dir $@)" + //$NON-NLS-1$ + "$(dir $@)" //$NON-NLS-1$
IManagedBuilderMakefileGenerator.WHITESPACE + + IManagedBuilderMakefileGenerator.WHITESPACE
">" + //$NON-NLS-1$ + ">"
IManagedBuilderMakefileGenerator.WHITESPACE + + IManagedBuilderMakefileGenerator.WHITESPACE)
depRule + .append(depRule)
IManagedBuilderMakefileGenerator.WHITESPACE + .append(IManagedBuilderMakefileGenerator.WHITESPACE
IManagedBuilderMakefileGenerator.LOGICAL_AND + + IManagedBuilderMakefileGenerator.LOGICAL_AND
IManagedBuilderMakefileGenerator.WHITESPACE + + IManagedBuilderMakefileGenerator.WHITESPACE
IManagedBuilderMakefileGenerator.LINEBREAK); + IManagedBuilderMakefileGenerator.LINEBREAK);
// Add the line that will do the work to calculate dependencies // Add the line that will do the work to calculate dependencies
IManagedCommandLineInfo cmdLInfo = null; IManagedCommandLineInfo cmdLInfo = null;
@ -293,11 +293,12 @@ public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerat
} }
} }
buffer.append(IManagedBuilderMakefileGenerator.TAB + buffer.append(IManagedBuilderMakefileGenerator.TAB)
buildCmd + .append(buildCmd)
IManagedBuilderMakefileGenerator.WHITESPACE + .append(IManagedBuilderMakefileGenerator.WHITESPACE
">>" + //$NON-NLS-1$ + ">>" //$NON-NLS-1$
IManagedBuilderMakefileGenerator.WHITESPACE + depRule ); + IManagedBuilderMakefileGenerator.WHITESPACE)
.append(depRule);
return buffer.toString(); return buffer.toString();
} }

View file

@ -1057,7 +1057,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Write every macro to the file // Write every macro to the file
for (Entry<String, List<String>> entry : outputMacros.entrySet()) { for (Entry<String, List<String>> entry : outputMacros.entrySet()) {
macroBuffer.append(entry.getKey() + " :="); //$NON-NLS-1$ macroBuffer.append(entry.getKey()).append(" :="); //$NON-NLS-1$
valueList = entry.getValue(); valueList = entry.getValue();
for (String path : valueList) { for (String path : valueList) {
// These macros will also be used within commands. // These macros will also be used within commands.
@ -1152,16 +1152,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Add the macros to the makefile // Add the macros to the makefile
for (Entry<String, List<IPath>> entry : buildSrcVars.entrySet()) { for (Entry<String, List<IPath>> entry : buildSrcVars.entrySet()) {
String macroName = entry.getKey(); String macroName = entry.getKey();
buffer.append(macroName + WHITESPACE + ":=" + WHITESPACE + NEWLINE); //$NON-NLS-1$ buffer.append(macroName).append(WHITESPACE).append(":=").append(WHITESPACE).append(NEWLINE); //$NON-NLS-1$
} }
Set<Entry<String, List<IPath>>> set = buildOutVars.entrySet(); Set<Entry<String, List<IPath>>> set = buildOutVars.entrySet();
for (Entry<String, List<IPath>> entry : set) { for (Entry<String, List<IPath>> entry : set) {
String macroName = entry.getKey(); String macroName = entry.getKey();
buffer.append(macroName + WHITESPACE + ":=" + WHITESPACE + NEWLINE); //$NON-NLS-1$ buffer.append(macroName).append(WHITESPACE).append(":=").append(WHITESPACE).append(NEWLINE); //$NON-NLS-1$
} }
// Add a list of subdirectories to the makefile // Add a list of subdirectories to the makefile
buffer.append(NEWLINE + addSubdirectories()); buffer.append(NEWLINE).append(addSubdirectories());
// Save the file // Save the file
save(buffer, fileHandle); save(buffer, fileHandle);
@ -1217,11 +1217,11 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
// Add the ROOT macro // Add the ROOT macro
//buffer.append("ROOT := .." + NEWLINE); //$NON-NLS-1$ //buffer.append("ROOT := ..").append(NEWLINE); //$NON-NLS-1$
//buffer.append(NEWLINE); //buffer.append(NEWLINE);
// include makefile.init supplementary makefile // include makefile.init supplementary makefile
buffer.append("-include " + ROOT + SEPARATOR + MAKEFILE_INIT + NEWLINE); //$NON-NLS-1$ buffer.append("-include " + ROOT + SEPARATOR + MAKEFILE_INIT).append(NEWLINE); //$NON-NLS-1$
buffer.append(NEWLINE); buffer.append(NEWLINE);
// Get the clean command from the build model // Get the clean command from the build model
@ -1238,13 +1238,13 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} catch (BuildMacroException e) { } catch (BuildMacroException e) {
} }
buffer.append(cleanCommand + NEWLINE); buffer.append(cleanCommand).append(NEWLINE);
buffer.append(NEWLINE); buffer.append(NEWLINE);
// Now add the source providers // Now add the source providers
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(SRC_LISTS) + NEWLINE); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(SRC_LISTS)).append(NEWLINE);
buffer.append("-include sources.mk" + NEWLINE); //$NON-NLS-1$ buffer.append("-include sources.mk").append(NEWLINE); //$NON-NLS-1$
// Add includes for each subdir in child-subdir-first order (required for makefile rule matching to work). // Add includes for each subdir in child-subdir-first order (required for makefile rule matching to work).
List<String> subDirList = new ArrayList<String>(); List<String> subDirList = new ArrayList<String>();
@ -1255,33 +1255,33 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
Collections.sort(subDirList, Collections.reverseOrder()); Collections.sort(subDirList, Collections.reverseOrder());
for (String dir : subDirList) { for (String dir : subDirList) {
buffer.append("-include " + escapeWhitespaces(dir) + SEPARATOR + "subdir.mk"+ NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("-include ").append(escapeWhitespaces(dir)).append(SEPARATOR).append("subdir.mk").append(NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
} }
buffer.append("-include subdir.mk" + NEWLINE); //$NON-NLS-1$ buffer.append("-include subdir.mk").append(NEWLINE); //$NON-NLS-1$
buffer.append("-include objects.mk" + NEWLINE + NEWLINE); //$NON-NLS-1$ buffer.append("-include objects.mk").append(NEWLINE).append(NEWLINE); //$NON-NLS-1$
// Include generated dependency makefiles if non-empty AND a "clean" has not been requested // Include generated dependency makefiles if non-empty AND a "clean" has not been requested
if (!buildDepVars.isEmpty()) { if (!buildDepVars.isEmpty()) {
buffer.append("ifneq ($(MAKECMDGOALS),clean)" + NEWLINE); //$NON-NLS-1$ buffer.append("ifneq ($(MAKECMDGOALS),clean)").append(NEWLINE); //$NON-NLS-1$
for (Entry<String, GnuDependencyGroupInfo> entry : buildDepVars.entrySet()) { for (Entry<String, GnuDependencyGroupInfo> entry : buildDepVars.entrySet()) {
String depsMacro = entry.getKey(); String depsMacro = entry.getKey();
GnuDependencyGroupInfo info = entry.getValue(); GnuDependencyGroupInfo info = entry.getValue();
buffer.append("ifneq ($(strip $(" + depsMacro + ")),)" + NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("ifneq ($(strip $(").append(depsMacro).append(")),)").append(NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
if (info.conditionallyInclude) { if (info.conditionallyInclude) {
buffer.append("-include $(" + depsMacro + ")" + NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("-include $(").append(depsMacro).append(')').append(NEWLINE); //$NON-NLS-1$
} else { } else {
buffer.append("include $(" + depsMacro + ")" + NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("include $(").append(depsMacro).append(')').append(NEWLINE); //$NON-NLS-1$
} }
buffer.append("endif" + NEWLINE); //$NON-NLS-1$ buffer.append("endif").append(NEWLINE); //$NON-NLS-1$
} }
buffer.append("endif" + NEWLINE + NEWLINE); //$NON-NLS-1$ buffer.append("endif").append(NEWLINE).append(NEWLINE); //$NON-NLS-1$
} }
// Include makefile.defs supplemental makefile // Include makefile.defs supplemental makefile
buffer.append("-include " + ROOT + SEPARATOR + MAKEFILE_DEFS + NEWLINE); //$NON-NLS-1$ buffer.append("-include ").append(ROOT).append(SEPARATOR).append(MAKEFILE_DEFS).append(NEWLINE); //$NON-NLS-1$
return (buffer.append(NEWLINE)); return (buffer.append(NEWLINE));
@ -1359,10 +1359,10 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
if (prebuildStep.length() > 0) { if (prebuildStep.length() > 0) {
// Add the comment for the "All" target // Add the comment for the "All" target
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(ALL_TARGET) + NEWLINE); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(ALL_TARGET)).append(NEWLINE);
buffer.append(defaultTarget + WHITESPACE); buffer.append(defaultTarget).append(WHITESPACE);
buffer.append(PREBUILD + WHITESPACE); buffer.append(PREBUILD).append(WHITESPACE);
// Reset defaultTarget for now and for subsequent use, below // Reset defaultTarget for now and for subsequent use, below
defaultTarget = MAINBUILD; defaultTarget = MAINBUILD;
@ -1371,14 +1371,14 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Update the defaultTarget, main-build, by adding a colon, which is // Update the defaultTarget, main-build, by adding a colon, which is
// needed below // needed below
defaultTarget = defaultTarget.concat(COLON); defaultTarget = defaultTarget.concat(COLON);
buffer.append(NEWLINE + NEWLINE); buffer.append(NEWLINE).append(NEWLINE);
// Add the comment for the "main-build" target // Add the comment for the "main-build" target
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MAINBUILD_TARGET) + NEWLINE); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(MAINBUILD_TARGET)).append(NEWLINE);
} }
else else
// Add the comment for the "All" target // Add the comment for the "All" target
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(ALL_TARGET) + NEWLINE); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(ALL_TARGET)).append(NEWLINE);
// Write out the all target first in case someone just runs make // Write out the all target first in case someone just runs make
// all: <target_name> or mainbuild: <target_name> // all: <target_name> or mainbuild: <target_name>
@ -1387,19 +1387,19 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
if (targetTool != null) { if (targetTool != null) {
outputPrefix = targetTool.getOutputPrefix(); outputPrefix = targetTool.getOutputPrefix();
} }
buffer.append(defaultTarget + WHITESPACE + outputPrefix buffer.append(defaultTarget).append(WHITESPACE).append(outputPrefix)
+ ensurePathIsGNUMakeTargetRuleCompatibleSyntax(buildTargetName)); .append(ensurePathIsGNUMakeTargetRuleCompatibleSyntax(buildTargetName));
if (buildTargetExt.length() > 0) { if (buildTargetExt.length() > 0) {
buffer.append(DOT + buildTargetExt); buffer.append(DOT).append(buildTargetExt);
} }
// Add the Secondary Outputs to the all target, if any // Add the Secondary Outputs to the all target, if any
IOutputType[] secondaryOutputs = config.getToolChain().getSecondaryOutputs(); IOutputType[] secondaryOutputs = config.getToolChain().getSecondaryOutputs();
if (secondaryOutputs.length > 0) { if (secondaryOutputs.length > 0) {
buffer.append(WHITESPACE + SECONDARY_OUTPUTS); buffer.append(WHITESPACE).append(SECONDARY_OUTPUTS);
} }
buffer.append(NEWLINE + NEWLINE); buffer.append(NEWLINE).append(NEWLINE);
/* /*
* The build target may depend on other projects in the workspace. These * The build target may depend on other projects in the workspace. These
@ -1419,7 +1419,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// if (!dep.exists()) continue; // if (!dep.exists()) continue;
if (addDeps) { if (addDeps) {
buffer.append("dependents:" + NEWLINE); //$NON-NLS-1$ buffer.append("dependents:").append(NEWLINE); //$NON-NLS-1$
addDeps = false; addDeps = false;
} }
String buildDir = depCfg.getOwner().getLocation().toString(); String buildDir = depCfg.getOwner().getLocation().toString();
@ -1468,7 +1468,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
dependency = escapeWhitespaces(dependency); dependency = escapeWhitespaces(dependency);
managedProjectOutputs.add(dependency); managedProjectOutputs.add(dependency);
//} //}
buffer.append(TAB + "-cd" + WHITESPACE + escapeWhitespaces(buildDir) + WHITESPACE + LOGICAL_AND + WHITESPACE + "$(MAKE) " + depTargets + NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append(TAB).append("-cd").append(WHITESPACE).append(escapeWhitespaces(buildDir)) //$NON-NLS-1$
.append(WHITESPACE).append(LOGICAL_AND).append(WHITESPACE).append("$(MAKE) ").append(depTargets).append(NEWLINE); //$NON-NLS-1$
} }
// } // }
buffer.append(NEWLINE); buffer.append(NEWLINE);
@ -1480,51 +1481,51 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Add the prebuild step target, if specified // Add the prebuild step target, if specified
if (prebuildStep.length() > 0) { if (prebuildStep.length() > 0) {
buffer.append(PREBUILD + COLON + NEWLINE); buffer.append(PREBUILD).append(COLON).append(NEWLINE);
if (preannouncebuildStep.length() > 0) { if (preannouncebuildStep.length() > 0) {
buffer.append(TAB + DASH + AT + escapedEcho(preannouncebuildStep)); buffer.append(TAB).append(DASH).append(AT).append(escapedEcho(preannouncebuildStep));
} }
buffer.append(TAB + DASH + prebuildStep + NEWLINE); buffer.append(TAB).append(DASH).append(prebuildStep).append(NEWLINE);
buffer.append(TAB + DASH + AT + ECHO_BLANK_LINE + NEWLINE); buffer.append(TAB).append(DASH).append(AT).append(ECHO_BLANK_LINE).append(NEWLINE);
} }
// Add the postbuild step, if specified // Add the postbuild step, if specified
if (postbuildStep.length() > 0) { if (postbuildStep.length() > 0) {
buffer.append(POSTBUILD + COLON + NEWLINE); buffer.append(POSTBUILD).append(COLON).append(NEWLINE);
if (postannouncebuildStep.length() > 0) { if (postannouncebuildStep.length() > 0) {
buffer.append(TAB + DASH + AT + escapedEcho(postannouncebuildStep)); buffer.append(TAB).append(DASH).append(AT).append(escapedEcho(postannouncebuildStep));
} }
buffer.append(TAB + DASH + postbuildStep + NEWLINE); buffer.append(TAB).append(DASH).append(postbuildStep).append(NEWLINE);
buffer.append(TAB + DASH + AT + ECHO_BLANK_LINE + NEWLINE); buffer.append(TAB).append(DASH).append(AT).append(ECHO_BLANK_LINE).append(NEWLINE);
} }
// Add the Secondary Outputs target, if needed // Add the Secondary Outputs target, if needed
if (secondaryOutputs.length > 0) { if (secondaryOutputs.length > 0) {
buffer.append(SECONDARY_OUTPUTS + COLON); buffer.append(SECONDARY_OUTPUTS).append(COLON);
Vector<String> outs2 = calculateSecondaryOutputs(secondaryOutputs); Vector<String> outs2 = calculateSecondaryOutputs(secondaryOutputs);
for (int i=0; i<outs2.size(); i++) { for (int i=0; i<outs2.size(); i++) {
buffer.append(WHITESPACE + "$(" + outs2.get(i) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append(WHITESPACE).append("$(").append(outs2.get(i)).append(')'); //$NON-NLS-1$
} }
buffer.append(NEWLINE + NEWLINE); buffer.append(NEWLINE).append(NEWLINE);
} }
// Add all the needed dummy and phony targets // Add all the needed dummy and phony targets
buffer.append(".PHONY: all clean dependents" + NEWLINE); //$NON-NLS-1$ buffer.append(".PHONY: all clean dependents").append(NEWLINE); //$NON-NLS-1$
buffer.append(".SECONDARY:"); //$NON-NLS-1$ buffer.append(".SECONDARY:"); //$NON-NLS-1$
if (prebuildStep.length() > 0) { if (prebuildStep.length() > 0) {
buffer.append(WHITESPACE + MAINBUILD + WHITESPACE + PREBUILD); buffer.append(WHITESPACE).append(MAINBUILD).append(WHITESPACE).append(PREBUILD);
} }
if (postbuildStep.length() > 0) { if (postbuildStep.length() > 0) {
buffer.append(WHITESPACE + POSTBUILD); buffer.append(WHITESPACE).append(POSTBUILD);
} }
buffer.append(NEWLINE); buffer.append(NEWLINE);
for (String output : managedProjectOutputs) { for (String output : managedProjectOutputs) {
buffer.append(output + COLON + NEWLINE); buffer.append(output).append(COLON).append(NEWLINE);
} }
buffer.append(NEWLINE); buffer.append(NEWLINE);
// Include makefile.targets supplemental makefile // Include makefile.targets supplemental makefile
buffer.append("-include " + ROOT + SEPARATOR + MAKEFILE_TARGETS + NEWLINE); //$NON-NLS-1$ buffer.append("-include ").append(ROOT).append(SEPARATOR).append(MAKEFILE_TARGETS).append(NEWLINE); //$NON-NLS-1$
return buffer; return buffer;
} }
@ -1543,7 +1544,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
List<String> outputVarsAdditionsList, Vector<String> managedProjectOutputs, boolean postbuildStep) { List<String> outputVarsAdditionsList, Vector<String> managedProjectOutputs, boolean postbuildStep) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
// Add the comment // Add the comment
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(BUILD_TOP) + NEWLINE); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(BUILD_TOP)).append(NEWLINE);
ToolInfoHolder h = (ToolInfoHolder)toolInfos.getValue(); ToolInfoHolder h = (ToolInfoHolder)toolInfos.getValue();
ITool[] buildTools = h.buildTools; ITool[] buildTools = h.buildTools;
@ -1564,7 +1565,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
} }
} else { } else {
buffer.append(TAB + AT + escapedEcho(MESSAGE_NO_TARGET_TOOL + WHITESPACE + OUT_MACRO)); buffer.append(TAB).append(AT).append(escapedEcho(MESSAGE_NO_TARGET_TOOL + WHITESPACE + OUT_MACRO));
} }
// Generate the rules for all Tools that specify InputType.multipleOfType, and any Tools that // Generate the rules for all Tools that specify InputType.multipleOfType, and any Tools that
@ -1585,14 +1586,14 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
// Add the comment // Add the comment
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(BUILD_TARGETS) + NEWLINE); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(BUILD_TARGETS)).append(NEWLINE);
// Always add a clean target // Always add a clean target
buffer.append("clean:" + NEWLINE); //$NON-NLS-1$ buffer.append("clean:").append(NEWLINE); //$NON-NLS-1$
buffer.append(TAB + "-$(RM)" + WHITESPACE); //$NON-NLS-1$ buffer.append(TAB).append("-$(RM)").append(WHITESPACE); //$NON-NLS-1$
for (Entry<String, List<IPath>> entry : buildOutVars.entrySet()) { for (Entry<String, List<IPath>> entry : buildOutVars.entrySet()) {
String macroName = entry.getKey(); String macroName = entry.getKey();
buffer.append("$(" + macroName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("$(").append(macroName).append(')'); //$NON-NLS-1$
} }
String outputPrefix = EMPTY_STRING; String outputPrefix = EMPTY_STRING;
if (targetTool != null) { if (targetTool != null) {
@ -1603,12 +1604,12 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
completeBuildTargetName = completeBuildTargetName + DOT + buildTargetExt; completeBuildTargetName = completeBuildTargetName + DOT + buildTargetExt;
} }
if (completeBuildTargetName.contains(" ")) { //$NON-NLS-1$ if (completeBuildTargetName.contains(" ")) { //$NON-NLS-1$
buffer.append(WHITESPACE + "\"" + completeBuildTargetName + "\""); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append(WHITESPACE).append('"').append(completeBuildTargetName).append('"');
} else { } else {
buffer.append(WHITESPACE + completeBuildTargetName); buffer.append(WHITESPACE).append(completeBuildTargetName);
} }
buffer.append(NEWLINE); buffer.append(NEWLINE);
buffer.append(TAB + DASH + AT + ECHO_BLANK_LINE + NEWLINE); buffer.append(TAB).append(DASH).append(AT).append(ECHO_BLANK_LINE).append(NEWLINE);
return buffer; return buffer;
} }
@ -1687,11 +1688,11 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
else { else {
getRuleList().add(buildRule); getRuleList().add(buildRule);
buffer.append(buildRule + NEWLINE); buffer.append(buildRule).append(NEWLINE);
if (bTargetTool) { if (bTargetTool) {
buffer.append(TAB + AT + escapedEcho(MESSAGE_START_BUILD + WHITESPACE + OUT_MACRO)); buffer.append(TAB).append(AT).append(escapedEcho(MESSAGE_START_BUILD + WHITESPACE + OUT_MACRO));
} }
buffer.append(TAB + AT + escapedEcho(tool.getAnnouncement())); buffer.append(TAB).append(AT).append(escapedEcho(tool.getAnnouncement()));
// Get the command line for this tool invocation // Get the command line for this tool invocation
String[] flags; String[] flags;
@ -1750,23 +1751,23 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
//buffer.append(TAB + AT + escapedEcho(buildCmd)); //buffer.append(TAB).append(AT).append(escapedEcho(buildCmd));
//buffer.append(TAB + AT + buildCmd); //buffer.append(TAB).append(AT).append(buildCmd);
buffer.append(TAB + buildCmd); buffer.append(TAB).append(buildCmd);
// TODO // TODO
// NOTE WELL: Dependency file generation is not handled for this type of Tool // NOTE WELL: Dependency file generation is not handled for this type of Tool
// Echo finished message // Echo finished message
buffer.append(NEWLINE); buffer.append(NEWLINE);
buffer.append(TAB + AT + escapedEcho((bTargetTool ? MESSAGE_FINISH_BUILD : MESSAGE_FINISH_FILE) + WHITESPACE + OUT_MACRO)); buffer.append(TAB).append(AT).append(escapedEcho((bTargetTool ? MESSAGE_FINISH_BUILD : MESSAGE_FINISH_FILE) + WHITESPACE + OUT_MACRO));
buffer.append(TAB + AT + ECHO_BLANK_LINE); buffer.append(TAB).append(AT).append(ECHO_BLANK_LINE);
// If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build // If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build
// Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke // Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke
// the makefile originally // the makefile originally
if (bEmitPostBuildStepCall) { if (bEmitPostBuildStepCall) {
buffer.append(TAB + MAKE + WHITESPACE + NO_PRINT_DIR + WHITESPACE + POSTBUILD + NEWLINE + NEWLINE); buffer.append(TAB).append(MAKE).append(WHITESPACE).append(NO_PRINT_DIR).append(WHITESPACE).append(POSTBUILD).append(NEWLINE).append(NEWLINE);
} }
else { else {
// Just emit a blank line // Just emit a blank line
@ -1935,19 +1936,19 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
private StringBuffer addSubdirectories() { private StringBuffer addSubdirectories() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
// Add the comment // Add the comment
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MOD_LIST) + NEWLINE); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(MOD_LIST)).append(NEWLINE);
buffer.append("SUBDIRS := " + LINEBREAK); //$NON-NLS-1$ buffer.append("SUBDIRS := ").append(LINEBREAK); //$NON-NLS-1$
// Get all the module names // Get all the module names
for (IResource container : getSubdirList()) { for (IResource container : getSubdirList()) {
updateMonitor(ManagedMakeMessages.getFormattedString("MakefileGenerator.message.adding.source.folder", container.getFullPath().toString())); //$NON-NLS-1$ updateMonitor(ManagedMakeMessages.getFormattedString("MakefileGenerator.message.adding.source.folder", container.getFullPath().toString())); //$NON-NLS-1$
// Check the special case where the module is the project root // Check the special case where the module is the project root
if (container.getFullPath() == project.getFullPath()) { if (container.getFullPath() == project.getFullPath()) {
buffer.append(DOT + WHITESPACE + LINEBREAK); buffer.append(DOT).append(WHITESPACE).append(LINEBREAK);
} else { } else {
IPath path = container.getProjectRelativePath(); IPath path = container.getProjectRelativePath();
buffer.append(escapeWhitespaces(path.toString()) + WHITESPACE + LINEBREAK); buffer.append(escapeWhitespaces(path.toString())).append(WHITESPACE).append(LINEBREAK);
} }
} }
@ -2024,7 +2025,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Write out the macro addition entries to the buffer // Write out the macro addition entries to the buffer
buffer.append(writeAdditionMacros(buildVarToRuleStringMap)); buffer.append(writeAdditionMacros(buildVarToRuleStringMap));
return buffer.append(ruleBuffer + NEWLINE); return buffer.append(ruleBuffer).append(NEWLINE);
} }
/* (non-Javadoc /* (non-Javadoc
@ -2596,9 +2597,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
getRuleList().add(buildRule); getRuleList().add(buildRule);
// Echo starting message // Echo starting message
buffer.append(buildRule + NEWLINE); buffer.append(buildRule).append(NEWLINE);
buffer.append(TAB + AT + escapedEcho(MESSAGE_START_FILE + WHITESPACE + IN_MACRO)); buffer.append(TAB).append(AT).append(escapedEcho(MESSAGE_START_FILE + WHITESPACE + IN_MACRO));
buffer.append(TAB + AT + escapedEcho(tool.getAnnouncement())); buffer.append(TAB).append(AT).append(escapedEcho(tool.getAnnouncement()));
// If the tool specifies a dependency calculator of TYPE_BUILD_COMMANDS, ask whether // If the tool specifies a dependency calculator of TYPE_BUILD_COMMANDS, ask whether
// there are any pre-tool commands. // there are any pre-tool commands.
@ -2629,7 +2630,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
outputLocation, null, tool)); outputLocation, null, tool));
} }
if (resolvedCommand != null) if (resolvedCommand != null)
buffer.append(resolvedCommand + NEWLINE); buffer.append(resolvedCommand).append(NEWLINE);
} catch (BuildMacroException e) { } catch (BuildMacroException e) {
} }
} }
@ -2704,7 +2705,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
StringBuffer buildFlags = new StringBuffer(); StringBuffer buildFlags = new StringBuffer();
for (String flag : flags) { for (String flag : flags) {
if( flag != null ) { if( flag != null ) {
buildFlags.append( flag + WHITESPACE ); buildFlags.append(flag).append(WHITESPACE);
} }
} }
buildCmd = cmd + WHITESPACE + buildFlags.toString().trim() + WHITESPACE + outflag + WHITESPACE + buildCmd = cmd + WHITESPACE + buildFlags.toString().trim() + WHITESPACE + outflag + WHITESPACE +
@ -2742,9 +2743,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} catch (BuildMacroException e) { } catch (BuildMacroException e) {
} }
//buffer.append(TAB + AT + escapedEcho(buildCmd)); //buffer.append(TAB).append(AT).append(escapedEcho(buildCmd));
//buffer.append(TAB + AT + buildCmd); //buffer.append(TAB).append(AT).append(buildCmd);
buffer.append(TAB + buildCmd); buffer.append(TAB).append(buildCmd);
// Determine if there are any dependencies to calculate // Determine if there are any dependencies to calculate
if (doDepGen) { if (doDepGen) {
@ -2763,7 +2764,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
for (String depCmd : depCmds) { for (String depCmd : depCmds) {
// Resolve any macros in the dep command after it has been generated. // Resolve any macros in the dep command after it has been generated.
// Note: do not trim the result because it will strip out necessary tab characters. // Note: do not trim the result because it will strip out necessary tab characters.
buffer.append(WHITESPACE + LOGICAL_AND + WHITESPACE + LINEBREAK); buffer.append(WHITESPACE).append(LOGICAL_AND).append(WHITESPACE).append(LINEBREAK);
try { try {
if (!needExplicitRuleForFile) { if (!needExplicitRuleForFile) {
depCmd = ManagedBuildManager.getBuildMacroProvider() depCmd = ManagedBuildManager.getBuildMacroProvider()
@ -2799,8 +2800,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Echo finished message // Echo finished message
buffer.append(NEWLINE); buffer.append(NEWLINE);
buffer.append(TAB + AT + escapedEcho(MESSAGE_FINISH_FILE + WHITESPACE + IN_MACRO)); buffer.append(TAB).append(AT).append(escapedEcho(MESSAGE_FINISH_FILE + WHITESPACE + IN_MACRO));
buffer.append(TAB + AT + ECHO_BLANK_LINE + NEWLINE); buffer.append(TAB).append(AT).append(ECHO_BLANK_LINE).append(NEWLINE);
} }
// Determine if there are calculated dependencies // Determine if there are calculated dependencies
@ -2888,8 +2889,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
if (!getDepRuleList().contains(depLine)) { if (!getDepRuleList().contains(depLine)) {
getDepRuleList().add(depLine); getDepRuleList().add(depLine);
addedDepLines = true; addedDepLines = true;
buffer.append(depLine + NEWLINE); buffer.append(depLine).append(NEWLINE);
buffer.append(TAB + AT + escapedEcho(MESSAGE_START_DEPENDENCY + WHITESPACE + OUT_MACRO)); buffer.append(TAB).append(AT).append(escapedEcho(MESSAGE_START_DEPENDENCY + WHITESPACE + OUT_MACRO));
for (String preBuildCommand : preBuildCommands) { for (String preBuildCommand : preBuildCommands) {
depLine = preBuildCommand; depLine = preBuildCommand;
// Resolve macros // Resolve macros
@ -2920,13 +2921,13 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} catch (BuildMacroException e) { } catch (BuildMacroException e) {
} }
//buffer.append(TAB + AT + escapedEcho(depLine)); //buffer.append(TAB).append(AT).append(escapedEcho(depLine));
//buffer.append(TAB + AT + depLine + NEWLINE); //buffer.append(TAB).append(AT).append(depLine).append(NEWLINE);
buffer.append(TAB + depLine + NEWLINE); buffer.append(TAB).append(depLine).append(NEWLINE);
} }
} }
if (addedDepLines) { if (addedDepLines) {
buffer.append(TAB + AT + ECHO_BLANK_LINE + NEWLINE); buffer.append(TAB).append(AT).append(ECHO_BLANK_LINE).append(NEWLINE);
} }
} }
} }
@ -3488,7 +3489,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// practically nil so it doesn't seem worth the hassle of generating a truly // practically nil so it doesn't seem worth the hassle of generating a truly
// unique name. // unique name.
if(extensionName.equals(extensionName.toUpperCase())) { if(extensionName.equals(extensionName.toUpperCase())) {
macroName.append(extensionName.toUpperCase() + "_UPPER"); //$NON-NLS-1$ macroName.append(extensionName.toUpperCase()).append("_UPPER"); //$NON-NLS-1$
} else { } else {
// lower case... no need for "UPPER_" // lower case... no need for "UPPER_"
macroName.append(extensionName.toUpperCase()); macroName.append(extensionName.toUpperCase());
@ -3510,7 +3511,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// practically nil so it doesn't seem worth the hassle of generating a truly // practically nil so it doesn't seem worth the hassle of generating a truly
// unique name. // unique name.
if(extensionName.equals(extensionName.toUpperCase())) { if(extensionName.equals(extensionName.toUpperCase())) {
macroName.append(extensionName.toUpperCase() + "_UPPER"); //$NON-NLS-1$ macroName.append(extensionName.toUpperCase()).append("_UPPER"); //$NON-NLS-1$
} else { } else {
// lower case... no need for "UPPER_" // lower case... no need for "UPPER_"
macroName.append(extensionName.toUpperCase()); macroName.append(extensionName.toUpperCase());
@ -3655,9 +3656,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
if (secondToken.startsWith("'")) { //$NON-NLS-1$ if (secondToken.startsWith("'")) { //$NON-NLS-1$
// This is the Win32 implementation of echo (MinGW without MSYS) // This is the Win32 implementation of echo (MinGW without MSYS)
outBuffer.append(secondToken.substring(1) + WHITESPACE); outBuffer.append(secondToken.substring(1)).append(WHITESPACE);
} else { } else {
outBuffer.append(secondToken + WHITESPACE); outBuffer.append(secondToken).append(WHITESPACE);
} }
// The relative path to the build goal comes next // The relative path to the build goal comes next
@ -3691,15 +3692,15 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} catch (ArrayIndexOutOfBoundsException e) { } catch (ArrayIndexOutOfBoundsException e) {
fourthToken = ""; // $NON-NLS-1$ fourthToken = ""; // $NON-NLS-1$
} }
outBuffer.append(fourthToken + WHITESPACE); outBuffer.append(fourthToken).append(WHITESPACE);
// Followed by the actual dependencies // Followed by the actual dependencies
try { try {
for (String nextElement : deps) { for (String nextElement : deps) {
if (nextElement.endsWith("\\")) { //$NON-NLS-1$ if (nextElement.endsWith("\\")) { //$NON-NLS-1$
outBuffer.append(nextElement + NEWLINE + WHITESPACE); outBuffer.append(nextElement).append(NEWLINE).append(WHITESPACE);
} else { } else {
outBuffer.append(nextElement + WHITESPACE); outBuffer.append(nextElement).append(WHITESPACE);
} }
} }
} catch (IndexOutOfBoundsException e) { } catch (IndexOutOfBoundsException e) {
@ -3728,7 +3729,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
* The formatting here is * The formatting here is
* <dummy_target>: * <dummy_target>:
*/ */
outBuffer.append(dummy + COLON + NEWLINE + NEWLINE); outBuffer.append(dummy).append(COLON).append(NEWLINE).append(NEWLINE);
} }
} }
@ -3761,7 +3762,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
static protected StringBuffer addDefaultHeader() { static protected StringBuffer addDefaultHeader() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
outputCommentLine(buffer); outputCommentLine(buffer);
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(HEADER) + NEWLINE); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(HEADER)).append(NEWLINE);
outputCommentLine(buffer); outputCommentLine(buffer);
buffer.append(NEWLINE); buffer.append(NEWLINE);
return buffer; return buffer;
@ -3812,9 +3813,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
protected void addMacroAdditionPrefix(LinkedHashMap<String, String> map, String macroName, String relativePath, boolean addPrefix) { protected void addMacroAdditionPrefix(LinkedHashMap<String, String> map, String macroName, String relativePath, boolean addPrefix) {
// there is no entry in the map, so create a buffer for this macro // there is no entry in the map, so create a buffer for this macro
StringBuffer tempBuffer = new StringBuffer(); StringBuffer tempBuffer = new StringBuffer();
tempBuffer.append(macroName + WHITESPACE + MACRO_ADDITION_PREFIX_SUFFIX); tempBuffer.append(macroName).append(WHITESPACE).append(MACRO_ADDITION_PREFIX_SUFFIX);
if (addPrefix) { if (addPrefix) {
tempBuffer.append(MACRO_ADDITION_ADDPREFIX_HEADER + relativePath + MACRO_ADDITION_ADDPREFIX_SUFFIX); tempBuffer.append(MACRO_ADDITION_ADDPREFIX_HEADER).append(relativePath).append(MACRO_ADDITION_ADDPREFIX_SUFFIX);
} }
// have to store the buffer in String form as StringBuffer is not a sublcass of Object // have to store the buffer in String form as StringBuffer is not a sublcass of Object
@ -3833,7 +3834,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// escape whitespace in the filename // escape whitespace in the filename
filename = escapeWhitespaces(filename); filename = escapeWhitespaces(filename);
buffer.append(filename + WHITESPACE + LINEBREAK); buffer.append(filename).append(WHITESPACE).append(LINEBREAK);
// re-insert string in the map // re-insert string in the map
map.put(macroName, buffer.toString()); map.put(macroName, buffer.toString());
} }
@ -3885,7 +3886,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Bug 417288, ilg@livius.net & freidin.alex@gmail.com // Bug 417288, ilg@livius.net & freidin.alex@gmail.com
filename = ensurePathIsGNUMakeTargetRuleCompatibleSyntax(filename); filename = ensurePathIsGNUMakeTargetRuleCompatibleSyntax(filename);
buffer.append(filename + WHITESPACE + LINEBREAK); buffer.append(filename).append(WHITESPACE).append(LINEBREAK);
} }
} }
// re-insert string in the map // re-insert string in the map
@ -3898,7 +3899,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
protected StringBuffer writeAdditionMacros(LinkedHashMap<String, String> map) { protected StringBuffer writeAdditionMacros(LinkedHashMap<String, String> map) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
// Add the comment // Add the comment
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MOD_VARS) + NEWLINE); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(MOD_VARS)).append(NEWLINE);
for (String macroString : map.values()) { for (String macroString : map.values()) {
// Check if we added any files to the rule // Check if we added any files to the rule
@ -3930,7 +3931,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
protected StringBuffer writeTopAdditionMacros(List<String> varList, HashMap<String, String> varMap) { protected StringBuffer writeTopAdditionMacros(List<String> varList, HashMap<String, String> varMap) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
// Add the comment // Add the comment
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MOD_VARS) + NEWLINE); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(MOD_VARS)).append(NEWLINE);
for (int i=0; i<varList.size(); i++) { for (int i=0; i<varList.size(); i++) {
String addition = varMap.get(varList.get(i)); String addition = varMap.get(varList.get(i));

View file

@ -361,7 +361,7 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
// If the parsed string does not match with any previous option // If the parsed string does not match with any previous option
// values then consider this option as a additional build option // values then consider this option as a additional build option
if (!optionValueExist) { if (!optionValueExist) {
addnOptions.append(optionValue + ITool.WHITE_SPACE); addnOptions.append(optionValue).append(ITool.WHITE_SPACE);
} }
} }
// check whether some of the "STRING" option value or "OBJECTS" type // check whether some of the "STRING" option value or "OBJECTS" type
@ -378,7 +378,7 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
String[] vals = val.split(WHITESPACE); String[] vals = val.split(WHITESPACE);
for (int t = 0; t < vals.length; t++) { for (int t = 0; t < vals.length; t++) {
if (alloptions.indexOf(vals[t]) != -1) if (alloptions.indexOf(vals[t]) != -1)
buf.append(vals[t] + ITool.WHITE_SPACE); buf.append(vals[t]).append(ITool.WHITE_SPACE);
} }
setOption(((IOption) key), setOption(((IOption) key),
buf.toString().trim()); buf.toString().trim());

View file

@ -645,10 +645,10 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
break; break;
} }
result.append(Messages.ToolChainEditTab_15 + result.append(Messages.ToolChainEditTab_15)
(i+1) + Messages.ToolChainEditTab_16 + .append(i+1).append(Messages.ToolChainEditTab_16)
SPACE + t + SPACE + o + SPACE + n + .append(SPACE).append(t).append(SPACE).append(o).append(SPACE).append(n)
Messages.ToolChainEditTab_17); .append(Messages.ToolChainEditTab_17);
} }
String s = result.toString(); String s = result.toString();
if (s.trim().length() == 0) if (s.trim().length() == 0)

View file

@ -148,7 +148,7 @@ public class MapProblemPreference extends AbstractProblemPreference
continue; continue;
} }
} }
buf.append(key + "=>" + d.exportValue()); //$NON-NLS-1$ buf.append(key).append("=>").append(d.exportValue()); //$NON-NLS-1$
if (iterator.hasNext()) if (iterator.hasNext())
buf.append(","); //$NON-NLS-1$ buf.append(","); //$NON-NLS-1$
} }

View file

@ -262,9 +262,10 @@ public class ErrorParserManagerTest extends TestCase {
StringBuilder buf = new StringBuilder("errorT: "); StringBuilder buf = new StringBuilder("errorT: ");
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
buf.append("la la la la la "+i+" "); buf.append("la la la la la ").append(i).append(' ');
} }
output(buf.toString()+"\n"); buf.append('\n');
output(buf.toString());
end(); end();
assertEquals(1, errorList.size()); assertEquals(1, errorList.size());
ProblemMarkerInfo problemMarkerInfo = errorList.get(0); ProblemMarkerInfo problemMarkerInfo = errorList.get(0);
@ -298,9 +299,10 @@ public class ErrorParserManagerTest extends TestCase {
StringBuilder buf = new StringBuilder("errorT: "); StringBuilder buf = new StringBuilder("errorT: ");
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
buf.append("la la la la la "+i+" "); buf.append("la la la la la ").append(i).append(' ');
} }
output(buf.toString()+"\n"); buf.append('\n');
output(buf.toString());
end(); end();
assertEquals(1, errorList.size()); assertEquals(1, errorList.size());
ProblemMarkerInfo problemMarkerInfo = errorList.get(0); ProblemMarkerInfo problemMarkerInfo = errorList.get(0);

View file

@ -3847,9 +3847,9 @@ public class AST2Tests extends AST2TestBase {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
buffer.append("#define M0 1\n"); buffer.append("#define M0 1\n");
for (int i = 1; i < depth; i++) { for (int i = 1; i < depth; i++) {
buffer.append("#define M" + i + " (M" + (i-1) + "+1)\n"); buffer.append("#define M").append(i).append(" (M").append(i-1).append("+1)\n");
} }
buffer.append("int a= M" + (depth-1) + ";\n"); buffer.append("int a= M").append(depth-1).append(";\n");
long time= System.currentTimeMillis(); long time= System.currentTimeMillis();
parse(buffer.toString(), CPP); parse(buffer.toString(), CPP);
parse(buffer.toString(), C); parse(buffer.toString(), C);

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2014 Institute for Software, HSR Hochschule fuer Technik * Copyright (c) 2008, 2016 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others * Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
@ -145,7 +145,7 @@ public class CommentHandlingTest extends RewriteBaseTest {
StringBuilder output = new StringBuilder(); StringBuilder output = new StringBuilder();
for (IASTNode actNode : keyTree) { for (IASTNode actNode : keyTree) {
List<IASTComment> comments = map.get(actNode); List<IASTComment> comments = map.get(actNode);
output.append(getSignature(actNode) + " = "); //$NON-NLS-1$ output.append(getSignature(actNode)).append(" = "); //$NON-NLS-1$
boolean first = true; boolean first = true;
for (IASTComment actComment : comments) { for (IASTComment actComment : comments) {
if (!first) { if (!first) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2014 Symbian Software Systems and others. * Copyright (c) 2006, 2016 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -49,7 +49,7 @@ public class PDOMPrettyPrinter implements IPDOMVisitor {
if (node instanceof PDOMBinding) { if (node instanceof PDOMBinding) {
sb.append(" "); sb.append(" ");
PDOMBinding binding= (PDOMBinding) node; PDOMBinding binding= (PDOMBinding) node;
sb.append(" " + binding.getRecord()); sb.append(' ').append(binding.getRecord());
} }
System.out.println(sb); System.out.println(sb);
return true; return true;

View file

@ -208,8 +208,8 @@ public class BaseTestCase extends TestCase {
} }
if (statusLog.size() != fExpectedLoggedNonOK) { if (statusLog.size() != fExpectedLoggedNonOK) {
StringBuilder msg= new StringBuilder("Expected number (" + fExpectedLoggedNonOK + ") of "); StringBuilder msg= new StringBuilder("Expected number (").append(fExpectedLoggedNonOK).append(") of ");
msg.append("Non-OK status objects in log differs from actual (" + statusLog.size() + ").\n"); msg.append("Non-OK status objects in log differs from actual (").append(statusLog.size()).append(").\n");
Throwable cause= null; Throwable cause= null;
if (!statusLog.isEmpty()) { if (!statusLog.isEmpty()) {
synchronized (statusLog) { synchronized (statusLog) {
@ -217,7 +217,7 @@ public class BaseTestCase extends TestCase {
IStatus[] ss= {status}; IStatus[] ss= {status};
ss= status instanceof MultiStatus ? ((MultiStatus) status).getChildren() : ss; ss= status instanceof MultiStatus ? ((MultiStatus) status).getChildren() : ss;
for (IStatus s : ss) { for (IStatus s : ss) {
msg.append("\t" + s.getMessage() + " "); msg.append('\t').append(s.getMessage()).append(' ');
Throwable t= s.getException(); Throwable t= s.getException();
cause= cause != null ? cause : t; cause= cause != null ? cause : t;

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2014 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2016 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -154,7 +154,7 @@ public class TestSourceReader {
for (String line = br.readLine(); line != null; line = br.readLine()) { for (String line = br.readLine(); line != null; line = br.readLine()) {
line = line.replaceFirst("^\\s*", ""); // Replace leading whitespace, preserve trailing line = line.replaceFirst("^\\s*", ""); // Replace leading whitespace, preserve trailing
if (line.startsWith("//")) { if (line.startsWith("//")) {
content.append(line.substring(2) + "\n"); content.append(line.substring(2)).append('\n');
} else { } else {
if (!line.startsWith("@") && content.length() > 0) { if (!line.startsWith("@") && content.length() > 0) {
contents.add(content); contents.add(content);

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2011 IBM Corporation and others. * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -328,7 +328,7 @@ public class CElementBaseLabels {
if (element instanceof IBinary) { if (element instanceof IBinary) {
IBinary bin = (IBinary)element; IBinary bin = (IBinary)element;
buf.append(" - [" + bin.getCPU() + "/" + (bin.isLittleEndian() ? "le" : "be") + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ buf.append(" - [").append(bin.getCPU()).append('/').append(bin.isLittleEndian() ? "le" : "be").append(']'); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} }
} }

View file

@ -451,10 +451,10 @@ public class Buffer implements IBuffer {
@Override @Override
public String toString() { public String toString() {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
buffer.append("Owner: " + ((CElement)this.owner).toString()); //$NON-NLS-1$ buffer.append("Owner: ").append(((CElement)this.owner).toString()); //$NON-NLS-1$
buffer.append("\nHas unsaved changes: " + this.hasUnsavedChanges()); //$NON-NLS-1$ buffer.append("\nHas unsaved changes: ").append(this.hasUnsavedChanges()); //$NON-NLS-1$
buffer.append("\nIs readonly: " + this.isReadOnly()); //$NON-NLS-1$ buffer.append("\nIs readonly: ").append(this.isReadOnly()); //$NON-NLS-1$
buffer.append("\nIs closed: " + this.isClosed()); //$NON-NLS-1$ buffer.append("\nIs closed: ").append(this.isClosed()); //$NON-NLS-1$
buffer.append("\nContents:\n"); //$NON-NLS-1$ buffer.append("\nContents:\n"); //$NON-NLS-1$
char[] contents = this.getCharacters(); char[] contents = this.getCharacters();
if (contents == null) { if (contents == null) {

View file

@ -671,13 +671,13 @@ public class CElementDelta implements ICElementDelta {
if ((changeFlags & ICElementDelta.F_MOVED_FROM) != 0) { if ((changeFlags & ICElementDelta.F_MOVED_FROM) != 0) {
if (prev) if (prev)
buffer.append(" | "); //$NON-NLS-1$ buffer.append(" | "); //$NON-NLS-1$
//buffer.append("MOVED_FROM(" + ((CElement)getMovedFromElement()).toStringWithAncestors() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //buffer.append("MOVED_FROM(").append(((CElement)getMovedFromElement()).toStringWithAncestors().append(')'); //$NON-NLS-1$
prev = true; prev = true;
} }
if ((changeFlags & ICElementDelta.F_MOVED_TO) != 0) { if ((changeFlags & ICElementDelta.F_MOVED_TO) != 0) {
if (prev) if (prev)
buffer.append(" | "); //$NON-NLS-1$ buffer.append(" | "); //$NON-NLS-1$
//buffer.append("MOVED_TO(" + ((CElement)getMovedToElement()).toStringWithAncestors() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //buffer.append("MOVED_TO(").append(((CElement)getMovedToElement()).toStringWithAncestors()).append(')'); //$NON-NLS-1$
prev = true; prev = true;
} }
if ((changeFlags & ICElementDelta.F_MODIFIERS) != 0) { if ((changeFlags & ICElementDelta.F_MODIFIERS) != 0) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2012 Intel Corporation and others. * Copyright (c) 2007, 2016 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -160,7 +160,7 @@ public class CProjectDescriptionDelta implements ICDescriptionDelta {
@SuppressWarnings("nls") @SuppressWarnings("nls")
private static String flagsToString(int flags) { private static String flagsToString(int flags) {
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
str.append(", flags=0x" + Integer.toHexString(flags)); str.append(", flags=0x").append(Integer.toHexString(flags));
str.append(":"); str.append(":");
if ((flags&ACTIVE_CFG)!=0) str.append("ACTIVE_CFG|"); if ((flags&ACTIVE_CFG)!=0) str.append("ACTIVE_CFG|");
@ -197,10 +197,10 @@ public class CProjectDescriptionDelta implements ICDescriptionDelta {
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
String type = fSetting.getClass().getSimpleName(); String type = fSetting.getClass().getSimpleName();
str.append("[" + type + "]"); str.append('[').append(type).append(']');
int kind = getDeltaKind(); int kind = getDeltaKind();
str.append(", kind="+kind); str.append(", kind=").append(kind);
switch (kind) { switch (kind) {
case ADDED: str.append(":ADDED");break; case ADDED: str.append(":ADDED");break;
case REMOVED: str.append(":REMOVED");break; case REMOVED: str.append(":REMOVED");break;
@ -214,7 +214,7 @@ public class CProjectDescriptionDelta implements ICDescriptionDelta {
if (children==null) { if (children==null) {
str.append(", no children"); str.append(", no children");
} else { } else {
str.append(", " + getChildren().length + " children"); str.append(", ").append(getChildren().length).append(" children");
} }
return str.toString(); return str.toString();

View file

@ -43,7 +43,7 @@ public class CompositeCPPFunctionSpecialization extends CompositeCPPFunction imp
@Override @Override
public String toString() { public String toString() {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
result.append(getName()+" "+ASTTypeUtil.getParameterTypeString(getType())); //$NON-NLS-1$ result.append(getName()).append(' ').append(ASTTypeUtil.getParameterTypeString(getType()));
return result.toString(); return result.toString();
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2015 QNX Software Systems and others. * Copyright (c) 2005, 2016 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -1016,7 +1016,7 @@ public class PDOMFile implements IIndexFragmentFile {
buf.append(", includes: "); //$NON-NLS-1$ buf.append(", includes: "); //$NON-NLS-1$
buf.append(getIncludes().length); buf.append(getIncludes().length);
} catch (CoreException e) { } catch (CoreException e) {
buf.append(" (incomplete due to " + e.getClass().getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ buf.append(" (incomplete due to ").append(e.getClass().getName()).append(')'); //$NON-NLS-1$
} }
return buf.toString(); return buf.toString();
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2013 QNX Software Systems and others. * Copyright (c) 2006, 2016 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -322,15 +322,15 @@ public class PDOMInclude implements IIndexFragmentInclude {
buf.append(isSystem ? '>' : '"'); buf.append(isSystem ? '>' : '"');
IIndexFile includedBy = getIncludedBy(); IIndexFile includedBy = getIncludedBy();
if (includedBy != null) if (includedBy != null)
buf.append(" in " + includedBy); //$NON-NLS-1$ buf.append(" in ").append(includedBy); //$NON-NLS-1$
IIndexFragmentFile includes = getIncludes(); IIndexFragmentFile includes = getIncludes();
if (includes != null) { if (includes != null) {
buf.append(" resolved to " + includes); //$NON-NLS-1$ buf.append(" resolved to ").append(includes); //$NON-NLS-1$
} else { } else {
buf.append(" unresolved"); //$NON-NLS-1$ buf.append(" unresolved"); //$NON-NLS-1$
} }
} catch (CoreException e) { } catch (CoreException e) {
buf.append(" (incomplete due to " + e.getClass().getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ buf.append(" (incomplete due to ").append(e.getClass().getName()).append(')'); //$NON-NLS-1$
e.printStackTrace(); e.printStackTrace();
} }
return buf.toString(); return buf.toString();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2013 IBM Corporation and others. * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -1781,7 +1781,7 @@ public class Scribe {
@Override @Override
public String toString() { public String toString() {
StringBuilder buffer= new StringBuilder(); StringBuilder buffer= new StringBuilder();
buffer.append("(page width = " + pageWidth + ") - (tabChar = "); //$NON-NLS-1$//$NON-NLS-2$ buffer.append("(page width = ").append(pageWidth).append(") - (tabChar = "); //$NON-NLS-1$//$NON-NLS-2$
switch (tabChar) { switch (tabChar) {
case DefaultCodeFormatterOptions.TAB: case DefaultCodeFormatterOptions.TAB:
buffer.append("TAB"); //$NON-NLS-1$ buffer.append("TAB"); //$NON-NLS-1$
@ -1793,11 +1793,11 @@ public class Scribe {
buffer.append("MIXED"); //$NON-NLS-1$ buffer.append("MIXED"); //$NON-NLS-1$
} }
buffer buffer
.append(") - (tabSize = " + tabLength + ")") //$NON-NLS-1$//$NON-NLS-2$ .append(") - (tabSize = ").append(tabLength).append(')') //$NON-NLS-1$/
.append(lineSeparator) .append(lineSeparator)
.append("(line = " + line + ") - (column = " + column + ") - (identationLevel = " + indentationLevel + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ .append("(line = ").append(line).append(") - (column = ").append(column).append(") - (identationLevel = ").append(indentationLevel).append(')') //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
.append(lineSeparator) .append(lineSeparator)
.append("(needSpace = " + needSpace + ") - (lastNumberOfNewLines = " + lastNumberOfNewLines + ") - (checkLineWrapping = " + checkLineWrapping + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ .append("(needSpace = ").append(needSpace).append(") - (lastNumberOfNewLines = ").append(lastNumberOfNewLines).append(") - (checkLineWrapping = ").append(checkLineWrapping).append(')') //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
.append(lineSeparator).append( .append(lineSeparator).append(
"==================================================================================") //$NON-NLS-1$ "==================================================================================") //$NON-NLS-1$
.append(lineSeparator); .append(lineSeparator);

View file

@ -93,7 +93,7 @@ public class Exe {
buffer.append("EXE HEADER VALUES").append(NL); //$NON-NLS-1$ buffer.append("EXE HEADER VALUES").append(NL); //$NON-NLS-1$
buffer.append("signature "); //$NON-NLS-1$ buffer.append("signature "); //$NON-NLS-1$
buffer.append((char)e_signature[0] + " " + (char)e_signature[1]); //$NON-NLS-1$ buffer.append((char)e_signature[0]).append(' ').append((char)e_signature[1]);
buffer.append(NL); buffer.append(NL);
buffer.append("lastsize: 0x"); //$NON-NLS-1$ buffer.append("lastsize: 0x"); //$NON-NLS-1$

View file

@ -90,11 +90,11 @@ public class Dwarf {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Length: " + length).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ sb.append("Length: ").append(length).append('\n'); //$NON-NLS-1$
sb.append("Version: " + version).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ sb.append("Version: ").append(version).append('\n'); //$NON-NLS-1$
sb.append("Abbreviation: " + abbreviationOffset).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ sb.append("Abbreviation: ").append(abbreviationOffset).append('\n'); //$NON-NLS-1$
sb.append("Address size: " + addressSize).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ sb.append("Address size: ").append(addressSize).append('\n'); //$NON-NLS-1$
sb.append("Offset size: " + offsetSize).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ sb.append("Offset size: ").append(offsetSize).append('\n'); //$NON-NLS-1$
return sb.toString(); return sb.toString();
} }
} }
@ -126,8 +126,8 @@ public class Dwarf {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("name: " + Long.toHexString(name)); //$NON-NLS-1$ sb.append("name: ").append(Long.toHexString(name)); //$NON-NLS-1$
sb.append(" value: " + Long.toHexString(form)); //$NON-NLS-1$ sb.append(" value: ").append(Long.toHexString(form)); //$NON-NLS-1$
return sb.toString(); return sb.toString();
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2016 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -107,7 +107,7 @@ public class InactiveCodeHighlightingTest extends TestCase {
Position position= positions[i]; Position position= positions[i];
int startLine= document.getLineOfOffset(position.getOffset()); int startLine= document.getLineOfOffset(position.getOffset());
int endLine= document.getLineOfOffset(position.getOffset()+position.getLength()-1); int endLine= document.getLineOfOffset(position.getOffset()+position.getLength()-1);
buf.append("\tcreatePosition(" + startLine + ", " + endLine + "),\n"); buf.append("\tcreatePosition(").append(startLine).append(", ").append(endLine).append("),\n");
} }
buf.append("};\n"); buf.append("};\n");
return buf.toString(); return buf.toString();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2014 QNX Software Systems and others. * Copyright (c) 2005, 2016 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -146,7 +146,7 @@ public class PartitionTokenScannerTest extends TestCase {
if (offsetIndex > line.length()) if (offsetIndex > line.length())
offsetIndex= line.length(); offsetIndex= line.length();
buffer.append("line = " + document.getLineOfOffset(offset) + ": ["); buffer.append("line = ").append(document.getLineOfOffset(offset)).append(": [");
buffer.append(line.substring(0, offsetIndex)); buffer.append(line.substring(0, offsetIndex));
buffer.append("<POS>"); buffer.append("<POS>");
buffer.append(line.substring(offsetIndex)); buffer.append(line.substring(offsetIndex));

View file

@ -210,7 +210,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
ModelElement item= (ModelElement) element; ModelElement item= (ModelElement) element;
boolean included= changed == item ? isInDefaultCategory : item.isInDefaultCategory(); boolean included= changed == item ? isInDefaultCategory : item.isInDefaultCategory();
if (!included) if (!included)
buf.append(item.getId() + SEPARATOR); buf.append(item.getId()).append(SEPARATOR);
} }
String newValue= buf.toString(); String newValue= buf.toString();
@ -225,7 +225,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo
ModelElement item= it.next(); ModelElement item= it.next();
boolean separate= changed == item ? isSeparate : item.isSeparateCommand(); boolean separate= changed == item ? isSeparate : item.isSeparateCommand();
int rank= separate ? i : i + LIMIT; int rank= separate ? i : i + LIMIT;
buf.append(item.getId() + COLON + rank + SEPARATOR); buf.append(item.getId()).append(COLON).append(rank).append(SEPARATOR);
} }
String newValue= buf.toString(); String newValue= buf.toString();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others. * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -54,22 +54,22 @@ public class CStringAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy
token = tokenizer.nextToken(); token = tokenizer.nextToken();
if (token.equals("\n")) { //$NON-NLS-1$ if (token.equals("\n")) { //$NON-NLS-1$
buffer.append("\\n"); //$NON-NLS-1$ buffer.append("\\n"); //$NON-NLS-1$
buffer.append("\"" + delimiter); //$NON-NLS-1$ buffer.append('"').append(delimiter);
buffer.append(indentation); buffer.append(indentation);
buffer.append("\""); //$NON-NLS-1$ buffer.append('"');
continue; continue;
} }
buffer.append("\"" + delimiter); //$NON-NLS-1$ buffer.append('"').append(delimiter);
buffer.append(indentation); buffer.append(indentation);
buffer.append("\""); //$NON-NLS-1$ buffer.append('"');
} else { } else {
continue; continue;
} }
} else if (token.equals("\n")) { //$NON-NLS-1$ } else if (token.equals("\n")) { //$NON-NLS-1$
buffer.append("\\n"); //$NON-NLS-1$ buffer.append("\\n"); //$NON-NLS-1$
buffer.append("\"" + delimiter); //$NON-NLS-1$ buffer.append('"').append(delimiter);
buffer.append(indentation); buffer.append(indentation);
buffer.append("\""); //$NON-NLS-1$ buffer.append('"');
continue; continue;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2015 Symbian Software Systems and others. * Copyright (c) 2008, 2016 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -125,7 +125,7 @@ public class DoxygenSingleAutoEditStrategy extends DoxygenMultilineAutoEditStrat
{ {
buf.setLength(0); buf.setLength(0);
buf.append(fgDefaultLineDelim); buf.append(fgDefaultLineDelim);
buf.append(indentationWithPrefix + " "); //$NON-NLS-1$ buf.append(indentationWithPrefix).append(' ');
c.shiftsCaret= false; c.shiftsCaret= false;
c.caretOffset= c.offset + buf.length(); c.caretOffset= c.offset + buf.length();
} else { } else {
@ -134,7 +134,7 @@ public class DoxygenSingleAutoEditStrategy extends DoxygenMultilineAutoEditStrat
c.shiftsCaret= false; c.shiftsCaret= false;
c.caretOffset= c.offset + 1; c.caretOffset= c.offset + 1;
buf.setLength(0); buf.setLength(0);
buf.append(" " + //$NON-NLS-1$ buf.append(' ').append(
indent(content, indentationWithPrefix + " ", //$NON-NLS-1$ indent(content, indentationWithPrefix + " ", //$NON-NLS-1$
fgDefaultLineDelim).substring((indentationWithPrefix + " ").length())); //$NON-NLS-1$ fgDefaultLineDelim).substring((indentationWithPrefix + " ").length())); //$NON-NLS-1$
} }

View file

@ -240,7 +240,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut2 {
if (element instanceof IBinary) { if (element instanceof IBinary) {
IBinary bin = (IBinary)element; IBinary bin = (IBinary)element;
StringBuilder name = new StringBuilder(); StringBuilder name = new StringBuilder();
name.append(bin.getCPU() + (bin.isLittleEndian() ? "le" : "be")); //$NON-NLS-1$ //$NON-NLS-2$ name.append(bin.getCPU()).append(bin.isLittleEndian() ? "le" : "be"); //$NON-NLS-1$ //$NON-NLS-2$
name.append(" - "); //$NON-NLS-1$ name.append(" - "); //$NON-NLS-1$
name.append(bin.getPath().toString()); name.append(bin.getPath().toString());
return name.toString(); return name.toString();

View file

@ -254,7 +254,7 @@ public class VisualizerThread
// Add the address // Add the address
if (dmData.getAddress() != null) { if (dmData.getAddress() != null) {
label.append("- 0x" + dmData.getAddress().toString(16)); //$NON-NLS-1$ label.append("- 0x").append(dmData.getAddress().toString(16)); //$NON-NLS-1$
} }
this.m_locInfo = label.toString(); this.m_locInfo = label.toString();
} }

View file

@ -111,10 +111,10 @@ public class ProcessPrompter implements IStatusHandler {
String owner = info.getOwner(); String owner = info.getOwner();
if (owner != null && !owner.isEmpty()) { if (owner != null && !owner.isEmpty()) {
text.append(" (" + owner + ")"); //$NON-NLS-1$//$NON-NLS-2$ text.append(" (").append(owner).append(")"); //$NON-NLS-1$//$NON-NLS-2$
} }
text.append(" - " + info.getPid()); //$NON-NLS-1$ text.append(" - ").append(info.getPid()); //$NON-NLS-1$
String[] cores = info.getCores(); String[] cores = info.getCores();
if (cores != null && cores.length > 0) { if (cores != null && cores.length > 0) {
@ -124,10 +124,10 @@ public class ProcessPrompter implements IStatusHandler {
} else { } else {
coreStr = LaunchUIMessages.getString("ProcessPrompter.Cores"); //$NON-NLS-1$ coreStr = LaunchUIMessages.getString("ProcessPrompter.Cores"); //$NON-NLS-1$
} }
text.append(" [" + coreStr + ": "); //$NON-NLS-1$//$NON-NLS-2$ text.append(" [").append(coreStr).append(": "); //$NON-NLS-1$//$NON-NLS-2$
for (String core : cores) { for (String core : cores) {
text.append(core + ", "); //$NON-NLS-1$ text.append(core).append(", "); //$NON-NLS-1$
} }
// Remove the last comma and space // Remove the last comma and space
text.replace(text.length()-2, text.length(), "]"); //$NON-NLS-1$ text.replace(text.length()-2, text.length(), "]"); //$NON-NLS-1$

View file

@ -972,16 +972,16 @@ public class TraceControlView extends ViewPart implements IViewPart {
StringBuilder sb = new StringBuilder(64); StringBuilder sb = new StringBuilder(64);
if (!shortForm) { if (!shortForm) {
if (days != 0) sb.append(days + TracepointsMessages.TraceControlView_date_days); if (days != 0) sb.append(days).append(TracepointsMessages.TraceControlView_date_days);
if (hours != 0) sb.append(hours + TracepointsMessages.TraceControlView_date_hours); if (hours != 0) sb.append(hours).append(TracepointsMessages.TraceControlView_date_hours);
if (minutes != 0) sb.append(minutes + TracepointsMessages.TraceControlView_date_minutes); if (minutes != 0) sb.append(minutes).append(TracepointsMessages.TraceControlView_date_minutes);
if (seconds != 0) sb.append(seconds + TracepointsMessages.TraceControlView_date_seconds); if (seconds != 0) sb.append(seconds).append(TracepointsMessages.TraceControlView_date_seconds);
if (sb.length() == 0) sb.append(TracepointsMessages.TraceControlView_date_zero); if (sb.length() == 0) sb.append(TracepointsMessages.TraceControlView_date_zero);
} else { } else {
if (days != 0) sb.append(days + TracepointsMessages.TraceControlView_date_short_days); if (days != 0) sb.append(days).append(TracepointsMessages.TraceControlView_date_short_days);
if (hours != 0) sb.append(hours + TracepointsMessages.TraceControlView_date_short_hours); if (hours != 0) sb.append(hours).append(TracepointsMessages.TraceControlView_date_short_hours);
if (minutes != 0) sb.append(minutes + TracepointsMessages.TraceControlView_date_short_minutes); if (minutes != 0) sb.append(minutes).append(TracepointsMessages.TraceControlView_date_short_minutes);
if (seconds != 0) sb.append(seconds + TracepointsMessages.TraceControlView_date_short_seconds); if (seconds != 0) sb.append(seconds).append(TracepointsMessages.TraceControlView_date_short_seconds);
if (sb.length() == 0) sb.append(TracepointsMessages.TraceControlView_date_short_zero); if (sb.length() == 0) sb.append(TracepointsMessages.TraceControlView_date_short_zero);
} }

View file

@ -368,7 +368,7 @@ public class ContainerVMNode extends AbstractContainerVMNode
if (cores != null) { if (cores != null) {
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
for (String core : cores) { for (String core : cores) {
str.append(core + ","); //$NON-NLS-1$ str.append(core).append(',');
} }
if (str.length() > 0) { if (str.length() > 0) {
coresStr = str.substring(0, str.length() - 1); coresStr = str.substring(0, str.length() - 1);

View file

@ -349,7 +349,7 @@ public class ThreadVMNode extends AbstractThreadVMNode
if (cores != null) { if (cores != null) {
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
for (String core : cores) { for (String core : cores) {
str.append(core + ","); //$NON-NLS-1$ str.append(core).append(',');
} }
if (str.length() > 0) { if (str.length() > 0) {
String coresStr = str.substring(0, str.length() - 1); String coresStr = str.substring(0, str.length() - 1);

View file

@ -238,16 +238,16 @@ public class GDBTypeParser {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
switch (getType()) { switch (getType()) {
case FUNCTION : case FUNCTION :
sb.append(" function returning " + (hasChild() ? child.verbose() : "")); //$NON-NLS-1$//$NON-NLS-2$ sb.append(" function returning ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$
break; break;
case ARRAY : case ARRAY :
sb.append(" array[" + dimension + "]" + " of " + (hasChild() ? child.verbose() : "")); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ sb.append(" array[").append(dimension).append("] of ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
break; break;
case REFERENCE : case REFERENCE :
sb.append(" reference to " + (hasChild() ? child.verbose() : "")); //$NON-NLS-1$//$NON-NLS-2$ sb.append(" reference to ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$
break; break;
case POINTER : case POINTER :
sb.append(" pointer to " + (hasChild() ? child.verbose() : "")); //$NON-NLS-1$//$NON-NLS-2$ sb.append(" pointer to ").append(hasChild() ? child.verbose() : ""); //$NON-NLS-1$//$NON-NLS-2$
break; break;
} }
return sb.toString(); return sb.toString();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2013 Ericsson AB and others. * Copyright (c) 2013, 2016 Ericsson AB and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -88,7 +88,7 @@ public class StepIntoSelectionActiveOperation {
StringBuilder sb = null; StringBuilder sb = null;
sb = new StringBuilder(); sb = new StringBuilder();
if (fTargetFunction.getParent() != null) { if (fTargetFunction.getParent() != null) {
sb.append(fTargetFunction.getParent().getElementName() + StepIntoSelectionUtils.cppSep); sb.append(fTargetFunction.getParent().getElementName()).append(StepIntoSelectionUtils.cppSep);
} }
sb.append(fTargetFunction.getElementName()); sb.append(fTargetFunction.getElementName());

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2010 Freescale Semiconductor and others. * Copyright (c) 2010, 2016 Freescale Semiconductor and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -25,9 +25,9 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
public class CLICatch extends CLICommand<CLICatchInfo> { public class CLICatch extends CLICommand<CLICatchInfo> {
private static String formOperation(String event, String[] args) { private static String formOperation(String event, String[] args) {
StringBuilder oper = new StringBuilder("catch " + event); //$NON-NLS-1$ StringBuilder oper = new StringBuilder("catch ").append(event); //$NON-NLS-1$
for (String arg : args) { for (String arg : args) {
oper.append(" " + arg); //$NON-NLS-1$ oper.append(' ').append(arg);
} }
return oper.toString(); return oper.toString();
} }

View file

@ -150,15 +150,15 @@ public class MICommand<V extends MIInfo> implements ICommand<V> {
// Add the --thread option // Add the --thread option
if (supportsThreadAndFrameOptions() && threadId != null && !threadId.trim().isEmpty()) { if (supportsThreadAndFrameOptions() && threadId != null && !threadId.trim().isEmpty()) {
command.append(" --thread " + threadId); //$NON-NLS-1$ command.append(" --thread ").append(threadId); //$NON-NLS-1$
// Add the --frame option, but only if we are using the --thread option // Add the --frame option, but only if we are using the --thread option
if (frameId >= 0) { if (frameId >= 0) {
command.append(" --frame " + frameId); //$NON-NLS-1$ command.append(" --frame ").append(frameId); //$NON-NLS-1$
} }
} else if (supportsThreadGroupOption() && groupId != null && !groupId.trim().isEmpty()) { } else if (supportsThreadGroupOption() && groupId != null && !groupId.trim().isEmpty()) {
// The --thread-group option is only allowed if we are not using the --thread option // The --thread-group option is only allowed if we are not using the --thread option
command.append(" --thread-group " + groupId); //$NON-NLS-1$ command.append(" --thread-group ").append(groupId); //$NON-NLS-1$
} }
String opt = optionsToString(); String opt = optionsToString();

View file

@ -62,19 +62,19 @@ public class MIFrame {
@Override @Override
public String toString() { public String toString() {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
buffer.append("level=\"" + level + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append("level=\"").append(level).append('"'); //$NON-NLS-1$
buffer.append(",addr=\"" + addr + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",addr=\"").append(addr).append('"'); //$NON-NLS-1$
buffer.append(",func=\"" + func + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",func=\"").append(func).append('"'); //$NON-NLS-1$
buffer.append(",file=\"" + file + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",file=\"").append(file).append('"'); //$NON-NLS-1$
buffer.append(",fullname=\"" + fullname + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",fullname=\"").append(fullname).append('"'); //$NON-NLS-1$
buffer.append(",line=\"").append(line).append('"'); //$NON-NLS-1$ buffer.append(",line=\"").append(line).append('"'); //$NON-NLS-1$
buffer.append(",args=["); //$NON-NLS-1$ buffer.append(",args=["); //$NON-NLS-1$
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
if (i != 0) { if (i != 0) {
buffer.append(','); buffer.append(',');
} }
buffer.append("{name=\"" + args[i].getName() + "\"");//$NON-NLS-1$//$NON-NLS-2$ buffer.append("{name=\"").append(args[i].getName()).append('"');//$NON-NLS-1$
buffer.append(",value=\"" + args[i].getValue() + "\"}");//$NON-NLS-1$//$NON-NLS-2$ buffer.append(",value=\"").append(args[i].getValue()).append("\"}");//$NON-NLS-1$//$NON-NLS-2$
} }
buffer.append(']'); buffer.append(']');
return buffer.toString(); return buffer.toString();

View file

@ -39,7 +39,7 @@ public class MIRegisterValue {
public String toString() { public String toString() {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
buffer.append("number=\"").append(number).append('"'); //$NON-NLS-1$ buffer.append("number=\"").append(number).append('"'); //$NON-NLS-1$
buffer.append(',').append("value=\"" + value + "\""); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append(',').append("value=\"").append(value).append('"'); //$NON-NLS-1$
return buffer.toString(); return buffer.toString();
} }

View file

@ -45,7 +45,7 @@ public class MIResult {
if (!v.isEmpty() && (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('"').append(v).append('"');
} }
} }
return buffer.toString(); return buffer.toString();

View file

@ -335,7 +335,7 @@ public class NumberFormatDetailPane implements IDetailPane2, IAdaptable, IProper
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
StringBuilder finalResult = new StringBuilder(); StringBuilder finalResult = new StringBuilder();
finalResult.append(NAME).append(getData().get(IElementPropertiesProvider.PROP_NAME)).append(CRLF); finalResult.append(NAME).append(getData().get(IElementPropertiesProvider.PROP_NAME)).append(CRLF);
if (formats != null) { if (formats != null) {
for (int i = 0; i < formats.length; i++) { for (int i = 0; i < formats.length; i++) {
@ -363,7 +363,7 @@ public class NumberFormatDetailPane implements IDetailPane2, IAdaptable, IProper
String childMessage = statuses[i].getMessage().trim(); String childMessage = statuses[i].getMessage().trim();
// Avoid root message duplication // Avoid root message duplication
if (!childMessage.equals(rootMessage)) { if (!childMessage.equals(rootMessage)) {
finalResult.append(CRLF + CRLF + (i+1) + PARENTHESES + childMessage); finalResult.append(CRLF).append(CRLF).append(i + 1).append(PARENTHESES).append(childMessage);
} }
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2015 Wind River Systems and others. * Copyright (c) 2006, 2016 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -559,7 +559,7 @@ public class StackFramesVMNode extends AbstractDMVMNode
// Add the address // Add the address
if (dmData.getAddress() != null) { if (dmData.getAddress() != null) {
label.append("- 0x" + dmData.getAddress().toString(16)); //$NON-NLS-1$ label.append("- 0x").append(dmData.getAddress().toString(16)); //$NON-NLS-1$
} }
// Set the label to the result listener // Set the label to the result listener

View file

@ -109,7 +109,7 @@ public class ViewerDataRequestMonitor<V> extends DataRequestMonitor<V> {
break; break;
} }
if (topFrame != null) { if (topFrame != null) {
str.append("[" + type + "] " + topFrame + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ str.append('[').append(type).append("] ").append(topFrame).append('\n'); //$NON-NLS-1$
} }
else { else {
str.append("<unknown>\n"); //$NON-NLS-1$ str.append("<unknown>\n"); //$NON-NLS-1$

View file

@ -827,14 +827,14 @@ abstract public class AbstractVMProvider implements IVMProvider, IVMEventListene
str.append(DsfPlugin.getDebugTime()); str.append(DsfPlugin.getDebugTime());
str.append(' '); str.append(' ');
if (action == EventHandlerAction.skipped || action == EventHandlerAction.canceled) { if (action == EventHandlerAction.skipped || action == EventHandlerAction.canceled) {
str.append(LoggingUtils.toString(this) + " " + action.toString() + " event " + LoggingUtils.toString(skippedOrCanceledEvent) + " because of event " + LoggingUtils.toString(event)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ str.append(LoggingUtils.toString(this)).append(' ').append(action).append(" event ").append(LoggingUtils.toString(skippedOrCanceledEvent)).append(" because of event ").append(LoggingUtils.toString(event)); //$NON-NLS-1$ //$NON-NLS-2$
} }
else { else {
str.append(LoggingUtils.toString(this) + " " + action.toString() + " event " + LoggingUtils.toString(event)); //$NON-NLS-1$ //$NON-NLS-2$ str.append(LoggingUtils.toString(this)).append(' ').append(action).append(" event ").append(LoggingUtils.toString(event)); //$NON-NLS-1$
} }
if (action != EventHandlerAction.received) { if (action != EventHandlerAction.received) {
str.append(" for proxy " + LoggingUtils.toString(proxy) + ", whose root is " + LoggingUtils.toString(proxy.getRootElement())); //$NON-NLS-1$ //$NON-NLS-2$ str.append(" for proxy ").append(LoggingUtils.toString(proxy)).append(", whose root is ").append(LoggingUtils.toString(proxy.getRootElement())); //$NON-NLS-1$ //$NON-NLS-2$
} }
DsfUIPlugin.debug(str.toString()); DsfUIPlugin.debug(str.toString());
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2015 Wind River Systems and others. * Copyright (c) 2007, 2016 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -128,10 +128,10 @@ public class VMChildrenUpdate extends VMViewerUpdate implements IChildrenUpdate
// trace our result // trace our result
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()).append(' ').append(LoggingUtils.toString(this)).append(" marked done; element = ").append(LoggingUtils.toString(getElement())); //$NON-NLS-1$ //$NON-NLS-2$
if (fElements != null && !fElements.isEmpty()) { 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(" ").append(LoggingUtils.toString(element)).append('\n'); //$NON-NLS-1$
} }
str.deleteCharAt(str.length()-1); // remove trailing \n str.deleteCharAt(str.length()-1); // remove trailing \n
} }

View file

@ -284,10 +284,10 @@ public class VMDelta extends ModelDelta {
for (int i = 0; i < depth; i++) { for (int i = 0; i < depth; i++) {
indent += '\t'; indent += '\t';
} }
buf.append(indent + "\tElement: "); //$NON-NLS-1$ buf.append(indent).append("\tElement: "); //$NON-NLS-1$
buf.append(delta.getElement()); buf.append(delta.getElement());
buf.append('\n'); buf.append('\n');
buf.append(indent + "\t\tFlags: "); //$NON-NLS-1$ buf.append(indent).append("\t\tFlags: "); //$NON-NLS-1$
int flags = delta.getFlags(); int flags = delta.getFlags();
if (flags == 0) { if (flags == 0) {
buf.append("NO_CHANGE"); //$NON-NLS-1$ buf.append("NO_CHANGE"); //$NON-NLS-1$
@ -327,7 +327,7 @@ public class VMDelta extends ModelDelta {
} }
} }
buf.append('\n'); buf.append('\n');
buf.append(indent + "\t\tIndex: "); //$NON-NLS-1$ buf.append(indent).append("\t\tIndex: "); //$NON-NLS-1$
buf.append(delta.fIndex); buf.append(delta.fIndex);
buf.append(" Child Count: "); //$NON-NLS-1$ buf.append(" Child Count: "); //$NON-NLS-1$
buf.append(delta.fChildCount); buf.append(delta.fChildCount);

View file

@ -137,7 +137,7 @@ public class VMPropertiesUpdate extends VMViewerUpdate implements IPropertiesUpd
// trace our result // trace our result
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()).append(' ').append(LoggingUtils.toString(this)).append(" marked done; element = ").append(LoggingUtils.toString(getElement())); //$NON-NLS-1$
if (fValues != null) { if (fValues != null) {
Iterator<String> keyIter = fValues.keySet().iterator(); Iterator<String> keyIter = fValues.keySet().iterator();
while (keyIter.hasNext()) { while (keyIter.hasNext()) {
@ -146,7 +146,7 @@ public class VMPropertiesUpdate extends VMViewerUpdate implements IPropertiesUpd
if (val instanceof String[]) { if (val instanceof String[]) {
val = LoggingUtils.toString((String[])val); val = LoggingUtils.toString((String[])val);
} }
str.append(" " + prop + "=" + val + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ str.append(" ").append(prop).append("=").append(val).append('\n'); //$NON-NLS-1$ //$NON-NLS-2$
} }
str.deleteCharAt(str.length()-1); // remove trailing linefeed str.deleteCharAt(str.length()-1); // remove trailing linefeed
} }

View file

@ -1379,14 +1379,14 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
str.append(DsfPlugin.getDebugTime()); str.append(DsfPlugin.getDebugTime());
str.append(' '); str.append(' ');
if (action == EventHandlerAction.skipped || action == EventHandlerAction.canceled) { if (action == EventHandlerAction.skipped || action == EventHandlerAction.canceled) {
str.append(LoggingUtils.toString(this) + " " + action.toString() + " event " + LoggingUtils.toString(skippedOrCanceledEvent) + " because of event " + LoggingUtils.toString(event)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ str.append(LoggingUtils.toString(this)).append(' ').append(action).append(" event ").append(LoggingUtils.toString(skippedOrCanceledEvent)).append(" because of event ").append(LoggingUtils.toString(event)); //$NON-NLS-1$ //$NON-NLS-2$
} }
else { else {
str.append(LoggingUtils.toString(this) + " " + action.toString() + " event " + LoggingUtils.toString(event)); //$NON-NLS-1$ //$NON-NLS-2$ str.append(LoggingUtils.toString(this)).append(' ').append(action).append(" event ").append(LoggingUtils.toString(event)); //$NON-NLS-1$
} }
if (action != EventHandlerAction.received) { if (action != EventHandlerAction.received) {
str.append(" for proxy " + LoggingUtils.toString(proxy) + ", whose root is " + LoggingUtils.toString(proxy.getRootElement())); //$NON-NLS-1$ //$NON-NLS-2$ str.append(" for proxy ").append(LoggingUtils.toString(proxy)).append( ", whose root is ").append(LoggingUtils.toString(proxy.getRootElement())); //$NON-NLS-1$ //$NON-NLS-2$
} }
DsfUIPlugin.debug(str.toString()); DsfUIPlugin.debug(str.toString());
} }

View file

@ -259,7 +259,7 @@ public class DefaultDsfExecutor extends ScheduledThreadPoolExecutor
final String refstr = LoggingUtils.toString(executable, false); final String refstr = LoggingUtils.toString(executable, false);
String tostr = LoggingUtils.trimTrailingNewlines(executable.toString()); String tostr = LoggingUtils.trimTrailingNewlines(executable.toString());
traceBuilder.append("\n\t\t"); //$NON-NLS-1$ traceBuilder.append("\n\t\t"); //$NON-NLS-1$
traceBuilder.append("instance = " + refstr); //$NON-NLS-1$ traceBuilder.append("instance = ").append(refstr); //$NON-NLS-1$
if (!tostr.equals(refstr)) { if (!tostr.equals(refstr)) {
traceBuilder.append(" ["); //$NON-NLS-1$ traceBuilder.append(" ["); //$NON-NLS-1$
traceBuilder.append(tostr); traceBuilder.append(tostr);

View file

@ -200,7 +200,7 @@ public class DsfExecutable {
// traceBuilder.append(' '); // traceBuilder.append(' ');
// //
// final String refstr = LoggingUtils.toString(this, false); // final String refstr = LoggingUtils.toString(this, false);
// traceBuilder.append("DSF executable was never executed: " + refstr); //$NON-NLS-1$ // traceBuilder.append("DSF executable was never executed: ").append(refstr); //$NON-NLS-1$
// final String tostr = LoggingUtils.trimTrailingNewlines(this.toString()); // final String tostr = LoggingUtils.trimTrailingNewlines(this.toString());
// if (!tostr.equals(refstr)) { // if (!tostr.equals(refstr)) {
// traceBuilder.append(" ["); //$NON-NLS-1$ // traceBuilder.append(" ["); //$NON-NLS-1$

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2015 Freescale Semiconductor, Inc. and others. * Copyright (c) 2009, 2016 Freescale Semiconductor, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -73,7 +73,7 @@ public class LoggingUtils {
public static String toString(String[] strings) { public static String toString(String[] strings) {
StringBuilder str = new StringBuilder("{"); //$NON-NLS-1$ StringBuilder str = new StringBuilder("{"); //$NON-NLS-1$
for (String s : strings) { for (String s : strings) {
str.append(s + ", "); //$NON-NLS-1$ str.append(s).append(", "); //$NON-NLS-1$
} }
if (strings.length > 0) { if (strings.length > 0) {
str.delete(str.length()-2, Integer.MAX_VALUE); // remove the trailing comma and space str.delete(str.length()-2, Integer.MAX_VALUE); // remove the trailing comma and space

View file

@ -490,19 +490,19 @@ public class ViewerUpdatesListener
} }
if (fFailOnMultipleLabelUpdateSequences) { if (fFailOnMultipleLabelUpdateSequences) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fMultipleLabelUpdateSequencesObserved = " + fMultipleLabelUpdateSequencesObserved); buf.append("fMultipleLabelUpdateSequencesObserved = ").append(fMultipleLabelUpdateSequencesObserved);
} }
if (fFailOnMultipleModelUpdateSequences) { if (fFailOnMultipleModelUpdateSequences) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fMultipleModelUpdateSequencesObserved = " + fMultipleModelUpdateSequencesObserved); buf.append("fMultipleModelUpdateSequencesObserved = ").append(fMultipleModelUpdateSequencesObserved);
} }
if ( (flags & LABEL_SEQUENCE_COMPLETE) != 0) { if ( (flags & LABEL_SEQUENCE_COMPLETE) != 0) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fLabelSequenceComplete = " + fLabelSequenceComplete); buf.append("fLabelSequenceComplete = ").append(fLabelSequenceComplete);
} }
if ( (flags & LABEL_UPDATES_RUNNING) != 0) { if ( (flags & LABEL_UPDATES_RUNNING) != 0) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fLabelUpdatesRunning = " + fLabelUpdatesCounter); buf.append("fLabelUpdatesRunning = ").append(fLabelUpdatesCounter);
} }
if ( (flags & LABEL_SEQUENCE_STARTED) != 0) { if ( (flags & LABEL_SEQUENCE_STARTED) != 0) {
buf.append("\n\t"); buf.append("\n\t");
@ -519,11 +519,11 @@ public class ViewerUpdatesListener
} }
if ( (flags & CONTENT_SEQUENCE_COMPLETE) != 0) { if ( (flags & CONTENT_SEQUENCE_COMPLETE) != 0) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fContentSequenceComplete = " + fContentSequenceComplete); buf.append("fContentSequenceComplete = ").append(fContentSequenceComplete);
} }
if ( (flags & VIEWER_UPDATES_RUNNING) != 0) { if ( (flags & VIEWER_UPDATES_RUNNING) != 0) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fContentUpdatesCounter = " + fContentUpdatesCounter); buf.append("fContentUpdatesCounter = ").append(fContentUpdatesCounter);
} }
if ( (flags & HAS_CHILDREN_UPDATES_STARTED) != 0) { if ( (flags & HAS_CHILDREN_UPDATES_STARTED) != 0) {
buf.append("\n\t"); buf.append("\n\t");
@ -566,26 +566,26 @@ public class ViewerUpdatesListener
} }
if ( (flags & MODEL_CHANGED_COMPLETE) != 0) { if ( (flags & MODEL_CHANGED_COMPLETE) != 0) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fModelChangedComplete = " + fModelChangedComplete); buf.append("fModelChangedComplete = ").append(fModelChangedComplete);
} }
if ( (flags & STATE_SAVE_COMPLETE) != 0) { if ( (flags & STATE_SAVE_COMPLETE) != 0) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fStateSaveComplete = " + fStateSaveComplete); buf.append("fStateSaveComplete = ").append(fStateSaveComplete);
} }
if ( (flags & STATE_RESTORE_COMPLETE) != 0) { if ( (flags & STATE_RESTORE_COMPLETE) != 0) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fStateRestoreComplete = " + fStateRestoreComplete); buf.append("fStateRestoreComplete = ").append(fStateRestoreComplete);
} }
// if ( (flags & MODEL_PROXIES_INSTALLED) != 0) { // if ( (flags & MODEL_PROXIES_INSTALLED) != 0) {
// buf.append("\n\t"); // buf.append("\n\t");
// buf.append("fProxyModels = " + fProxyModels); // buf.append("fProxyModels = ").append(fProxyModels);
// } // }
if ( (flags & PROPERTY_UPDATES_STARTED) != 0) { if ( (flags & PROPERTY_UPDATES_STARTED) != 0) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fPropertiesUpdatesRunning = "); buf.append("fPropertiesUpdatesRunning = ");
buf.append(toStringViewerUpdatesSet(fPropertiesUpdatesRunning)); buf.append(toStringViewerUpdatesSet(fPropertiesUpdatesRunning));
buf.append("\n\t"); buf.append("\n\t");
buf.append("fPropertiesUpdatesCompleted = " + fPropertiesUpdatesCompleted); buf.append("fPropertiesUpdatesCompleted = ").append(fPropertiesUpdatesCompleted);
} }
if ( (flags & PROPERTY_UPDATES) != 0) { if ( (flags & PROPERTY_UPDATES) != 0) {
buf.append("\n\t"); buf.append("\n\t");
@ -594,7 +594,7 @@ public class ViewerUpdatesListener
} }
if (fTimeoutInterval > 0) { if (fTimeoutInterval > 0) {
buf.append("\n\t"); buf.append("\n\t");
buf.append("fTimeoutInterval = " + fTimeoutInterval); buf.append("fTimeoutInterval = ").append(fTimeoutInterval);
} }
return buf.toString(); return buf.toString();
} }

View file

@ -183,7 +183,7 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
b.append(gdbserverCommand + " " + commandArguments); //$NON-NLS-1$ b.append(gdbserverCommand).append(' ').append(commandArguments); //$NON-NLS-1$
String arguments = getProgramArguments(configuration); String arguments = getProgramArguments(configuration);
if (arguments.trim().length() > 0) { if (arguments.trim().length() > 0) {

View file

@ -272,7 +272,7 @@ public class CMainTab extends CAbstractMainTab {
if (element instanceof IBinary) { if (element instanceof IBinary) {
IBinary bin = (IBinary)element; IBinary bin = (IBinary)element;
StringBuilder name = new StringBuilder(); StringBuilder name = new StringBuilder();
name.append(bin.getCPU() + (bin.isLittleEndian() ? "le" : "be")); //$NON-NLS-1$ //$NON-NLS-2$ name.append(bin.getCPU()).append(bin.isLittleEndian() ? "le" : "be"); //$NON-NLS-1$ //$NON-NLS-2$
name.append(" - "); //$NON-NLS-1$ name.append(" - "); //$NON-NLS-1$
name.append(bin.getPath().toString()); name.append(bin.getPath().toString());
return name.toString(); return name.toString();

View file

@ -397,7 +397,7 @@ public class CMainTab2 extends CAbstractMainTab {
if (element instanceof IBinary) { if (element instanceof IBinary) {
IBinary bin = (IBinary)element; IBinary bin = (IBinary)element;
StringBuilder name = new StringBuilder(); StringBuilder name = new StringBuilder();
name.append(bin.getCPU() + (bin.isLittleEndian() ? "le" : "be")); //$NON-NLS-1$ //$NON-NLS-2$ name.append(bin.getCPU()).append(bin.isLittleEndian() ? "le" : "be"); //$NON-NLS-1$ //$NON-NLS-2$
name.append(" - "); //$NON-NLS-1$ name.append(" - "); //$NON-NLS-1$
name.append(bin.getPath().toString()); name.append(bin.getPath().toString());
return name.toString(); return name.toString();

View file

@ -1342,7 +1342,7 @@ public class FindReplaceDialog extends SelectionDialog
return ""; //$NON-NLS-1$ return ""; //$NON-NLS-1$
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
for(int i = 0; i < fBytes.length; i++) for(int i = 0; i < fBytes.length; i++)
buf.append(BigInteger.valueOf(fBytes[i]).toString(16) + " "); //$NON-NLS-1$ buf.append(BigInteger.valueOf(fBytes[i]).toString(16)).append(' ');
return buf.toString(); return buf.toString();
} }