Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2016-04-22 23:00:51 +0000
committerSergey Prigogin2016-04-25 16:38:47 +0000
commit6bdca5f4a2598b1206d51a59b720314a2f7aa3c1 (patch)
tree6c94852b1cf0abc24dcb1af3ef1526e89314bbe2 /dsf/org.eclipse.cdt.tests.dsf
parente21fc12f9052e99dcf545df4a2ae2aba1c90c1cc (diff)
downloadorg.eclipse.cdt-6bdca5f4a2598b1206d51a59b720314a2f7aa3c1.tar.gz
org.eclipse.cdt-6bdca5f4a2598b1206d51a59b720314a2f7aa3c1.tar.xz
org.eclipse.cdt-6bdca5f4a2598b1206d51a59b720314a2f7aa3c1.zip
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>
Diffstat (limited to 'dsf/org.eclipse.cdt.tests.dsf')
-rw-r--r--dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/ViewerUpdatesListener.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/ViewerUpdatesListener.java b/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/ViewerUpdatesListener.java
index cdba4027e3f..176ee096d29 100644
--- a/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/ViewerUpdatesListener.java
+++ b/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/ViewerUpdatesListener.java
@@ -490,19 +490,19 @@ public class ViewerUpdatesListener
}
if (fFailOnMultipleLabelUpdateSequences) {
buf.append("\n\t");
- buf.append("fMultipleLabelUpdateSequencesObserved = " + fMultipleLabelUpdateSequencesObserved);
+ buf.append("fMultipleLabelUpdateSequencesObserved = ").append(fMultipleLabelUpdateSequencesObserved);
}
if (fFailOnMultipleModelUpdateSequences) {
buf.append("\n\t");
- buf.append("fMultipleModelUpdateSequencesObserved = " + fMultipleModelUpdateSequencesObserved);
+ buf.append("fMultipleModelUpdateSequencesObserved = ").append(fMultipleModelUpdateSequencesObserved);
}
if ( (flags & LABEL_SEQUENCE_COMPLETE) != 0) {
buf.append("\n\t");
- buf.append("fLabelSequenceComplete = " + fLabelSequenceComplete);
+ buf.append("fLabelSequenceComplete = ").append(fLabelSequenceComplete);
}
if ( (flags & LABEL_UPDATES_RUNNING) != 0) {
buf.append("\n\t");
- buf.append("fLabelUpdatesRunning = " + fLabelUpdatesCounter);
+ buf.append("fLabelUpdatesRunning = ").append(fLabelUpdatesCounter);
}
if ( (flags & LABEL_SEQUENCE_STARTED) != 0) {
buf.append("\n\t");
@@ -519,11 +519,11 @@ public class ViewerUpdatesListener
}
if ( (flags & CONTENT_SEQUENCE_COMPLETE) != 0) {
buf.append("\n\t");
- buf.append("fContentSequenceComplete = " + fContentSequenceComplete);
+ buf.append("fContentSequenceComplete = ").append(fContentSequenceComplete);
}
if ( (flags & VIEWER_UPDATES_RUNNING) != 0) {
buf.append("\n\t");
- buf.append("fContentUpdatesCounter = " + fContentUpdatesCounter);
+ buf.append("fContentUpdatesCounter = ").append(fContentUpdatesCounter);
}
if ( (flags & HAS_CHILDREN_UPDATES_STARTED) != 0) {
buf.append("\n\t");
@@ -566,26 +566,26 @@ public class ViewerUpdatesListener
}
if ( (flags & MODEL_CHANGED_COMPLETE) != 0) {
buf.append("\n\t");
- buf.append("fModelChangedComplete = " + fModelChangedComplete);
+ buf.append("fModelChangedComplete = ").append(fModelChangedComplete);
}
if ( (flags & STATE_SAVE_COMPLETE) != 0) {
buf.append("\n\t");
- buf.append("fStateSaveComplete = " + fStateSaveComplete);
+ buf.append("fStateSaveComplete = ").append(fStateSaveComplete);
}
if ( (flags & STATE_RESTORE_COMPLETE) != 0) {
buf.append("\n\t");
- buf.append("fStateRestoreComplete = " + fStateRestoreComplete);
+ buf.append("fStateRestoreComplete = ").append(fStateRestoreComplete);
}
// if ( (flags & MODEL_PROXIES_INSTALLED) != 0) {
// buf.append("\n\t");
-// buf.append("fProxyModels = " + fProxyModels);
+// buf.append("fProxyModels = ").append(fProxyModels);
// }
if ( (flags & PROPERTY_UPDATES_STARTED) != 0) {
buf.append("\n\t");
buf.append("fPropertiesUpdatesRunning = ");
buf.append(toStringViewerUpdatesSet(fPropertiesUpdatesRunning));
buf.append("\n\t");
- buf.append("fPropertiesUpdatesCompleted = " + fPropertiesUpdatesCompleted);
+ buf.append("fPropertiesUpdatesCompleted = ").append(fPropertiesUpdatesCompleted);
}
if ( (flags & PROPERTY_UPDATES) != 0) {
buf.append("\n\t");
@@ -594,7 +594,7 @@ public class ViewerUpdatesListener
}
if (fTimeoutInterval > 0) {
buf.append("\n\t");
- buf.append("fTimeoutInterval = " + fTimeoutInterval);
+ buf.append("fTimeoutInterval = ").append(fTimeoutInterval);
}
return buf.toString();
}

Back to the top