1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Use StringBuilder instead of StringBuffer.

This commit is contained in:
Sergey Prigogin 2011-08-08 16:27:41 -07:00
parent 389a1ff92b
commit 13d4a94d42
57 changed files with 203 additions and 207 deletions

View file

@ -10,14 +10,14 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.codan.core.internal.checkers; package org.eclipse.cdt.codan.core.internal.checkers;
import java.io.File;
import java.io.IOException;
import org.eclipse.cdt.codan.core.param.IProblemPreference; import org.eclipse.cdt.codan.core.param.IProblemPreference;
import org.eclipse.cdt.codan.core.test.CheckerTestCase; import org.eclipse.cdt.codan.core.test.CheckerTestCase;
import org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectChecker; import org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectChecker;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import java.io.File;
import java.io.IOException;
/** /**
* Test for {@see StatementHasNoEffectChecker} class * Test for {@see StatementHasNoEffectChecker} class
* *
@ -107,7 +107,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// } // }
/* this test is using two files */ /* this test is using two files */
public void test2FilesUnaryExpression() throws IOException { public void test2FilesUnaryExpression() throws IOException {
StringBuffer[] code = getContents(2); CharSequence[] code = getContents(2);
File f1 = loadcode(code[0].toString()); File f1 = loadcode(code[0].toString());
File f2 = loadcode(code[1].toString()); File f2 = loadcode(code[1].toString());
runOnProject(); runOnProject();

View file

@ -10,9 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.codan.core.test; package org.eclipse.cdt.codan.core.test;
import java.io.IOException;
import java.util.ArrayList;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.eclipse.cdt.codan.core.CodanRuntime; import org.eclipse.cdt.codan.core.CodanRuntime;
@ -45,6 +42,9 @@ import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser; import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import java.io.IOException;
import java.util.ArrayList;
/** /**
* TODO: add description * TODO: add description
*/ */
@ -56,7 +56,7 @@ public abstract class CodanFastCxxAstTestCase extends TestCase {
return getContents(1)[0].toString(); return getContents(1)[0].toString();
} }
protected StringBuffer[] getContents(int sections) { protected StringBuilder[] getContents(int sections) {
try { try {
CodanCoreTestActivator plugin = CodanCoreTestActivator.getDefault(); CodanCoreTestActivator plugin = CodanCoreTestActivator.getDefault();
return TestSourceReader.getContentsForTest(plugin == null ? null : plugin.getBundle(), "src", getClass(), getName(), sections); return TestSourceReader.getContentsForTest(plugin == null ? null : plugin.getBundle(), "src", getClass(), getName(), sections);
@ -69,6 +69,7 @@ public abstract class CodanFastCxxAstTestCase extends TestCase {
public boolean isCpp() { public boolean isCpp() {
return false; return false;
} }
private static final NullLogService NULL_LOG = new NullLogService(); private static final NullLogService NULL_LOG = new NullLogService();
/** /**

View file

@ -10,12 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.codan.core.test; package org.eclipse.cdt.codan.core.test;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager; import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
@ -36,6 +30,12 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Plugin;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
/** /**
* TODO: add description * TODO: add description
*/ */
@ -170,9 +170,10 @@ public class CodanTestCase extends BaseTestCase {
return getContents(1)[0].toString(); return getContents(1)[0].toString();
} }
protected StringBuffer[] getContents(int sections) { protected StringBuilder[] getContents(int sections) {
try { try {
return TestSourceReader.getContentsForTest(getPlugin().getBundle(), getSourcePrefix(), getClass(), getName(), sections); return TestSourceReader.getContentsForTest(getPlugin().getBundle(), getSourcePrefix(),
getClass(), getName(), sections);
} catch (IOException e) { } catch (IOException e) {
fail(e.getMessage()); fail(e.getMessage());
return null; return null;

View file

@ -10,16 +10,16 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers.ui.quickfix; package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.eclipse.cdt.codan.core.test.TestUtils; import org.eclipse.cdt.codan.core.test.TestUtils;
import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution; import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
import org.eclipse.cdt.internal.ui.util.EditorUtility; import org.eclipse.cdt.internal.ui.util.EditorUtility;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
/** /**
* Test for quick fix for suggested parenthesis * Test for quick fix for suggested parenthesis
*/ */
@ -53,7 +53,7 @@ public class SuggestedParenthesisQuickFixTest extends QuickFixTestCase {
* quick fix is not called * quick fix is not called
*/ */
public void test2FilesExample() throws FileNotFoundException, IOException { public void test2FilesExample() throws FileNotFoundException, IOException {
StringBuffer[] code = getContents(2); CharSequence[] code = getContents(2);
File f1 = loadcode(code[0].toString()); File f1 = loadcode(code[0].toString());
File f2 = loadcode(code[1].toString()); File f2 = loadcode(code[1].toString());
// lets pretend marker is found in main.c but fixes go in both files, // lets pretend marker is found in main.c but fixes go in both files,

View file

@ -473,7 +473,7 @@ public class AST2BaseTest extends BaseTestCase {
return getContents(1)[0].toString(); return getContents(1)[0].toString();
} }
protected StringBuffer[] getContents(int sections) throws IOException { protected CharSequence[] getContents(int sections) throws IOException {
CTestPlugin plugin = CTestPlugin.getDefault(); CTestPlugin plugin = CTestPlugin.getDefault();
if (plugin == null) if (plugin == null)
throw new AssertionFailedError("This test must be run as a JUnit plugin test"); throw new AssertionFailedError("This test must be run as a JUnit plugin test");

View file

@ -8060,7 +8060,7 @@ public class AST2CPPTests extends AST2BaseTest {
// } // }
public void testInitOfClassObjectsByRValues_294730() throws Exception { public void testInitOfClassObjectsByRValues_294730() throws Exception {
final StringBuffer[] contents = getContents(3); final CharSequence[] contents = getContents(3);
final String code= contents[0].toString(); final String code= contents[0].toString();
final String end= contents[2].toString(); final String end= contents[2].toString();
parseAndCheckBindings(code + end, ParserLanguage.CPP); parseAndCheckBindings(code + end, ParserLanguage.CPP);

View file

@ -145,7 +145,7 @@ public class AST2FileBasePluginTest extends TestCase {
return file; return file;
} }
protected StringBuffer[] getContents(int sections) throws IOException { protected StringBuilder[] getContents(int sections) throws IOException {
return TestSourceReader.getContentsForTest( return TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections); CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
} }

View file

@ -4039,7 +4039,7 @@ public class AST2Tests extends AST2BaseTest {
// ASSERT(false);// fine // ASSERT(false);// fine
// } // }
public void testBug188855_gccExtensionForVariadicMacros() throws Exception { public void testBug188855_gccExtensionForVariadicMacros() throws Exception {
StringBuffer[] buffer = getContents(2); CharSequence[] buffer = getContents(2);
final String content1 = buffer[0].toString(); final String content1 = buffer[0].toString();
final String content2 = buffer[1].toString(); final String content2 = buffer[1].toString();
parse(content1, ParserLanguage.CPP); parse(content1, ParserLanguage.CPP);
@ -4843,7 +4843,7 @@ public class AST2Tests extends AST2BaseTest {
// return 0; // return 0;
// } // }
public void testBug228422_noKnrParam() throws Exception { public void testBug228422_noKnrParam() throws Exception {
StringBuffer buffer = getContents(1)[0]; CharSequence buffer = getContents(1)[0];
parse(buffer.toString(), ParserLanguage.C, false); parse(buffer.toString(), ParserLanguage.C, false);
} }
@ -5262,7 +5262,7 @@ public class AST2Tests extends AST2BaseTest {
// (typeof a)(t)-a // typeof a,t,a,unary-,cast,cast // (typeof a)(t)-a // typeof a,t,a,unary-,cast,cast
// (typeof a)(a)-a // typeof a,a,cast,a,- // (typeof a)(a)-a // typeof a,a,cast,a,-
public void testBinaryVsCastAmbiguities_Bug237057() throws Exception { public void testBinaryVsCastAmbiguities_Bug237057() throws Exception {
StringBuffer[] input= getContents(2); CharSequence[] input= getContents(2);
String code= input[0].toString(); String code= input[0].toString();
String[] samples= input[1].toString().split("\n"); String[] samples= input[1].toString().split("\n");
for (ParserLanguage lang : ParserLanguage.values()) { for (ParserLanguage lang : ParserLanguage.values()) {
@ -5302,7 +5302,7 @@ public class AST2Tests extends AST2BaseTest {
// (f)(a)+1 // f,a,(),1,+ // (f)(a)+1 // f,a,(),1,+
// (t)(t)+1 // t,t,1,unary+,cast,cast // (t)(t)+1 // t,t,1,unary+,cast,cast
public void testCastVsFunctionCallAmbiguities_Bug237057() throws Exception { public void testCastVsFunctionCallAmbiguities_Bug237057() throws Exception {
StringBuffer[] input= getContents(2); CharSequence[] input= getContents(2);
String code= input[0].toString(); String code= input[0].toString();
String[] samples= input[1].toString().split("\n"); String[] samples= input[1].toString().split("\n");
for (ParserLanguage lang : ParserLanguage.values()) { for (ParserLanguage lang : ParserLanguage.values()) {
@ -5327,7 +5327,7 @@ public class AST2Tests extends AST2BaseTest {
// 0, a= 1 ? 2,3 : b= 4, 5 // 0,a,1,2,3,,,b,4,=,?,=,5,, // 0, a= 1 ? 2,3 : b= 4, 5 // 0,a,1,2,3,,,b,4,=,?,=,5,,
// 1 ? 2 ? 3 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,? // 1 ? 2 ? 3 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,?
public void testBinaryExpressionBinding() throws Exception { public void testBinaryExpressionBinding() throws Exception {
StringBuffer[] input= getContents(2); CharSequence[] input= getContents(2);
String code= input[0].toString(); String code= input[0].toString();
String[] samples= input[1].toString().split("\n"); String[] samples= input[1].toString().split("\n");
for (ParserLanguage lang : ParserLanguage.values()) { for (ParserLanguage lang : ParserLanguage.values()) {
@ -5352,7 +5352,7 @@ public class AST2Tests extends AST2BaseTest {
// 1 ? 2,3 : b= 4 // 1,2,3,,,b,4,=,? // 1 ? 2,3 : b= 4 // 1,2,3,,,b,4,=,?
// 1 ? 2 ? 3 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,? // 1 ? 2 ? 3 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,?
public void testConstantExpressionBinding() throws Exception { public void testConstantExpressionBinding() throws Exception {
StringBuffer[] input= getContents(2); CharSequence[] input= getContents(2);
String code= input[0].toString(); String code= input[0].toString();
String[] samples= input[1].toString().split("\n"); String[] samples= input[1].toString().split("\n");
for (ParserLanguage lang : ParserLanguage.values()) { for (ParserLanguage lang : ParserLanguage.values()) {
@ -5859,7 +5859,7 @@ public class AST2Tests extends AST2BaseTest {
public void testScalabilityOfLargeTrivialInitializer_Bug253690() throws Exception { public void testScalabilityOfLargeTrivialInitializer_Bug253690() throws Exception {
sValidateCopy= false; sValidateCopy= false;
final int AMOUNT= 250000; final int AMOUNT= 250000;
final StringBuffer[] input = getContents(3); final CharSequence[] input = getContents(3);
StringBuilder buf= new StringBuilder(); StringBuilder buf= new StringBuilder();
buf.append(input[0].toString()); buf.append(input[0].toString());
final String line= input[1].toString(); final String line= input[1].toString();
@ -5892,7 +5892,7 @@ public class AST2Tests extends AST2BaseTest {
public void testLargeTrivialAggregateInitializer_Bug253690() throws Exception { public void testLargeTrivialAggregateInitializer_Bug253690() throws Exception {
sValidateCopy= false; sValidateCopy= false;
final int AMOUNT= 250000; final int AMOUNT= 250000;
final StringBuffer[] input = getContents(3); final CharSequence[] input = getContents(3);
StringBuilder buf= new StringBuilder(); StringBuilder buf= new StringBuilder();
buf.append(input[0].toString()); buf.append(input[0].toString());
final String line= input[1].toString(); final String line= input[1].toString();

View file

@ -201,7 +201,7 @@ public class CommentTests extends AST2BaseTest {
// // comment2 // // comment2
// #endif // #endif
public void testCommentsInInactiveCode_bug183930() throws Exception { public void testCommentsInInactiveCode_bug183930() throws Exception {
StringBuffer code= getContents(1)[0]; CharSequence code= getContents(1)[0];
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, true); IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, true);
IASTComment[] comments = tu.getComments(); IASTComment[] comments = tu.getComments();
@ -212,7 +212,7 @@ public class CommentTests extends AST2BaseTest {
// //comment // //comment
public void testCommentLocation_bug186337() throws Exception{ public void testCommentLocation_bug186337() throws Exception{
StringBuffer code= getContents(1)[0]; CharSequence code= getContents(1)[0];
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, true); IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, true);
IASTComment[] comments = tu.getComments(); IASTComment[] comments = tu.getComments();
@ -236,7 +236,7 @@ public class CommentTests extends AST2BaseTest {
// // TODO: shows up in task list // // TODO: shows up in task list
public void testCommentInDirectives_bug192546() throws Exception { public void testCommentInDirectives_bug192546() throws Exception {
StringBuffer code= getContents(1)[0]; CharSequence code= getContents(1)[0];
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, false); IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, false);
IASTComment[] comments = tu.getComments(); IASTComment[] comments = tu.getComments();
@ -246,7 +246,7 @@ public class CommentTests extends AST2BaseTest {
for (IASTComment comment : comments) { for (IASTComment comment : comments) {
IASTFileLocation loc= comment.getFileLocation(); IASTFileLocation loc= comment.getFileLocation();
int idx= loc.getNodeOffset() + comment.getRawSignature().indexOf("TODO"); int idx= loc.getNodeOffset() + comment.getRawSignature().indexOf("TODO");
assertEquals("TODO", code.substring(idx, idx+4)); assertEquals("TODO", code.subSequence(idx, idx + 4));
} }
} }
} }

View file

@ -190,7 +190,7 @@ public class DOMPreprocessorInformationTest extends AST2BaseTest {
// #elif // #elif
// #endif // #endif
public void testElifWithoutCondition_bug185324() throws Exception { public void testElifWithoutCondition_bug185324() throws Exception {
StringBuffer code= getContents(1)[0]; CharSequence code= getContents(1)[0];
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, false); IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, false);
IASTPreprocessorStatement[] st = tu.getAllPreprocessorStatements(); IASTPreprocessorStatement[] st = tu.getAllPreprocessorStatements();
assertEquals(3, st.length); assertEquals(3, st.length);

View file

@ -132,7 +132,7 @@ public class CompletionTestBase extends BaseTestCase {
return getContents(1)[0].toString(); return getContents(1)[0].toString();
} }
protected StringBuffer[] getContents(int sections) throws IOException { protected StringBuilder[] getContents(int sections) throws IOException {
CTestPlugin plugin = CTestPlugin.getDefault(); CTestPlugin plugin = CTestPlugin.getDefault();
if (plugin == null) if (plugin == null)
throw new AssertionFailedError("This test must be run as a JUnit plugin test"); throw new AssertionFailedError("This test must be run as a JUnit plugin test");

View file

@ -36,11 +36,11 @@ public class ExpansionExplorerTests extends BaseTestCase {
} }
private void performTest(int steps) throws Exception { private void performTest(int steps) throws Exception {
StringBuffer[] bufs= TestSourceReader.getContentsForTest( CharSequence[] bufs= TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), steps+2); CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), steps+2);
String[] input= new String[steps+2]; String[] input= new String[steps+2];
int i= -1; int i= -1;
for (StringBuffer buf : bufs) { for (CharSequence buf : bufs) {
input[++i]= buf.toString().trim(); input[++i]= buf.toString().trim();
} }
final MacroExpander expander= createExpander(input[0]); final MacroExpander expander= createExpander(input[0]);

View file

@ -113,7 +113,7 @@ public class LocationMapTests extends BaseTestCase {
super.tearDown(); super.tearDown();
} }
protected StringBuffer[] getContents(int sections) throws IOException { protected StringBuilder[] getContents(int sections) throws IOException {
return TestSourceReader.getContentsForTest( return TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections); CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
} }

View file

@ -95,10 +95,9 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
initializeScanner(getAboveComment()); initializeScanner(getAboveComment());
} }
protected StringBuffer[] getTestContent(int sections) throws IOException { protected StringBuilder[] getTestContent(int sections) throws IOException {
StringBuffer[] input= TestSourceReader.getContentsForTest( return TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections); CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
return input;
} }
protected String getAboveComment() throws IOException { protected String getAboveComment() throws IOException {
@ -110,8 +109,7 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
for(;;) { for(;;) {
IToken t= fScanner.nextToken(); IToken t= fScanner.nextToken();
} }
} } catch ( EndOfFileException e){
catch ( EndOfFileException e){
} }
} }

View file

@ -211,7 +211,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
void setUp() throws Exception; void setUp() throws Exception;
void tearDown() throws Exception; void tearDown() throws Exception;
public IASTTranslationUnit getAst(); public IASTTranslationUnit getAst();
public StringBuffer[] getTestData(); public StringBuilder[] getTestData();
public ICProject getCProject(); public ICProject getCProject();
public boolean isCompositeIndex(); public boolean isCompositeIndex();
} }
@ -242,7 +242,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
class SinglePDOMTestFirstASTStrategy implements ITestStrategy { class SinglePDOMTestFirstASTStrategy implements ITestStrategy {
private IIndex index; private IIndex index;
private ICProject cproject; private ICProject cproject;
private StringBuffer[] testData; private StringBuilder[] testData;
private IASTTranslationUnit ast; private IASTTranslationUnit ast;
private boolean cpp; private boolean cpp;
@ -254,7 +254,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
return cproject; return cproject;
} }
public StringBuffer[] getTestData() { public StringBuilder[] getTestData() {
return testData; return testData;
} }
@ -308,7 +308,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
class SinglePDOMTestStrategy implements ITestStrategy { class SinglePDOMTestStrategy implements ITestStrategy {
private IIndex index; private IIndex index;
private ICProject cproject; private ICProject cproject;
private StringBuffer[] testData; private StringBuilder[] testData;
private IASTTranslationUnit ast; private IASTTranslationUnit ast;
private boolean cpp; private boolean cpp;
@ -320,7 +320,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
return cproject; return cproject;
} }
public StringBuffer[] getTestData() { public StringBuilder[] getTestData() {
return testData; return testData;
} }
@ -373,7 +373,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
class ReferencedProject implements ITestStrategy { class ReferencedProject implements ITestStrategy {
private IIndex index; private IIndex index;
private ICProject cproject, referenced; private ICProject cproject, referenced;
private StringBuffer[] testData; private StringBuilder[] testData;
private IASTTranslationUnit ast; private IASTTranslationUnit ast;
private boolean cpp; private boolean cpp;
@ -453,7 +453,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
return index; return index;
} }
public StringBuffer[] getTestData() { public StringBuilder[] getTestData() {
return testData; return testData;
} }

View file

@ -275,11 +275,11 @@ public class IndexBugsTests extends BaseTestCase {
} }
protected String[] getContentsForTest(int blocks) throws IOException { protected String[] getContentsForTest(int blocks) throws IOException {
StringBuffer[] help= TestSourceReader.getContentsForTest( CharSequence[] help= TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks); CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
String[] result= new String[help.length]; String[] result= new String[help.length];
int i= 0; int i= 0;
for (StringBuffer buf : help) { for (CharSequence buf : help) {
result[i++]= buf.toString(); result[i++]= buf.toString();
} }
return result; return result;

View file

@ -63,7 +63,7 @@ public class IndexCompositeTests extends BaseTestCase {
IIndex index; IIndex index;
protected StringBuffer[] getContentsForTest(int blocks) throws IOException { protected StringBuilder[] getContentsForTest(int blocks) throws IOException {
return TestSourceReader.getContentsForTest( return TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks); CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
} }
@ -72,7 +72,7 @@ public class IndexCompositeTests extends BaseTestCase {
// class B {}; // class B {};
public void testPairDisjointContent() throws Exception { public void testPairDisjointContent() throws Exception {
StringBuffer[] contents = getContentsForTest(2); CharSequence[] contents = getContentsForTest(2);
List projects = new ArrayList(); List projects = new ArrayList();
try { try {
@ -117,7 +117,7 @@ public class IndexCompositeTests extends BaseTestCase {
// void foo(X::B2 c) {} // void foo(X::B2 c) {}
// namespace X { class A2 {}; B2 b; C2 c; } // namespace X { class A2 {}; B2 b; C2 c; }
public void testTripleLinear() throws Exception { public void testTripleLinear() throws Exception {
StringBuffer[] contents = getContentsForTest(3); CharSequence[] contents = getContentsForTest(3);
List projects = new ArrayList(); List projects = new ArrayList();
try { try {
@ -224,7 +224,7 @@ public class IndexCompositeTests extends BaseTestCase {
// namespace X { class A2 {}; } // namespace X { class A2 {}; }
// B1 ab; // B1 ab;
public void testTripleUpwardV() throws Exception { public void testTripleUpwardV() throws Exception {
StringBuffer[] contents = getContentsForTest(3); CharSequence[] contents = getContentsForTest(3);
List projects = new ArrayList(); List projects = new ArrayList();
@ -313,7 +313,7 @@ public class IndexCompositeTests extends BaseTestCase {
// void foo(A1 a, A1 b) {} // void foo(A1 a, A1 b) {}
// namespace X { class A2 {}; } // namespace X { class A2 {}; }
public void testTripleDownwardV() throws Exception { public void testTripleDownwardV() throws Exception {
StringBuffer[] contents = getContentsForTest(3); CharSequence[] contents = getContentsForTest(3);
List projects = new ArrayList(); List projects = new ArrayList();
try { try {
@ -450,7 +450,7 @@ class ProjectBuilder {
return this; return this;
} }
ProjectBuilder addFile(String relativePath, StringBuffer content) { ProjectBuilder addFile(String relativePath, CharSequence content) {
path2content.put(relativePath, content.toString()); path2content.put(relativePath, content.toString());
return this; return this;
} }

View file

@ -285,7 +285,7 @@ public class IndexIncludeTest extends IndexTestBase {
// #include "header1.h" // #include "header1.h"
// #include "header2.h" // #include "header2.h"
public void testParsingInContext_bug220358() throws Exception { public void testParsingInContext_bug220358() throws Exception {
StringBuffer[] sources= getContentsForTest(4); CharSequence[] sources= getContentsForTest(4);
IFile h1= TestSourceReader.createFile(fProject.getProject(), "header1.h", sources[0].toString()); IFile h1= TestSourceReader.createFile(fProject.getProject(), "header1.h", sources[0].toString());
IFile h2= TestSourceReader.createFile(fProject.getProject(), "header2.h", sources[1].toString()); IFile h2= TestSourceReader.createFile(fProject.getProject(), "header2.h", sources[1].toString());
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s1.cpp", sources[3].toString()); IFile s1= TestSourceReader.createFile(fProject.getProject(), "s1.cpp", sources[3].toString());
@ -405,7 +405,7 @@ public class IndexIncludeTest extends IndexTestBase {
public void testUpdateIncludes() throws Exception { public void testUpdateIncludes() throws Exception {
waitForIndexer(); waitForIndexer();
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()}; TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
StringBuffer[] source= getContentsForTest(4); CharSequence[] source= getContentsForTest(4);
IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070427.h", ""); IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070427.h", "");
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s20070427.cpp", IFile s1= TestSourceReader.createFile(fProject.getProject(), "s20070427.cpp",
source[0].toString() + "\nint a20070427;"); source[0].toString() + "\nint a20070427;");

View file

@ -90,7 +90,7 @@ public class IndexLocationTest extends BaseTestCase {
try { try {
Bundle b = CTestPlugin.getDefault().getBundle(); Bundle b = CTestPlugin.getDefault().getBundle();
StringBuffer[] testData = TestSourceReader.getContentsForTest(b, "parser", getClass(), getName(), 3); CharSequence[] testData = TestSourceReader.getContentsForTest(b, "parser", getClass(), getName(), 3);
IFile file1 = TestSourceReader.createFile(cproject.getProject(), "header.h", testData[0].toString()); IFile file1 = TestSourceReader.createFile(cproject.getProject(), "header.h", testData[0].toString());
createExternalFile(externalHeader, testData[1].toString()); createExternalFile(externalHeader, testData[1].toString());

View file

@ -59,7 +59,7 @@ public class IndexTestBase extends BaseTestCase {
return TestSourceReader.readTaggedComment(CTestPlugin.getDefault().getBundle(), "parser", getClass(), tag); return TestSourceReader.readTaggedComment(CTestPlugin.getDefault().getBundle(), "parser", getClass(), tag);
} }
protected StringBuffer[] getContentsForTest(int blocks) throws IOException { protected StringBuilder[] getContentsForTest(int blocks) throws IOException {
return TestSourceReader.getContentsForTest( return TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks); CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
} }

View file

@ -85,7 +85,7 @@ public class IndexUpdateTests extends IndexTestBase {
private ICProject fCppProject= null; private ICProject fCppProject= null;
private ICProject fCProject= null; private ICProject fCProject= null;
private IIndex fIndex= null; private IIndex fIndex= null;
private StringBuffer[] fContents; private CharSequence[] fContents;
private IFile fFile; private IFile fFile;
private IFile fHeader; private IFile fHeader;
private int fContentUsed; private int fContentUsed;

View file

@ -59,9 +59,9 @@ public class CPPClassTemplateTests extends PDOMTestBase {
} }
protected void setUpSections(int sections) throws Exception { protected void setUpSections(int sections) throws Exception {
StringBuffer[] contents= TestSourceReader.getContentsForTest( CharSequence[] contents= TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections); CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
for (StringBuffer content : contents) { for (CharSequence content : contents) {
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), content.toString()); IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), content.toString());
} }
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER); IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);

View file

@ -43,9 +43,9 @@ public class CPPFunctionTemplateTests extends PDOMTestBase {
} }
protected void setUpSections(int sections) throws Exception { protected void setUpSections(int sections) throws Exception {
StringBuffer[] contents= TestSourceReader.getContentsForTest( StringBuilder[] contents= TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections); CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
for (StringBuffer content : contents) { for (StringBuilder content : contents) {
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), content.toString()); IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), content.toString());
} }
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER); IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);

View file

@ -53,7 +53,8 @@ public class PDOMCBugsTest extends BaseTestCase {
protected void setUp() throws Exception { protected void setUp() throws Exception {
cproject= CProjectHelper.createCProject("PDOMCBugsTest"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER); cproject= CProjectHelper.createCProject("PDOMCBugsTest"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
Bundle b = CTestPlugin.getDefault().getBundle(); Bundle b = CTestPlugin.getDefault().getBundle();
StringBuffer[] testData = TestSourceReader.getContentsForTest(b, "parser", PDOMCBugsTest.this.getClass(), getName(), 1); CharSequence[] testData = TestSourceReader.getContentsForTest(b, "parser",
PDOMCBugsTest.this.getClass(), getName(), 1);
IFile file = TestSourceReader.createFile(cproject.getProject(), new Path("header.h"), testData[0].toString()); IFile file = TestSourceReader.createFile(cproject.getProject(), new Path("header.h"), testData[0].toString());
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER); CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);

View file

@ -44,7 +44,7 @@ public class PDOMLocationTests extends BaseTestCase {
cproject= CProjectHelper.createCCProject("PDOMLocationTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER); cproject= CProjectHelper.createCCProject("PDOMLocationTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
Bundle b = CTestPlugin.getDefault().getBundle(); Bundle b = CTestPlugin.getDefault().getBundle();
StringBuffer[] testData = TestSourceReader.getContentsForTest(b, "parser", getClass(), getName(), 3); CharSequence[] testData = TestSourceReader.getContentsForTest(b, "parser", getClass(), getName(), 3);
super.setUp(); super.setUp();
} }

View file

@ -28,7 +28,7 @@ import org.eclipse.core.runtime.CoreException;
* a lo-fidelity debugging tool) * a lo-fidelity debugging tool)
*/ */
public class PDOMPrettyPrinter implements IPDOMVisitor { public class PDOMPrettyPrinter implements IPDOMVisitor {
StringBuffer indent = new StringBuffer(); StringBuilder indent = new StringBuilder();
final String step = " "; //$NON-NLS-1$ final String step = " "; //$NON-NLS-1$
public void leave(IPDOMNode node) throws CoreException { public void leave(IPDOMNode node) throws CoreException {

View file

@ -57,18 +57,19 @@ import org.osgi.framework.Bundle;
public class TestSourceReader { public class TestSourceReader {
/** /**
* Returns an array of StringBuffer objects for each comment section found preceding the named * Returns an array of StringBuilder objects for each comment section found preceding the named
* test in the source code. * test in the source code.
* @param bundle the bundle containing the source, if null can try to load using classpath (source folder has to be in the classpath for this to work) * @param bundle the bundle containing the source, if null can try to load using classpath
* (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages * @param srcRoot the directory inside the bundle containing the packages
* @param clazz the name of the class containing the test * @param clazz the name of the class containing the test
* @param testName the name of the test * @param testName the name of the test
* @param sections the number of comment sections preceding the named test to return * @param sections the number of comment sections preceding the named test to return
* @return an array of StringBuffer objects for each comment section found preceding the named * @return an array of StringBuilder objects for each comment section found preceding the named
* test in the source code. * test in the source code.
* @throws IOException * @throws IOException
*/ */
public static StringBuffer[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz, final String testName, int sections) throws IOException { public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz, final String testName, int sections) throws IOException {
String fqn = clazz.getName().replace('.', '/'); String fqn = clazz.getName().replace('.', '/');
fqn = fqn.indexOf("$")==-1 ? fqn : fqn.substring(0,fqn.indexOf("$")); fqn = fqn.indexOf("$")==-1 ? fqn : fqn.substring(0,fqn.indexOf("$"));
String classFile = fqn + ".java"; String classFile = fqn + ".java";
@ -91,7 +92,7 @@ public class TestSourceReader {
BufferedReader br = new BufferedReader(new InputStreamReader(in)); BufferedReader br = new BufferedReader(new InputStreamReader(in));
List contents = new ArrayList(); List contents = new ArrayList();
StringBuffer content = new StringBuffer(); StringBuilder content = new StringBuilder();
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("//")) {
@ -101,11 +102,11 @@ public class TestSourceReader {
contents.add(content); contents.add(content);
if(contents.size()==sections+1) if(contents.size()==sections+1)
contents.remove(0); contents.remove(0);
content = new StringBuffer(); content = new StringBuilder();
} }
int idx= line.indexOf(testName); int idx= line.indexOf(testName);
if( idx != -1 && !Character.isJavaIdentifierPart(line.charAt(idx+testName.length()))) { if( idx != -1 && !Character.isJavaIdentifierPart(line.charAt(idx+testName.length()))) {
return (StringBuffer[]) contents.toArray(new StringBuffer[contents.size()]); return (StringBuilder[]) contents.toArray(new StringBuilder[contents.size()]);
} }
} }
} }
@ -132,7 +133,7 @@ public class TestSourceReader {
try { try {
int c= 0; int c= 0;
int offset= 0; int offset= 0;
StringBuffer buf= new StringBuffer(); StringBuilder buf= new StringBuilder();
while ((c = reader.read()) >= 0) { while ((c = reader.read()) >= 0) {
buf.append((char) c); buf.append((char) c);
if (c == '\n') { if (c == '\n') {
@ -182,7 +183,7 @@ public class TestSourceReader {
InputStream in= FileLocator.openStream(bundle, filePath, false); InputStream in= FileLocator.openStream(bundle, filePath, false);
LineNumberReader reader= new LineNumberReader(new InputStreamReader(in)); LineNumberReader reader= new LineNumberReader(new InputStreamReader(in));
boolean found= false; boolean found= false;
final StringBuffer content= new StringBuffer(); final StringBuilder content= new StringBuilder();
try { try {
String line= reader.readLine(); String line= reader.readLine();
while (line != null) { while (line != null) {
@ -222,7 +223,6 @@ public class TestSourceReader {
* @param contents the content for the file * @param contents the content for the file
* @return a file object. * @return a file object.
* @throws CoreException * @throws CoreException
* @throws Exception
* @since 4.0 * @since 4.0
*/ */
public static IFile createFile(final IContainer container, final IPath filePath, final String contents) throws CoreException { public static IFile createFile(final IContainer container, final IPath filePath, final String contents) throws CoreException {
@ -264,10 +264,7 @@ public class TestSourceReader {
* @param container a container to create the file in * @param container a container to create the file in
* @param filePath the path relative to the container to create the file at * @param filePath the path relative to the container to create the file at
* @param contents the content for the file * @param contents the content for the file
* @return
* @return a file object. * @return a file object.
* @throws Exception
* @throws Exception
* @since 4.0 * @since 4.0
*/ */
public static IFile createFile(IContainer container, String filePath, String contents) throws CoreException { public static IFile createFile(IContainer container, String filePath, String contents) throws CoreException {

View file

@ -26,7 +26,6 @@ import org.eclipse.core.runtime.CoreException;
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public class LongString implements IString { public class LongString implements IString {
private final Database db; private final Database db;
private final long record; private final long record;
private int hash; private int hash;
@ -370,7 +369,7 @@ public class LongString implements IString {
public String getString() throws CoreException { public String getString() throws CoreException {
int length = db.getInt(record + LENGTH); int length = db.getInt(record + LENGTH);
final StringBuffer buffer = new StringBuffer(length); final StringBuilder buffer = new StringBuilder(length);
readChars(length, new IReader() { readChars(length, new IReader() {
public void appendChar(char c) { public void appendChar(char c) {
buffer.append(c); buffer.append(c);

View file

@ -21,7 +21,6 @@ import org.eclipse.core.runtime.CoreException;
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public class ShortString implements IString { public class ShortString implements IString {
private final Database db; private final Database db;
private final long record; private final long record;
private int hash; private int hash;

View file

@ -101,8 +101,9 @@ public class BaseUITestCase extends BaseTestCase {
* Reads multiple sections in comments from the source of the given class. * Reads multiple sections in comments from the source of the given class.
* @since 4.0 * @since 4.0
*/ */
public StringBuffer[] getContentsForTest(int sections) throws IOException { public StringBuilder[] getContentsForTest(int sections) throws IOException {
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", getClass(), getName(), sections); return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui",
getClass(), getName(), sections);
} }
public String getAboveComment() throws IOException { public String getAboveComment() throws IOException {

View file

@ -551,7 +551,7 @@ public class BasicCallHierarchyTest extends CallHierarchyBaseTest {
// sf(); // sf();
// } // }
public void testStaticFunctionsC() throws Exception { public void testStaticFunctionsC() throws Exception {
StringBuffer[] sbs= getContentsForTest(2); StringBuilder[] sbs= getContentsForTest(2);
String content2= sbs[0].toString(); String content2= sbs[0].toString();
String content1= content2 + sbs[1].toString(); String content1= content2 + sbs[1].toString();
IFile file1= createFile(getProject(), "staticFunc1.c", content1); IFile file1= createFile(getProject(), "staticFunc1.c", content1);
@ -620,7 +620,7 @@ public class BasicCallHierarchyTest extends CallHierarchyBaseTest {
// sf(); // sf();
// } // }
public void testStaticFunctionsCpp() throws Exception { public void testStaticFunctionsCpp() throws Exception {
StringBuffer[] sbs= getContentsForTest(2); StringBuilder[] sbs= getContentsForTest(2);
String content2= sbs[0].toString(); String content2= sbs[0].toString();
String content1= content2 + sbs[1].toString(); String content1= content2 + sbs[1].toString();
IFile file1= createFile(getProject(), "staticFunc1.cpp", content1); IFile file1= createFile(getProject(), "staticFunc1.cpp", content1);

View file

@ -82,7 +82,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
// n->inline_method(); // r3 // n->inline_method(); // r3
// } // }
public void testMethods() throws Exception { public void testMethods() throws Exception {
StringBuffer[] content= getContentsForTest(2); StringBuilder[] content= getContentsForTest(2);
String header= content[0].toString(); String header= content[0].toString();
String source = content[1].toString(); String source = content[1].toString();
IFile headerFile= createFile(fCProject.getProject(), "testMethods.h", header); IFile headerFile= createFile(fCProject.getProject(), "testMethods.h", header);
@ -155,7 +155,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
// method3(); // method3();
// } // }
public void testMethodsInMultipleFiles() throws Exception { public void testMethodsInMultipleFiles() throws Exception {
StringBuffer[] content= getContentsForTest(3); StringBuilder[] content= getContentsForTest(3);
String header= content[0].toString(); String header= content[0].toString();
String source1 = content[1].toString(); String source1 = content[1].toString();
String source2 = content[2].toString(); String source2 = content[2].toString();
@ -205,7 +205,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
// method3(); // method3();
// } // }
public void testMultipleImplsForMethod() throws Exception { public void testMultipleImplsForMethod() throws Exception {
StringBuffer[] content= getContentsForTest(3); StringBuilder[] content= getContentsForTest(3);
String header= content[0].toString(); String header= content[0].toString();
String source1 = content[1].toString(); String source1 = content[1].toString();
String source2 = content[2].toString(); String source2 = content[2].toString();
@ -266,7 +266,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
// mc.method1(); // mc.method1();
// } // }
public void testReverseMultipleImplsForMethod() throws Exception { public void testReverseMultipleImplsForMethod() throws Exception {
StringBuffer[] content= getContentsForTest(3); StringBuilder[] content= getContentsForTest(3);
String header= content[0].toString(); String header= content[0].toString();
String source1 = content[1].toString(); String source1 = content[1].toString();
String source2 = content[2].toString(); String source2 = content[2].toString();

View file

@ -54,7 +54,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
// field= 1; // field= 1;
// } // }
public void testCallHierarchyFromOutlineView_183941() throws Exception { public void testCallHierarchyFromOutlineView_183941() throws Exception {
StringBuffer[] contents = getContentsForTest(2); StringBuilder[] contents = getContentsForTest(2);
IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString()); IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString());
IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString()); IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString());
waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME); waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
@ -95,7 +95,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
// ref2= 0; // ref2= 0;
// } // }
public void testCallHierarchyFromOutlineViewAmbiguous_183941() throws Exception { public void testCallHierarchyFromOutlineViewAmbiguous_183941() throws Exception {
StringBuffer[] contents = getContentsForTest(2); StringBuilder[] contents = getContentsForTest(2);
IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString()); IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString());
IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString()); IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString());
waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME); waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
@ -363,7 +363,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
// shared_func(); // shared_func();
// } // }
public void testMultiLanguageWithPrototype_260262() throws Exception { public void testMultiLanguageWithPrototype_260262() throws Exception {
final StringBuffer[] contents = getContentsForTest(3); final StringBuilder[] contents = getContentsForTest(3);
final String hcontent = contents[0].toString(); final String hcontent = contents[0].toString();
final String content_inc = contents[1].toString(); final String content_inc = contents[1].toString();
final String content_full = content_inc + contents[2].toString(); final String content_full = content_inc + contents[2].toString();
@ -393,7 +393,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
// shared_func(); // shared_func();
// } // }
public void testMultiLanguageWithInlinedfunc_260262() throws Exception { public void testMultiLanguageWithInlinedfunc_260262() throws Exception {
final StringBuffer[] contents = getContentsForTest(3); final StringBuilder[] contents = getContentsForTest(3);
final String hcontent = contents[0].toString(); final String hcontent = contents[0].toString();
final String content_inc = contents[1].toString(); final String content_inc = contents[1].toString();
final String content_full = content_inc + contents[2].toString(); final String content_full = content_inc + contents[2].toString();
@ -425,7 +425,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
// return 0; // return 0;
// } // }
public void testUnnamedNamespace_283679() throws Exception { public void testUnnamedNamespace_283679() throws Exception {
final StringBuffer[] contents = getContentsForTest(1); final StringBuilder[] contents = getContentsForTest(1);
final String content = contents[0].toString(); final String content = contents[0].toString();
IFile f2= createFile(getProject(), "testUnnamedNamespace_283679.cpp", content); IFile f2= createFile(getProject(), "testUnnamedNamespace_283679.cpp", content);
waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME); waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
@ -460,7 +460,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
// delete dbPtr; // delete dbPtr;
// } // }
public void testCallsToFromVirtualMethod_246064() throws Exception { public void testCallsToFromVirtualMethod_246064() throws Exception {
final StringBuffer[] contents = getContentsForTest(1); final StringBuilder[] contents = getContentsForTest(1);
final String content = contents[0].toString(); final String content = contents[0].toString();
IFile f2= createFile(getProject(), "testCallsToFromVirtualMethod_246064.cpp", content); IFile f2= createFile(getProject(), "testCallsToFromVirtualMethod_246064.cpp", content);
waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME); waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);

View file

@ -57,7 +57,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
// n->inline_method(); // r3 // n->inline_method(); // r3
// } // }
public void testMethods() throws Exception { public void testMethods() throws Exception {
StringBuffer[] content= getContentsForTest(2); CharSequence[] content= getContentsForTest(2);
String header= content[0].toString(); String header= content[0].toString();
String source = content[1].toString(); String source = content[1].toString();
IFile headerFile= createFile(getProject(), "testMethods.h", header); IFile headerFile= createFile(getProject(), "testMethods.h", header);
@ -127,7 +127,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
// method3(); // method3();
// } // }
public void testMethodsInMultipleFiles() throws Exception { public void testMethodsInMultipleFiles() throws Exception {
StringBuffer[] content= getContentsForTest(3); CharSequence[] content= getContentsForTest(3);
String header= content[0].toString(); String header= content[0].toString();
String source1 = content[1].toString(); String source1 = content[1].toString();
String source2 = content[2].toString(); String source2 = content[2].toString();
@ -177,7 +177,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
// method3(); // method3();
// } // }
public void testMultipleImplsForMethod() throws Exception { public void testMultipleImplsForMethod() throws Exception {
StringBuffer[] content= getContentsForTest(3); CharSequence[] content= getContentsForTest(3);
String header= content[0].toString(); String header= content[0].toString();
String source1 = content[1].toString(); String source1 = content[1].toString();
String source2 = content[2].toString(); String source2 = content[2].toString();
@ -237,7 +237,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
// mc.method1(); // mc.method1();
// } // }
public void testReverseMultipleImplsForMethod() throws Exception { public void testReverseMultipleImplsForMethod() throws Exception {
StringBuffer[] content= getContentsForTest(3); CharSequence[] content= getContentsForTest(3);
String header= content[0].toString(); String header= content[0].toString();
String source1 = content[1].toString(); String source1 = content[1].toString();
String source2 = content[2].toString(); String source2 = content[2].toString();
@ -294,7 +294,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
// cxcpp(); // cxcpp();
// } // }
public void testCPPCallsC() throws Exception { public void testCPPCallsC() throws Exception {
StringBuffer[] content= getContentsForTest(2); CharSequence[] content= getContentsForTest(2);
String cSource= content[0].toString(); String cSource= content[0].toString();
String cppSource = content[1].toString(); String cppSource = content[1].toString();
IFile cFile= createFile(getProject(), "s.c", cSource); IFile cFile= createFile(getProject(), "s.c", cSource);
@ -339,7 +339,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
// cppfunc(); // cppfunc();
// }} // }}
public void testCCallsCPP() throws Exception { public void testCCallsCPP() throws Exception {
StringBuffer[] content= getContentsForTest(2); CharSequence[] content= getContentsForTest(2);
String cSource= content[0].toString(); String cSource= content[0].toString();
String cppSource = content[1].toString(); String cppSource = content[1].toString();
IFile cFile= createFile(getProject(), "s.c", cSource); IFile cFile= createFile(getProject(), "s.c", cSource);
@ -411,7 +411,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
// f('1'); // f('1');
// } // }
public void testTemplates() throws Exception { public void testTemplates() throws Exception {
StringBuffer[] content= getContentsForTest(1); CharSequence[] content= getContentsForTest(1);
String source = content[0].toString(); String source = content[0].toString();
IFile file= createFile(getProject(), "testTemplates.cpp", source); IFile file= createFile(getProject(), "testTemplates.cpp", source);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
@ -475,7 +475,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
// []{c();}(); // []{c();}();
// } // }
public void testClosures_316307() throws Exception { public void testClosures_316307() throws Exception {
StringBuffer[] content= getContentsForTest(1); CharSequence[] content= getContentsForTest(1);
String source = content[0].toString(); String source = content[0].toString();
IFile file= createFile(getProject(), "testClosures.cpp", source); IFile file= createFile(getProject(), "testClosures.cpp", source);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

View file

@ -42,7 +42,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
public void testSimpleInclusion() throws Exception { public void testSimpleInclusion() throws Exception {
TestScannerProvider.sIncludes= new String[]{getProject().getProject().getLocation().toOSString()}; TestScannerProvider.sIncludes= new String[]{getProject().getProject().getLocation().toOSString()};
StringBuffer[] contents= getContentsForTest(1); StringBuilder[] contents= getContentsForTest(1);
IProject project= getProject().getProject(); IProject project= getProject().getProject();
IFile user= createFile(project, "user.h", ""); IFile user= createFile(project, "user.h", "");
IFile system= createFile(project, "system.h", ""); IFile system= createFile(project, "system.h", "");
@ -76,7 +76,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
TestScannerProvider.sIncludes= new String[]{op.getProject().getLocation().toOSString()}; TestScannerProvider.sIncludes= new String[]{op.getProject().getLocation().toOSString()};
StringBuffer[] contents= getContentsForTest(1); StringBuilder[] contents= getContentsForTest(1);
IFile user= createFile(op.getProject(), "user.h", ""); IFile user= createFile(op.getProject(), "user.h", "");
IFile system= createFile(op.getProject(), "system.h", ""); IFile system= createFile(op.getProject(), "system.h", "");
IFile source= createFile(getProject().getProject(), "source.cpp", contents[0].toString()); IFile source= createFile(getProject().getProject(), "source.cpp", contents[0].toString());
@ -98,8 +98,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
checkTreeNode(tree, 0, "system.h"); checkTreeNode(tree, 0, "system.h");
checkTreeNode(tree, 0, 0, "source.cpp"); checkTreeNode(tree, 0, 0, "source.cpp");
} } finally {
finally {
CProjectHelper.delete(op); CProjectHelper.delete(op);
} }
} }

View file

@ -95,7 +95,7 @@ public class BasicOutlineTest extends BaseUITestCase {
//#define MACRO2() //#define MACRO2()
//int main(int argc, char** argv) {} //int main(int argc, char** argv) {}
public void testSimpleOutlineContent() throws Exception { public void testSimpleOutlineContent() throws Exception {
StringBuffer[] contents= getContentsForTest(1); StringBuilder[] contents= getContentsForTest(1);
IProject project= getProject().getProject(); IProject project= getProject().getProject();
IFile source= createFile(project, "source.cpp", contents[0].toString()); IFile source= createFile(project, "source.cpp", contents[0].toString());
waitForIndexer(project, source); waitForIndexer(project, source);
@ -121,7 +121,7 @@ public class BasicOutlineTest extends BaseUITestCase {
//int Foo::field = 5; //int Foo::field = 5;
//void Foo::foo() {} //void Foo::foo() {}
public void testGroupedMembers() throws Exception { public void testGroupedMembers() throws Exception {
StringBuffer[] contents= getContentsForTest(2); StringBuilder[] contents= getContentsForTest(2);
IProject project= getProject().getProject(); IProject project= getProject().getProject();
IFile header= createFile(project, "header.h", contents[0].toString()); IFile header= createFile(project, "header.h", contents[0].toString());
IFile source= createFile(project, "source.cpp", contents[1].toString()); IFile source= createFile(project, "source.cpp", contents[1].toString());
@ -162,7 +162,7 @@ public class BasicOutlineTest extends BaseUITestCase {
//void Foo::foo() {} //void Foo::foo() {}
//} //}
public void testGroupedMembersInNamespace() throws Exception { public void testGroupedMembersInNamespace() throws Exception {
StringBuffer[] contents= getContentsForTest(2); StringBuilder[] contents= getContentsForTest(2);
IProject project= getProject().getProject(); IProject project= getProject().getProject();
IFile header= createFile(project, "header.h", contents[0].toString()); IFile header= createFile(project, "header.h", contents[0].toString());
IFile source= createFile(project, "source.cpp", contents[1].toString()); IFile source= createFile(project, "source.cpp", contents[1].toString());
@ -208,7 +208,7 @@ public class BasicOutlineTest extends BaseUITestCase {
//void Foo::foo() {} //void Foo::foo() {}
//} //}
public void testGroupedNamespaces() throws Exception { public void testGroupedNamespaces() throws Exception {
StringBuffer[] contents= getContentsForTest(2); StringBuilder[] contents= getContentsForTest(2);
IProject project= getProject().getProject(); IProject project= getProject().getProject();
IFile header= createFile(project, "header.h", contents[0].toString()); IFile header= createFile(project, "header.h", contents[0].toString());
IFile source= createFile(project, "source.cpp", contents[1].toString()); IFile source= createFile(project, "source.cpp", contents[1].toString());
@ -252,7 +252,7 @@ public class BasicOutlineTest extends BaseUITestCase {
//void Foo::foo() {} //void Foo::foo() {}
//} //}
public void testGroupedMembersInGroupedNamespaces() throws Exception { public void testGroupedMembersInGroupedNamespaces() throws Exception {
StringBuffer[] contents= getContentsForTest(2); StringBuilder[] contents= getContentsForTest(2);
IProject project= getProject().getProject(); IProject project= getProject().getProject();
IFile header= createFile(project, "header.h", contents[0].toString()); IFile header= createFile(project, "header.h", contents[0].toString());
IFile source= createFile(project, "source.cpp", contents[1].toString()); IFile source= createFile(project, "source.cpp", contents[1].toString());

View file

@ -58,7 +58,7 @@ import org.eclipse.cdt.internal.ui.search.PDOMSearchViewPage;
public class BasicSearchTest extends BaseUITestCase { public class BasicSearchTest extends BaseUITestCase {
ICProject fCProject; ICProject fCProject;
StringBuffer[] testData; CharSequence[] testData;
public static TestSuite suite() { public static TestSuite suite() {
return suite(BasicSearchTest.class); return suite(BasicSearchTest.class);

View file

@ -52,7 +52,7 @@ public class LinkedNamesFinderTest extends AST2BaseTest {
} }
@Override @Override
protected StringBuffer[] getContents(int sections) throws IOException { protected CharSequence[] getContents(int sections) throws IOException {
CTestPlugin plugin = CTestPlugin.getDefault(); CTestPlugin plugin = CTestPlugin.getDefault();
if (plugin == null) if (plugin == null)
throw new AssertionFailedError("This test must be run as a JUnit plugin test"); throw new AssertionFailedError("This test must be run as a JUnit plugin test");

View file

@ -233,7 +233,7 @@ public class AbstractAutoEditTest extends BaseTestCase {
} }
} }
protected StringBuffer[] getTestContents() { protected CharSequence[] getTestContents() {
try { try {
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 2); return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 2);
} catch(IOException ioe) { } catch(IOException ioe) {
@ -242,7 +242,7 @@ public class AbstractAutoEditTest extends BaseTestCase {
return null; return null;
} }
protected StringBuffer[] getTestContents1() { protected CharSequence[] getTestContents1() {
try { try {
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 1); return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 1);
} catch(IOException ioe) { } catch(IOException ioe) {

View file

@ -99,7 +99,7 @@ public class AddBlockCommentTest extends BaseUITestCase {
*/ */
protected void assertFormatterResult(LinePosition startLinePosition, LinePosition endLinePosition) protected void assertFormatterResult(LinePosition startLinePosition, LinePosition endLinePosition)
throws Exception { throws Exception {
StringBuffer[] contents= getContentsForTest(2); StringBuilder[] contents= getContentsForTest(2);
String before = contents[0].toString(); String before = contents[0].toString();
String after = contents[1].toString(); String after = contents[1].toString();

View file

@ -57,7 +57,7 @@ public class CIndenterTest extends BaseUITestCase {
protected void assertIndenterResult() throws Exception { protected void assertIndenterResult() throws Exception {
CCorePlugin.setOptions(fOptions); CCorePlugin.setOptions(fOptions);
StringBuffer[] contents= getContentsForTest(2); StringBuilder[] contents= getContentsForTest(2);
String before= contents[0].toString(); String before= contents[0].toString();
IDocument document= new Document(before); IDocument document= new Document(before);
String expected= contents[1].toString(); String expected= contents[1].toString();

View file

@ -59,7 +59,7 @@ public class CodeFormatterTest extends BaseUITestCase {
} }
protected void assertFormatterResult() throws Exception { protected void assertFormatterResult() throws Exception {
StringBuffer[] contents= getContentsForTest(2); CharSequence[] contents= getContentsForTest(2);
String before= contents[0].toString(); String before= contents[0].toString();
String expected= contents[1].toString(); String expected= contents[1].toString();
assertFormatterResult(before, expected); assertFormatterResult(before, expected);

View file

@ -599,7 +599,7 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
IDocument doc = new Document(); IDocument doc = new Document();
textTools.setupCDocument(doc); textTools.setupCDocument(doc);
StringBuffer[] raw= getTestContents(); CharSequence[] raw= getTestContents();
String init= raw[0].toString(), expected= raw[1].toString(); String init= raw[0].toString(), expected= raw[1].toString();
int caretInit= init.indexOf('X'); int caretInit= init.indexOf('X');

View file

@ -81,7 +81,7 @@ public class RemoveBlockCommentTest extends BaseUITestCase {
protected void assertFormatterResult( protected void assertFormatterResult(
LinePosition startLinePosition, LinePosition startLinePosition,
LinePosition endLinePosition) throws Exception { LinePosition endLinePosition) throws Exception {
StringBuffer[] contents= getContentsForTest(2); CharSequence[] contents= getContentsForTest(2);
String before = contents[0].toString(); String before = contents[0].toString();
String after = contents[1].toString(); String after = contents[1].toString();

View file

@ -133,7 +133,7 @@ public class ShiftActionTest extends BaseUITestCase {
// for(;;) { // for(;;) {
// } // }
public void testShiftRight() throws Exception { public void testShiftRight() throws Exception {
StringBuffer[] contents= getContentsForTest(2); CharSequence[] contents= getContentsForTest(2);
String before= contents[0].toString(); String before= contents[0].toString();
String after= contents[1].toString(); String after= contents[1].toString();
fDocument.set(before); fDocument.set(before);
@ -150,7 +150,7 @@ public class ShiftActionTest extends BaseUITestCase {
// for(;;) { // for(;;) {
//} //}
public void testShiftLeft() throws Exception { public void testShiftLeft() throws Exception {
StringBuffer[] contents= getContentsForTest(2); CharSequence[] contents= getContentsForTest(2);
String before= contents[0].toString(); String before= contents[0].toString();
String after= contents[1].toString(); String after= contents[1].toString();
fDocument.set(before); fDocument.set(before);

View file

@ -158,7 +158,7 @@ public class SortLinesTest extends BaseUITestCase {
// // e.h // // e.h
// #include "e.h" // #include "e.h"
public void testSortLinesMixed() throws Exception { public void testSortLinesMixed() throws Exception {
StringBuffer[] contents= getContentsForTest(2); CharSequence[] contents= getContentsForTest(2);
String before= contents[0].toString(); String before= contents[0].toString();
String after= contents[1].toString(); String after= contents[1].toString();
fDocument.set(before); fDocument.set(before);
@ -179,7 +179,7 @@ public class SortLinesTest extends BaseUITestCase {
// * Callisto // * Callisto
// */ // */
public void testSortLinesCommentsOnly() throws Exception { public void testSortLinesCommentsOnly() throws Exception {
StringBuffer[] contents= getContentsForTest(2); CharSequence[] contents= getContentsForTest(2);
String before= contents[0].toString(); String before= contents[0].toString();
String after= contents[1].toString(); String after= contents[1].toString();
fDocument.set(before); fDocument.set(before);

View file

@ -81,7 +81,7 @@ public class TemplateFormatterTest extends BaseUITestCase {
assertFormatterResult(false); assertFormatterResult(false);
} }
protected void assertFormatterResult(boolean useFormatter) throws Exception { protected void assertFormatterResult(boolean useFormatter) throws Exception {
StringBuffer[] contents= getContentsForTest(2); CharSequence[] contents= getContentsForTest(2);
String before= contents[0].toString().replaceAll("\\r\\n", "\n"); String before= contents[0].toString().replaceAll("\\r\\n", "\n");
String expected= contents[1].toString(); String expected= contents[1].toString();
final Document document = new Document(before); final Document document = new Document(before);

View file

@ -192,7 +192,7 @@ public class CompletionTests extends AbstractContentAssistTest {
protected IFile setUpProjectContent(IProject project) throws Exception { protected IFile setUpProjectContent(IProject project) throws Exception {
fProject= project; fProject= project;
String headerContent= readTaggedComment(HEADER_FILE_NAME); String headerContent= readTaggedComment(HEADER_FILE_NAME);
StringBuffer sourceContent= getContentsForTest(1)[0]; StringBuilder sourceContent= getContentsForTest(1)[0];
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n"); sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n");
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG); fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
assertTrue("No cursor location specified", fCursorOffset >= 0); assertTrue("No cursor location specified", fCursorOffset >= 0);
@ -955,7 +955,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// #include "header191315.h" // #include "header191315.h"
// void xxx() { c_lin/*cursor*/ // void xxx() { c_lin/*cursor*/
public void testExternC_bug191315() throws Exception { public void testExternC_bug191315() throws Exception {
StringBuffer[] content= getContentsForTest(3); CharSequence[] content= getContentsForTest(3);
createFile(fProject, "header191315.h", content[0].toString()); createFile(fProject, "header191315.h", content[0].toString());
createFile(fProject, "source191315.c", content[1].toString()); createFile(fProject, "source191315.c", content[1].toString());
createFile(fProject, "source191315.cpp", content[1].toString()); createFile(fProject, "source191315.cpp", content[1].toString());

View file

@ -173,7 +173,7 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
protected IFile setUpProjectContent(IProject project) throws Exception { protected IFile setUpProjectContent(IProject project) throws Exception {
fProject= project; fProject= project;
String headerContent= readTaggedComment(HEADER_FILE_NAME); String headerContent= readTaggedComment(HEADER_FILE_NAME);
StringBuffer sourceContent= getContentsForTest(1)[0]; StringBuilder sourceContent= getContentsForTest(1)[0];
int includeOffset= Math.max(0, sourceContent.indexOf(INCLUDE_LOCATION_TAG)); int includeOffset= Math.max(0, sourceContent.indexOf(INCLUDE_LOCATION_TAG));
sourceContent.insert(includeOffset, "#include \""+HEADER_FILE_NAME+"\"\n"); sourceContent.insert(includeOffset, "#include \""+HEADER_FILE_NAME+"\"\n");
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG); fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
@ -309,7 +309,7 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
// #include "header191315.h" // #include "header191315.h"
// void xxx() { c_lin/*cursor*/ // void xxx() { c_lin/*cursor*/
public void testExternC_bug191315() throws Exception { public void testExternC_bug191315() throws Exception {
StringBuffer[] content= getContentsForTest(3); CharSequence[] content= getContentsForTest(3);
createFile(fProject, "header191315.h", content[0].toString()); createFile(fProject, "header191315.h", content[0].toString());
createFile(fProject, "source191315.c", content[1].toString()); createFile(fProject, "source191315.c", content[1].toString());
createFile(fProject, "source191315.cpp", content[1].toString()); createFile(fProject, "source191315.cpp", content[1].toString());

View file

@ -55,7 +55,7 @@ public class ParameterHintTests extends AbstractContentAssistTest {
@Override @Override
protected IFile setUpProjectContent(IProject project) throws Exception { protected IFile setUpProjectContent(IProject project) throws Exception {
String headerContent= readTaggedComment(HEADER_FILE_NAME); String headerContent= readTaggedComment(HEADER_FILE_NAME);
StringBuffer sourceContent= getContentsForTest(1)[0]; StringBuilder sourceContent= getContentsForTest(1)[0];
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n"); sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n");
assertNotNull(createFile(project, HEADER_FILE_NAME, headerContent)); assertNotNull(createFile(project, HEADER_FILE_NAME, headerContent));
return createFile(project, SOURCE_FILE_NAME, sourceContent.toString()); return createFile(project, SOURCE_FILE_NAME, sourceContent.toString());

View file

@ -44,7 +44,7 @@ public class ShowCamelCasePreferenceTest extends AbstractContentAssistTest {
@Override @Override
protected IFile setUpProjectContent(IProject project) throws Exception { protected IFile setUpProjectContent(IProject project) throws Exception {
fProject= project; fProject= project;
StringBuffer sourceContent= getContentsForTest(1)[0]; StringBuilder sourceContent= getContentsForTest(1)[0];
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG); fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
assertTrue("No cursor location specified", fCursorOffset >= 0); assertTrue("No cursor location specified", fCursorOffset >= 0);
sourceContent.delete(fCursorOffset, fCursorOffset+CURSOR_LOCATION_TAG.length()); sourceContent.delete(fCursorOffset, fCursorOffset+CURSOR_LOCATION_TAG.length());

View file

@ -673,7 +673,7 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit
final IDocument doc = new Document(); final IDocument doc = new Document();
textTools.setupCDocument(doc); textTools.setupCDocument(doc);
StringBuffer[] raw= getTestContents(); CharSequence[] raw= getTestContents();
String init= raw[0].toString(), expected= raw[1].toString(); String init= raw[0].toString(), expected= raw[1].toString();
int caretInit= init.indexOf('X'); int caretInit= init.indexOf('X');

View file

@ -74,7 +74,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
return cPrj; return cPrj;
} }
protected StringBuffer[] getContents(int sections) throws IOException { protected StringBuilder[] getContents(int sections) throws IOException {
return TestSourceReader.getContentsForTest( return TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "ui", CPPSelectionTestsAnyIndexer.class, getName(), sections); CTestPlugin.getDefault().getBundle(), "ui", CPPSelectionTestsAnyIndexer.class, getName(), sections);
} }
@ -119,7 +119,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// return (0); // return (0);
// } // }
public void testBug93281() throws Exception { public void testBug93281() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("test93281.h", hcode); IFile hfile = importFile("test93281.h", hcode);
@ -161,7 +161,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// return EXIT_SUCCESS; // return EXIT_SUCCESS;
// } // }
public void testBug207320() throws Exception { public void testBug207320() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("test.h", hcode); IFile hfile = importFile("test.h", hcode);
@ -187,7 +187,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// a.assign("aaa"); // a.assign("aaa");
// } // }
public void testTemplateClassMethod_207320() throws Exception { public void testTemplateClassMethod_207320() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("test.h", hcode); IFile hfile = importFile("test.h", hcode);
@ -218,7 +218,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// class MyClass; // class MyClass;
// struct MyStruct; // struct MyStruct;
public void testBasicDefinition() throws Exception { public void testBasicDefinition() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("basicDefinition.h", hcode); IFile hfile = importFile("basicDefinition.h", hcode);
@ -299,7 +299,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// #include "testBasicTemplateInstance.h" // #include "testBasicTemplateInstance.h"
// N::AAA<int> a; // N::AAA<int> a;
public void testBasicTemplateInstance_207320() throws Exception{ public void testBasicTemplateInstance_207320() throws Exception{
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBasicTemplateInstance.h", hcode); IFile hfile = importFile("testBasicTemplateInstance.h", hcode);
@ -333,7 +333,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// X b = f(X(2)); // openDeclarations on X(int) shall find constructor // X b = f(X(2)); // openDeclarations on X(int) shall find constructor
// } // }
public void testBug86829A() throws Exception { public void testBug86829A() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug86829A.h", hcode); IFile hfile = importFile("testBug86829A.h", hcode);
@ -365,7 +365,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// int c = X(a); // OK: a.operator X().operator int() // int c = X(a); // OK: a.operator X().operator int()
// } // }
public void _testBug86829B() throws Exception { public void _testBug86829B() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug86829B.h", hcode); IFile hfile = importFile("testBug86829B.h", hcode);
@ -408,7 +408,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// S s; // S s;
// Int lhs= s.a+s.b+up+down+anX+0; // Int lhs= s.a+s.b+up+down+anX+0;
public void testCPPSpecDeclsDefs() throws Exception { public void testCPPSpecDeclsDefs() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testCPPSpecDeclsDefs.h", hcode); IFile hfile = importFile("testCPPSpecDeclsDefs.h", hcode);
@ -559,7 +559,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// using N::d; // declares // using N::d; // declares
// int a= d; // int a= d;
public void testBug168533() throws Exception { public void testBug168533() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug168533.h", hcode); IFile hfile = importFile("testBug168533.h", hcode);
@ -595,7 +595,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// } // }
// } // }
public void testBug95225() throws Exception { public void testBug95225() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug95225.h", hcode); IFile hfile = importFile("testBug95225.h", hcode);
@ -637,7 +637,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// return *this; // return *this;
// } // }
public void testBug95202() throws Exception { public void testBug95202() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug95202.h", hcode); IFile hfile = importFile("testBug95202.h", hcode);
@ -661,7 +661,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// abc; // abc;
// } // }
public void testBug101287() throws Exception { public void testBug101287() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug101287.h", hcode); IFile hfile = importFile("testBug101287.h", hcode);
@ -687,7 +687,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// void f(RTBindingEnd & end) { // void f(RTBindingEnd & end) {
// } // }
public void testBug102258() throws Exception { public void testBug102258() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug102258.h", hcode); IFile hfile = importFile("testBug102258.h", hcode);
@ -715,7 +715,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// return foo::g(); // return foo::g();
// } // }
public void testBug103323() throws Exception { public void testBug103323() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug103323.h", hcode); IFile hfile = importFile("testBug103323.h", hcode);
@ -745,7 +745,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// return 0; // return 0;
// } // }
public void testBug78354() throws Exception { public void testBug78354() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug78354.h", hcode); IFile hfile = importFile("testBug78354.h", hcode);
@ -776,7 +776,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// return x; // return x;
// } // }
public void testBug103697() throws Exception { public void testBug103697() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFileWithLink("testBug103697.h", hcode); IFile hfile = importFileWithLink("testBug103697.h", hcode);
@ -803,7 +803,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// return 0; // return 0;
// } // }
public void testBug108202() throws Exception { public void testBug108202() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug108202.h", hcode); IFile hfile = importFile("testBug108202.h", hcode);
@ -830,7 +830,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// #include "cpp.h" // #include "cpp.h"
// void cpp() {} // void cpp() {}
public void testCNavigationInCppProject_bug183973() throws Exception { public void testCNavigationInCppProject_bug183973() throws Exception {
StringBuffer[] buffers= getContents(4); StringBuilder[] buffers= getContents(4);
String hccode= buffers[0].toString(); String hccode= buffers[0].toString();
String ccode= buffers[1].toString(); String ccode= buffers[1].toString();
String hcppcode= buffers[2].toString(); String hcppcode= buffers[2].toString();
@ -870,7 +870,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// void func(usertype t) { // void func(usertype t) {
// } // }
public void testFuncWithTypedefForAnonymousStruct_190730() throws Exception { public void testFuncWithTypedefForAnonymousStruct_190730() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug190730.h", hcode); IFile hfile = importFile("testBug190730.h", hcode);
@ -896,7 +896,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// void func(userEnum t) { // void func(userEnum t) {
// } // }
public void testFuncWithTypedefForAnonymousEnum_190730() throws Exception { public void testFuncWithTypedefForAnonymousEnum_190730() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug190730_2.h", hcode); IFile hfile = importFile("testBug190730_2.h", hcode);
@ -924,7 +924,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// MY_PAR(0); // MY_PAR(0);
// } // }
public void testMacroNavigation() throws Exception { public void testMacroNavigation() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("macrodef.h", hcode); IFile hfile = importFile("macrodef.h", hcode);
@ -959,7 +959,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// tester= MY_PAR(gvar); // tester= MY_PAR(gvar);
// } // }
public void testMacroNavigation_Bug208300() throws Exception { public void testMacroNavigation_Bug208300() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("macrodef.h", hcode); IFile hfile = importFile("macrodef.h", hcode);
@ -988,7 +988,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// #include "aheader.h" // #include "aheader.h"
public void testIncludeNavigation() throws Exception { public void testIncludeNavigation() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("aheader.h", hcode); IFile hfile = importFile("aheader.h", hcode);
@ -1014,7 +1014,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// cxcpp(); // cxcpp();
// } // }
public void testNavigationCppCallsC() throws Exception { public void testNavigationCppCallsC() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String ccode= buffers[0].toString(); String ccode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile cfile = importFile("s.c", ccode); IFile cfile = importFile("s.c", ccode);
@ -1052,7 +1052,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// cppfunc(); // cppfunc();
// }} // }}
public void testNavigationCCallsCpp() throws Exception { public void testNavigationCCallsCpp() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String ccode= buffers[0].toString(); String ccode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile cfile = importFile("s.c", ccode); IFile cfile = importFile("s.c", ccode);
@ -1087,7 +1087,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// #endif // #endif
// } // }
public void testNavigationInDefinedExpression_215906() throws Exception { public void testNavigationInDefinedExpression_215906() throws Exception {
StringBuffer[] buffers= getContents(1); StringBuilder[] buffers= getContents(1);
String code= buffers[0].toString(); String code= buffers[0].toString();
IFile file = importFile("s.cpp", code); IFile file = importFile("s.cpp", code);
waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME); waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME);
@ -1118,7 +1118,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// delete xx; // delete xx;
// } // }
public void testNavigationToImplicitNames() throws Exception { public void testNavigationToImplicitNames() throws Exception {
StringBuffer[] buffers= getContents(1); StringBuilder[] buffers= getContents(1);
String code= buffers[0].toString(); String code= buffers[0].toString();
IFile file = importFile("in.cpp", code); IFile file = importFile("in.cpp", code);
waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME); waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME);
@ -1157,7 +1157,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// a + 2; // a + 2;
// } // }
public void testBug272744() throws Exception { public void testBug272744() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("test.h", hcode); IFile hfile = importFile("test.h", hcode);
@ -1203,7 +1203,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// A a3; // A a3;
// }; // };
public void testImplicitConstructorCall_248855() throws Exception { public void testImplicitConstructorCall_248855() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testImplicitConstructorCall_248855.h", hcode); IFile hfile = importFile("testImplicitConstructorCall_248855.h", hcode);
@ -1234,7 +1234,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// #undef MYMACRO // #undef MYMACRO
public void testUndef_312399() throws Exception { public void testUndef_312399() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testUndef_312399.h", hcode); IFile hfile = importFile("testUndef_312399.h", hcode);

View file

@ -992,7 +992,7 @@ public class CPPSelectionTestsNoIndexer extends BaseUITestCase {
// typedef int (functionPointerArray[2])(int); // typedef int (functionPointerArray[2])(int);
// functionPointerArray fctVariablArray; // functionPointerArray fctVariablArray;
public void testBug195822() throws Exception { public void testBug195822() throws Exception {
StringBuffer[] contents= getContentsForTest(2); StringBuilder[] contents= getContentsForTest(2);
String code= contents[0].toString(); String code= contents[0].toString();
String appendCode= contents[1].toString(); String appendCode= contents[1].toString();

View file

@ -68,7 +68,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
return cPrj; return cPrj;
} }
protected StringBuffer[] getContents(int sections) throws IOException { protected StringBuilder[] getContents(int sections) throws IOException {
return TestSourceReader.getContentsForTest( return TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "ui", CSelectionTestsAnyIndexer.class, getName(), sections); CTestPlugin.getDefault().getBundle(), "ui", CSelectionTestsAnyIndexer.class, getName(), sections);
} }
@ -94,7 +94,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// void MyFunc(int a) { cout << a << endl; } // void MyFunc(int a) { cout << a << endl; }
// struct MyStruct; // struct MyStruct;
public void testBasicDefinition() throws Exception { public void testBasicDefinition() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("basicDefinition.h", hcode); IFile hfile = importFile("basicDefinition.h", hcode);
@ -176,7 +176,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// struct S s; // struct S s;
// Int lhs= s.a+s.b+up+down+anX+0; // Int lhs= s.a+s.b+up+down+anX+0;
public void testCPPSpecDeclsDefs() throws Exception { public void testCPPSpecDeclsDefs() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testCPPSpecDeclsDefs.h", hcode); IFile hfile = importFile("testCPPSpecDeclsDefs.h", hcode);
@ -288,7 +288,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// abc; // abc;
// } // }
public void testBug101287() throws Exception { public void testBug101287() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug101287.h", hcode); IFile hfile = importFile("testBug101287.h", hcode);
@ -312,7 +312,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// return x; // return x;
// } // }
public void testBug103697() throws Exception { public void testBug103697() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFileWithLink("testBug103697.h", hcode); IFile hfile = importFileWithLink("testBug103697.h", hcode);
@ -340,7 +340,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// return 0; // return 0;
// } // }
public void testBug78354() throws Exception { public void testBug78354() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug78354.h", hcode); IFile hfile = importFile("testBug78354.h", hcode);
@ -373,7 +373,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// void func(usertype t) { // void func(usertype t) {
// } // }
public void testFuncWithTypedefForAnonymousStruct_190730() throws Exception { public void testFuncWithTypedefForAnonymousStruct_190730() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug190730.h", hcode); IFile hfile = importFile("testBug190730.h", hcode);
@ -399,7 +399,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// void func(userEnum t) { // void func(userEnum t) {
// } // }
public void testFuncWithTypedefForAnonymousEnum_190730() throws Exception { public void testFuncWithTypedefForAnonymousEnum_190730() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("testBug190730_2.h", hcode); IFile hfile = importFile("testBug190730_2.h", hcode);
@ -427,7 +427,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// MY_PAR(0); // MY_PAR(0);
// } // }
public void testMacroNavigation() throws Exception { public void testMacroNavigation() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("macrodef.h", hcode); IFile hfile = importFile("macrodef.h", hcode);
@ -460,7 +460,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// int tester = MY_PAR(MY_MACRO); // int tester = MY_PAR(MY_MACRO);
// } // }
public void testMacroNavigation_Bug208300() throws Exception { public void testMacroNavigation_Bug208300() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("macrodef.h", hcode); IFile hfile = importFile("macrodef.h", hcode);
@ -484,7 +484,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// #include "aheader.h" // #include "aheader.h"
public void testIncludeNavigation() throws Exception { public void testIncludeNavigation() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("aheader.h", hcode); IFile hfile = importFile("aheader.h", hcode);
@ -504,7 +504,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// #define DR_ACCESS_FNS(DR) // #define DR_ACCESS_FNS(DR)
public void testNavigationInMacroDefinition_Bug102643() throws Exception { public void testNavigationInMacroDefinition_Bug102643() throws Exception {
StringBuffer[] buffers= getContents(2); StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString(); String hcode= buffers[0].toString();
String scode= buffers[1].toString(); String scode= buffers[1].toString();
IFile hfile = importFile("aheader.h", hcode); IFile hfile = importFile("aheader.h", hcode);
@ -533,7 +533,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// return myFunc(0); // return myFunc(0);
// } // }
public void testKRstyleFunctions_Bug221635() throws Exception { public void testKRstyleFunctions_Bug221635() throws Exception {
final StringBuffer[] contents = getContentsForTest(2); final StringBuilder[] contents = getContentsForTest(2);
String hcode= contents[0].toString(); String hcode= contents[0].toString();
String code= contents[1].toString(); String code= contents[1].toString();
IFile hfile = importFile("aheader.h", hcode); IFile hfile = importFile("aheader.h", hcode);
@ -550,7 +550,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
// int x= __LINE__; // int x= __LINE__;
public void testBuiltinMacro_Bug293864() throws Exception { public void testBuiltinMacro_Bug293864() throws Exception {
final StringBuffer[] contents = getContentsForTest(1); final StringBuilder[] contents = getContentsForTest(1);
String code= contents[0].toString(); String code= contents[0].toString();
IFile file = importFile("source.c", code); IFile file = importFile("source.c", code);
int offset= code.indexOf("__LINE__"); int offset= code.indexOf("__LINE__");

View file

@ -85,7 +85,7 @@ public class TypeHierarchyAcrossProjectsTest extends TypeHierarchyBaseTest {
// int method4(); // int method4();
// }; // };
public void testSimpleInheritanceAcross() throws Exception { public void testSimpleInheritanceAcross() throws Exception {
StringBuffer[] content= getContentsForTest(2); CharSequence[] content= getContentsForTest(2);
String header= content[0].toString(); String header= content[0].toString();
String source = content[1].toString(); String source = content[1].toString();
IFile headerFile= createFile(fCProject.getProject(), "simpleHeader.h", header); IFile headerFile= createFile(fCProject.getProject(), "simpleHeader.h", header);

View file

@ -81,7 +81,7 @@ public class PDOMSearchPatternQuery extends PDOMSearchQuery {
// Parse the pattern string // Parse the pattern string
List<Pattern> patternList = new ArrayList<Pattern>(); List<Pattern> patternList = new ArrayList<Pattern>();
StringBuffer buff = new StringBuffer(); StringBuilder buff = new StringBuilder();
int n = patternStr.length(); int n = patternStr.length();
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
char c = patternStr.charAt(i); char c = patternStr.charAt(i);
@ -114,7 +114,7 @@ public class PDOMSearchPatternQuery extends PDOMSearchQuery {
patternList.add(Pattern.compile(buff.toString())); patternList.add(Pattern.compile(buff.toString()));
else else
patternList.add(Pattern.compile(buff.toString(),Pattern.CASE_INSENSITIVE)); patternList.add(Pattern.compile(buff.toString(),Pattern.CASE_INSENSITIVE));
buff = new StringBuffer(); buff = new StringBuilder();
} }
break; break;
case '|': case '+': case '^': case '(': case ')': case '[': case ']': case '|': case '+': case '^': case '(': case ')': case '[': case ']':