Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2017-06-21 03:12:34 -0400
committerLars Vogel2017-06-21 15:38:57 -0400
commita111e3ded59c144bea983a849a1316df021e00b4 (patch)
treeb1217e62986fa8e6a2422e1a7e05c5dd9a127ae5 /org.eclipse.text
parent06ebc289e0676f10d00bf05d1a2ee8020e9eb40f (diff)
downloadeclipse.platform.text-a111e3ded59c144bea983a849a1316df021e00b4.tar.gz
eclipse.platform.text-a111e3ded59c144bea983a849a1316df021e00b4.tar.xz
eclipse.platform.text-a111e3ded59c144bea983a849a1316df021e00b4.zip
Bug 516535 - Replace StringBuffer with StringBuilder in
eclipse.platform.text Change-Id: Ia7089d167c24489674565e8bbb08d33773ac8445 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'org.eclipse.text')
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionTextStore.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/DocumentRewriteSession.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java12
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/SequentialRewriteTextStore.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java2
-rwxr-xr-xorg.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java4
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/InsertEdit.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/MultiTextEdit.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/ReplaceEdit.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java14
-rw-r--r--org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java10
15 files changed, 31 insertions, 31 deletions
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionTextStore.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionTextStore.java
index f593e30b9..1cb922faf 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionTextStore.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionTextStore.java
@@ -128,7 +128,7 @@ class ProjectionTextStore implements ITextStore {
public String get(int offset, int length) {
try {
IRegion[] fragments= fMapping.toExactOriginRegions(new Region(offset, length));
- StringBuffer buffer= new StringBuffer();
+ StringBuilder buffer= new StringBuilder();
for (int i= 0; i < fragments.length; i++) {
IRegion fragment= fragments[i];
buffer.append(fMasterDocument.get(fragment.getOffset(), fragment.getLength()));
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java b/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java
index 57c54aa8d..ab7f5940b 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java
@@ -131,7 +131,7 @@ public class DocumentEvent {
@Override
public String toString() {
- StringBuffer buffer= new StringBuffer();
+ StringBuilder buffer= new StringBuilder();
buffer.append("offset: " ); //$NON-NLS-1$
buffer.append(fOffset);
buffer.append(", length: " ); //$NON-NLS-1$
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/DocumentRewriteSession.java b/org.eclipse.text/src/org/eclipse/jface/text/DocumentRewriteSession.java
index 8787fbe4c..de7776e93 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/DocumentRewriteSession.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/DocumentRewriteSession.java
@@ -43,6 +43,6 @@ public class DocumentRewriteSession {
@Override
public String toString() {
- return new StringBuffer().append(hashCode()).toString();
+ return new StringBuilder().append(hashCode()).toString();
}
}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java b/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
index 101966307..09dca71f0 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
@@ -269,7 +269,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
*/
private String substituteLinebreak(String findString) throws PatternSyntaxException {
int length= findString.length();
- StringBuffer buf= new StringBuffer(length);
+ StringBuilder buf= new StringBuilder(length);
int inCharGroup= 0;
int inBraces= 0;
@@ -347,7 +347,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
* @param ch the character to process
* @since 3.4
*/
- private void interpretRetainCase(StringBuffer buf, char ch) {
+ private void interpretRetainCase(StringBuilder buf, char ch) {
if (fRetainCaseMode == RC_UPPER)
buf.append(String.valueOf(ch).toUpperCase());
else if (fRetainCaseMode == RC_LOWER)
@@ -370,7 +370,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
private String interpretReplaceEscapes(String replaceText, String foundText) {
int length= replaceText.length();
boolean inEscape= false;
- StringBuffer buf= new StringBuffer(length);
+ StringBuilder buf= new StringBuilder(length);
/* every string we did not check looks mixed at first
* so initialize retain case mode with RC_MIXED
@@ -431,7 +431,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
* @return the new offset
* @since 3.4
*/
- private int interpretReplaceEscape(final char ch, int i, StringBuffer buf, String replaceText, String foundText) {
+ private int interpretReplaceEscape(final char ch, int i, StringBuilder buf, String replaceText, String foundText) {
int length= replaceText.length();
switch (ch) {
case 'r':
@@ -561,7 +561,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
* @return the string converted to a regex pattern
*/
private String asRegPattern(String string) {
- StringBuffer out= new StringBuffer(string.length());
+ StringBuilder out= new StringBuilder(string.length());
boolean quoting= false;
for (int i= 0, length= string.length(); i < length; i++) {
@@ -645,7 +645,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
public static String escapeForRegExPattern(String string) {
//implements https://bugs.eclipse.org/bugs/show_bug.cgi?id=44422
- StringBuffer pattern= new StringBuffer(string.length() + 16);
+ StringBuilder pattern= new StringBuilder(string.length() + 16);
int length= string.length();
for (int i= 0; i < length; i++) {
char ch= string.charAt(i);
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java b/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
index 2e886537c..cf3476ffd 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
@@ -156,7 +156,7 @@ public class GapTextStore implements ITextStore {
if (end <= fGapStart)
return new String(fContent, offset, length);
- StringBuffer buf= new StringBuffer(length);
+ StringBuilder buf= new StringBuilder(length); // see Bug 113871
buf.append(fContent, offset, fGapStart - offset);
buf.append(fContent, fGapEnd, end - fGapStart);
return buf.toString();
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/SequentialRewriteTextStore.java b/org.eclipse.text/src/org/eclipse/jface/text/SequentialRewriteTextStore.java
index 17803e649..0433593bb 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/SequentialRewriteTextStore.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/SequentialRewriteTextStore.java
@@ -235,7 +235,7 @@ public class SequentialRewriteTextStore implements ITextStore {
if (fReplaceList.isEmpty())
return;
- StringBuffer buffer= new StringBuffer();
+ StringBuilder buffer= new StringBuilder();
int delta= 0;
for (Replace replace : fReplaceList) {
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java b/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
index 4cc1c9cdf..736dc58b8 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
@@ -194,7 +194,7 @@ public class TextUtilities {
final IDocument document= unprocessedDocument;
int offset= firstEvent.getOffset();
int length= firstEvent.getLength();
- final StringBuffer text= new StringBuffer(firstEvent.getText() == null ? "" : firstEvent.getText()); //$NON-NLS-1$
+ final StringBuilder text= new StringBuilder(firstEvent.getText() == null ? "" : firstEvent.getText()); //$NON-NLS-1$
while (iterator.hasNext()) {
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.java
index 9c2acf1bb..a41a81042 100755
--- a/org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.java
@@ -1231,7 +1231,7 @@ abstract class TreeLineTracker implements ILineTracker {
List<Node> roots= new LinkedList<>();
roots.add(fRoot);
- StringBuffer buf= new StringBuffer((width + 1) * depth);
+ StringBuilder buf= new StringBuilder((width + 1) * depth); // see Bug 137688
int indents= leaves;
char[] space= new char[leaves * WIDTH / 2];
Arrays.fill(space, ' ');
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java
index 853d52c88..1a65ac7ec 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java
@@ -184,7 +184,7 @@ public class TemplateTranslator {
private TemplateBuffer parse(String string) throws TemplateException {
fErrorMessage= null;
- final StringBuffer buffer= new StringBuffer(string.length());
+ final StringBuilder buffer= new StringBuilder(string.length());
final Matcher matcher= ESCAPE_PATTERN.matcher(string);
final Map<String, VariableDescription> variables= new LinkedHashMap<>();
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java b/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java
index 981c94a45..d8488d156 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java
@@ -24,10 +24,10 @@ import org.eclipse.jface.text.Position;
class EditDocument implements IDocument {
- private StringBuffer fBuffer;
+ private StringBuilder fBuffer;
public EditDocument(String content) {
- fBuffer= new StringBuffer(content);
+ fBuffer= new StringBuilder(content);
}
@Override
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/InsertEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/InsertEdit.java
index 5d0a5dd6c..92af15f42 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/InsertEdit.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/InsertEdit.java
@@ -95,7 +95,7 @@ public final class InsertEdit extends TextEdit {
}
@Override
- void internalToString(StringBuffer buffer, int indent) {
+ void internalToString(StringBuilder buffer, int indent) {
super.internalToString(buffer, indent);
buffer.append(" <<").append(fText); //$NON-NLS-1$
}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/MultiTextEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/MultiTextEdit.java
index 9ace8e968..91329a1b1 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/MultiTextEdit.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/MultiTextEdit.java
@@ -209,7 +209,7 @@ public class MultiTextEdit extends TextEdit {
}
@Override
- void internalToString(StringBuffer buffer, int indent) {
+ void internalToString(StringBuilder buffer, int indent) {
super.internalToString(buffer, indent);
if (! fDefined)
buffer.append(" [undefined]"); //$NON-NLS-1$
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/ReplaceEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/ReplaceEdit.java
index bd13a6911..a21324ec6 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/ReplaceEdit.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/ReplaceEdit.java
@@ -96,7 +96,7 @@ public final class ReplaceEdit extends TextEdit {
}
@Override
- void internalToString(StringBuffer buffer, int indent) {
+ void internalToString(StringBuilder buffer, int indent) {
super.internalToString(buffer, indent);
buffer.append(" <<").append(fText); //$NON-NLS-1$
}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java
index 2181283db..79285a365 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java
@@ -514,20 +514,20 @@ public abstract class TextEdit {
@Override
public String toString() {
- StringBuffer buffer= new StringBuffer();
+ StringBuilder buffer= new StringBuilder();
toStringWithChildren(buffer, 0);
return buffer.toString();
}
/**
* Adds the string representation of this text edit without
- * children information to the given string buffer.
+ * children information to the given string builder.
*
- * @param buffer the string buffer
+ * @param buffer the string builder
* @param indent the indent level in number of spaces
* @since 3.3
*/
- void internalToString(StringBuffer buffer, int indent) {
+ void internalToString(StringBuilder buffer, int indent) {
for (int i= indent; i > 0; i--) {
buffer.append(" "); //$NON-NLS-1$
}
@@ -553,13 +553,13 @@ public abstract class TextEdit {
/**
* Adds the string representation for this text edit
- * and its children to the given string buffer.
+ * and its children to the given string builder.
*
- * @param buffer the string buffer
+ * @param buffer the string builder
* @param indent the indent level in number of spaces
* @since 3.3
*/
- private void toStringWithChildren(StringBuffer buffer, int indent) {
+ private void toStringWithChildren(StringBuilder buffer, int indent) {
internalToString(buffer, indent);
if (fChildren != null) {
for (TextEdit child : fChildren) {
diff --git a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java
index a4755de51..8d9c43ace 100644
--- a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java
+++ b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java
@@ -372,7 +372,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
@Override
public String toString() {
String delimiter= ", "; //$NON-NLS-1$
- StringBuffer text= new StringBuffer(super.toString());
+ StringBuilder text= new StringBuilder(super.toString());
text.append("\n"); //$NON-NLS-1$
text.append(this.getClass().getName());
text.append(" undo modification stamp: "); //$NON-NLS-1$
@@ -711,7 +711,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Text buffer to collect viewer content which has been replaced
*/
- private StringBuffer fPreservedTextBuffer;
+ private StringBuilder fPreservedTextBuffer;
/**
* The document modification stamp for undo.
@@ -726,7 +726,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Text buffer to collect text which is inserted into the viewer
*/
- private StringBuffer fTextBuffer;
+ private StringBuilder fTextBuffer;
/** Indicates inserting state. */
private boolean fInserting= false;
@@ -1142,8 +1142,8 @@ public class DocumentUndoManager implements IDocumentUndoManager {
// open up the current text edit
fCurrent= new UndoableTextChange(this);
fPreviousDelete= new UndoableTextChange(this);
- fTextBuffer= new StringBuffer();
- fPreservedTextBuffer= new StringBuffer();
+ fTextBuffer= new StringBuilder();
+ fPreservedTextBuffer= new StringBuilder();
addListeners();
}

Back to the top