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:
parent
389a1ff92b
commit
13d4a94d42
57 changed files with 203 additions and 207 deletions
|
@ -10,14 +10,14 @@
|
|||
*******************************************************************************/
|
||||
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.test.CheckerTestCase;
|
||||
import org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectChecker;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Test for {@see StatementHasNoEffectChecker} class
|
||||
*
|
||||
|
@ -107,7 +107,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
|
|||
// }
|
||||
/* this test is using two files */
|
||||
public void test2FilesUnaryExpression() throws IOException {
|
||||
StringBuffer[] code = getContents(2);
|
||||
CharSequence[] code = getContents(2);
|
||||
File f1 = loadcode(code[0].toString());
|
||||
File f2 = loadcode(code[1].toString());
|
||||
runOnProject();
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.codan.core.test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
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.semantics.CPPVisitor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* TODO: add description
|
||||
*/
|
||||
|
@ -56,7 +56,7 @@ public abstract class CodanFastCxxAstTestCase extends TestCase {
|
|||
return getContents(1)[0].toString();
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) {
|
||||
protected StringBuilder[] getContents(int sections) {
|
||||
try {
|
||||
CodanCoreTestActivator plugin = CodanCoreTestActivator.getDefault();
|
||||
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() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final NullLogService NULL_LOG = new NullLogService();
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,12 +10,6 @@
|
|||
*******************************************************************************/
|
||||
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.dom.IPDOMManager;
|
||||
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.Plugin;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* TODO: add description
|
||||
*/
|
||||
|
@ -170,9 +170,10 @@ public class CodanTestCase extends BaseTestCase {
|
|||
return getContents(1)[0].toString();
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) {
|
||||
protected StringBuilder[] getContents(int sections) {
|
||||
try {
|
||||
return TestSourceReader.getContentsForTest(getPlugin().getBundle(), getSourcePrefix(), getClass(), getName(), sections);
|
||||
return TestSourceReader.getContentsForTest(getPlugin().getBundle(), getSourcePrefix(),
|
||||
getClass(), getName(), sections);
|
||||
} catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
return null;
|
||||
|
|
|
@ -10,16 +10,16 @@
|
|||
*******************************************************************************/
|
||||
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.ui.AbstractCodanCMarkerResolution;
|
||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||
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
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@ public class SuggestedParenthesisQuickFixTest extends QuickFixTestCase {
|
|||
* quick fix is not called
|
||||
*/
|
||||
public void test2FilesExample() throws FileNotFoundException, IOException {
|
||||
StringBuffer[] code = getContents(2);
|
||||
CharSequence[] code = getContents(2);
|
||||
File f1 = loadcode(code[0].toString());
|
||||
File f2 = loadcode(code[1].toString());
|
||||
// lets pretend marker is found in main.c but fixes go in both files,
|
||||
|
|
|
@ -473,7 +473,7 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
return getContents(1)[0].toString();
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected CharSequence[] getContents(int sections) throws IOException {
|
||||
CTestPlugin plugin = CTestPlugin.getDefault();
|
||||
if (plugin == null)
|
||||
throw new AssertionFailedError("This test must be run as a JUnit plugin test");
|
||||
|
|
|
@ -8060,7 +8060,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
|
||||
// }
|
||||
public void testInitOfClassObjectsByRValues_294730() throws Exception {
|
||||
final StringBuffer[] contents = getContents(3);
|
||||
final CharSequence[] contents = getContents(3);
|
||||
final String code= contents[0].toString();
|
||||
final String end= contents[2].toString();
|
||||
parseAndCheckBindings(code + end, ParserLanguage.CPP);
|
||||
|
|
|
@ -145,7 +145,7 @@ public class AST2FileBasePluginTest extends TestCase {
|
|||
return file;
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||
}
|
||||
|
|
|
@ -4039,7 +4039,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// ASSERT(false);// fine
|
||||
// }
|
||||
public void testBug188855_gccExtensionForVariadicMacros() throws Exception {
|
||||
StringBuffer[] buffer = getContents(2);
|
||||
CharSequence[] buffer = getContents(2);
|
||||
final String content1 = buffer[0].toString();
|
||||
final String content2 = buffer[1].toString();
|
||||
parse(content1, ParserLanguage.CPP);
|
||||
|
@ -4843,7 +4843,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// return 0;
|
||||
// }
|
||||
public void testBug228422_noKnrParam() throws Exception {
|
||||
StringBuffer buffer = getContents(1)[0];
|
||||
CharSequence buffer = getContents(1)[0];
|
||||
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)(a)-a // typeof a,a,cast,a,-
|
||||
public void testBinaryVsCastAmbiguities_Bug237057() throws Exception {
|
||||
StringBuffer[] input= getContents(2);
|
||||
CharSequence[] input= getContents(2);
|
||||
String code= input[0].toString();
|
||||
String[] samples= input[1].toString().split("\n");
|
||||
for (ParserLanguage lang : ParserLanguage.values()) {
|
||||
|
@ -5302,7 +5302,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// (f)(a)+1 // f,a,(),1,+
|
||||
// (t)(t)+1 // t,t,1,unary+,cast,cast
|
||||
public void testCastVsFunctionCallAmbiguities_Bug237057() throws Exception {
|
||||
StringBuffer[] input= getContents(2);
|
||||
CharSequence[] input= getContents(2);
|
||||
String code= input[0].toString();
|
||||
String[] samples= input[1].toString().split("\n");
|
||||
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,,
|
||||
// 1 ? 2 ? 3 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,?
|
||||
public void testBinaryExpressionBinding() throws Exception {
|
||||
StringBuffer[] input= getContents(2);
|
||||
CharSequence[] input= getContents(2);
|
||||
String code= input[0].toString();
|
||||
String[] samples= input[1].toString().split("\n");
|
||||
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 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,?
|
||||
public void testConstantExpressionBinding() throws Exception {
|
||||
StringBuffer[] input= getContents(2);
|
||||
CharSequence[] input= getContents(2);
|
||||
String code= input[0].toString();
|
||||
String[] samples= input[1].toString().split("\n");
|
||||
for (ParserLanguage lang : ParserLanguage.values()) {
|
||||
|
@ -5859,7 +5859,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
public void testScalabilityOfLargeTrivialInitializer_Bug253690() throws Exception {
|
||||
sValidateCopy= false;
|
||||
final int AMOUNT= 250000;
|
||||
final StringBuffer[] input = getContents(3);
|
||||
final CharSequence[] input = getContents(3);
|
||||
StringBuilder buf= new StringBuilder();
|
||||
buf.append(input[0].toString());
|
||||
final String line= input[1].toString();
|
||||
|
@ -5892,7 +5892,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
public void testLargeTrivialAggregateInitializer_Bug253690() throws Exception {
|
||||
sValidateCopy= false;
|
||||
final int AMOUNT= 250000;
|
||||
final StringBuffer[] input = getContents(3);
|
||||
final CharSequence[] input = getContents(3);
|
||||
StringBuilder buf= new StringBuilder();
|
||||
buf.append(input[0].toString());
|
||||
final String line= input[1].toString();
|
||||
|
|
|
@ -201,7 +201,7 @@ public class CommentTests extends AST2BaseTest {
|
|||
// // comment2
|
||||
// #endif
|
||||
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);
|
||||
IASTComment[] comments = tu.getComments();
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class CommentTests extends AST2BaseTest {
|
|||
|
||||
// //comment
|
||||
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);
|
||||
IASTComment[] comments = tu.getComments();
|
||||
|
||||
|
@ -236,7 +236,7 @@ public class CommentTests extends AST2BaseTest {
|
|||
// // TODO: shows up in task list
|
||||
|
||||
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);
|
||||
IASTComment[] comments = tu.getComments();
|
||||
|
||||
|
@ -246,7 +246,7 @@ public class CommentTests extends AST2BaseTest {
|
|||
for (IASTComment comment : comments) {
|
||||
IASTFileLocation loc= comment.getFileLocation();
|
||||
int idx= loc.getNodeOffset() + comment.getRawSignature().indexOf("TODO");
|
||||
assertEquals("TODO", code.substring(idx, idx+4));
|
||||
assertEquals("TODO", code.subSequence(idx, idx + 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ public class DOMPreprocessorInformationTest extends AST2BaseTest {
|
|||
// #elif
|
||||
// #endif
|
||||
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);
|
||||
IASTPreprocessorStatement[] st = tu.getAllPreprocessorStatements();
|
||||
assertEquals(3, st.length);
|
||||
|
|
|
@ -132,7 +132,7 @@ public class CompletionTestBase extends BaseTestCase {
|
|||
return getContents(1)[0].toString();
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||
CTestPlugin plugin = CTestPlugin.getDefault();
|
||||
if (plugin == null)
|
||||
throw new AssertionFailedError("This test must be run as a JUnit plugin test");
|
||||
|
|
|
@ -36,11 +36,11 @@ public class ExpansionExplorerTests extends BaseTestCase {
|
|||
}
|
||||
|
||||
private void performTest(int steps) throws Exception {
|
||||
StringBuffer[] bufs= TestSourceReader.getContentsForTest(
|
||||
CharSequence[] bufs= TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), steps+2);
|
||||
String[] input= new String[steps+2];
|
||||
int i= -1;
|
||||
for (StringBuffer buf : bufs) {
|
||||
for (CharSequence buf : bufs) {
|
||||
input[++i]= buf.toString().trim();
|
||||
}
|
||||
final MacroExpander expander= createExpander(input[0]);
|
||||
|
|
|
@ -113,7 +113,7 @@ public class LocationMapTests extends BaseTestCase {
|
|||
super.tearDown();
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||
}
|
||||
|
|
|
@ -95,10 +95,9 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
|
|||
initializeScanner(getAboveComment());
|
||||
}
|
||||
|
||||
protected StringBuffer[] getTestContent(int sections) throws IOException {
|
||||
StringBuffer[] input= TestSourceReader.getContentsForTest(
|
||||
protected StringBuilder[] getTestContent(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||
return input;
|
||||
}
|
||||
|
||||
protected String getAboveComment() throws IOException {
|
||||
|
@ -110,8 +109,7 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
|
|||
for(;;) {
|
||||
IToken t= fScanner.nextToken();
|
||||
}
|
||||
}
|
||||
catch ( EndOfFileException e){
|
||||
} catch ( EndOfFileException e){
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
void setUp() throws Exception;
|
||||
void tearDown() throws Exception;
|
||||
public IASTTranslationUnit getAst();
|
||||
public StringBuffer[] getTestData();
|
||||
public StringBuilder[] getTestData();
|
||||
public ICProject getCProject();
|
||||
public boolean isCompositeIndex();
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
class SinglePDOMTestFirstASTStrategy implements ITestStrategy {
|
||||
private IIndex index;
|
||||
private ICProject cproject;
|
||||
private StringBuffer[] testData;
|
||||
private StringBuilder[] testData;
|
||||
private IASTTranslationUnit ast;
|
||||
private boolean cpp;
|
||||
|
||||
|
@ -254,7 +254,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
return cproject;
|
||||
}
|
||||
|
||||
public StringBuffer[] getTestData() {
|
||||
public StringBuilder[] getTestData() {
|
||||
return testData;
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
class SinglePDOMTestStrategy implements ITestStrategy {
|
||||
private IIndex index;
|
||||
private ICProject cproject;
|
||||
private StringBuffer[] testData;
|
||||
private StringBuilder[] testData;
|
||||
private IASTTranslationUnit ast;
|
||||
private boolean cpp;
|
||||
|
||||
|
@ -320,7 +320,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
return cproject;
|
||||
}
|
||||
|
||||
public StringBuffer[] getTestData() {
|
||||
public StringBuilder[] getTestData() {
|
||||
return testData;
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
class ReferencedProject implements ITestStrategy {
|
||||
private IIndex index;
|
||||
private ICProject cproject, referenced;
|
||||
private StringBuffer[] testData;
|
||||
private StringBuilder[] testData;
|
||||
private IASTTranslationUnit ast;
|
||||
private boolean cpp;
|
||||
|
||||
|
@ -453,7 +453,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
return index;
|
||||
}
|
||||
|
||||
public StringBuffer[] getTestData() {
|
||||
public StringBuilder[] getTestData() {
|
||||
return testData;
|
||||
}
|
||||
|
||||
|
|
|
@ -275,11 +275,11 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
}
|
||||
|
||||
protected String[] getContentsForTest(int blocks) throws IOException {
|
||||
StringBuffer[] help= TestSourceReader.getContentsForTest(
|
||||
CharSequence[] help= TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
||||
String[] result= new String[help.length];
|
||||
int i= 0;
|
||||
for (StringBuffer buf : help) {
|
||||
for (CharSequence buf : help) {
|
||||
result[i++]= buf.toString();
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -63,7 +63,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
|||
|
||||
IIndex index;
|
||||
|
||||
protected StringBuffer[] getContentsForTest(int blocks) throws IOException {
|
||||
protected StringBuilder[] getContentsForTest(int blocks) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
|||
|
||||
// class B {};
|
||||
public void testPairDisjointContent() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(2);
|
||||
CharSequence[] contents = getContentsForTest(2);
|
||||
List projects = new ArrayList();
|
||||
|
||||
try {
|
||||
|
@ -117,7 +117,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
|||
// void foo(X::B2 c) {}
|
||||
// namespace X { class A2 {}; B2 b; C2 c; }
|
||||
public void testTripleLinear() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(3);
|
||||
CharSequence[] contents = getContentsForTest(3);
|
||||
List projects = new ArrayList();
|
||||
|
||||
try {
|
||||
|
@ -224,7 +224,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
|||
// namespace X { class A2 {}; }
|
||||
// B1 ab;
|
||||
public void testTripleUpwardV() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(3);
|
||||
CharSequence[] contents = getContentsForTest(3);
|
||||
List projects = new ArrayList();
|
||||
|
||||
|
||||
|
@ -313,7 +313,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
|||
// void foo(A1 a, A1 b) {}
|
||||
// namespace X { class A2 {}; }
|
||||
public void testTripleDownwardV() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(3);
|
||||
CharSequence[] contents = getContentsForTest(3);
|
||||
List projects = new ArrayList();
|
||||
|
||||
try {
|
||||
|
@ -450,7 +450,7 @@ class ProjectBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
ProjectBuilder addFile(String relativePath, StringBuffer content) {
|
||||
ProjectBuilder addFile(String relativePath, CharSequence content) {
|
||||
path2content.put(relativePath, content.toString());
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
// #include "header1.h"
|
||||
// #include "header2.h"
|
||||
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 h2= TestSourceReader.createFile(fProject.getProject(), "header2.h", sources[1].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 {
|
||||
waitForIndexer();
|
||||
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 s1= TestSourceReader.createFile(fProject.getProject(), "s20070427.cpp",
|
||||
source[0].toString() + "\nint a20070427;");
|
||||
|
|
|
@ -90,7 +90,7 @@ public class IndexLocationTest extends BaseTestCase {
|
|||
|
||||
try {
|
||||
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());
|
||||
createExternalFile(externalHeader, testData[1].toString());
|
||||
|
|
|
@ -59,7 +59,7 @@ public class IndexTestBase extends BaseTestCase {
|
|||
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(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
private ICProject fCppProject= null;
|
||||
private ICProject fCProject= null;
|
||||
private IIndex fIndex= null;
|
||||
private StringBuffer[] fContents;
|
||||
private CharSequence[] fContents;
|
||||
private IFile fFile;
|
||||
private IFile fHeader;
|
||||
private int fContentUsed;
|
||||
|
|
|
@ -59,9 +59,9 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
}
|
||||
|
||||
protected void setUpSections(int sections) throws Exception {
|
||||
StringBuffer[] contents= TestSourceReader.getContentsForTest(
|
||||
CharSequence[] contents= TestSourceReader.getContentsForTest(
|
||||
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());
|
||||
}
|
||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||
|
@ -76,7 +76,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
if(pdom!=null) {
|
||||
if(pdom != null) {
|
||||
pdom.releaseReadLock();
|
||||
}
|
||||
pdom= null;
|
||||
|
|
|
@ -43,9 +43,9 @@ public class CPPFunctionTemplateTests extends PDOMTestBase {
|
|||
}
|
||||
|
||||
protected void setUpSections(int sections) throws Exception {
|
||||
StringBuffer[] contents= TestSourceReader.getContentsForTest(
|
||||
StringBuilder[] contents= TestSourceReader.getContentsForTest(
|
||||
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());
|
||||
}
|
||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||
|
|
|
@ -53,7 +53,8 @@ public class PDOMCBugsTest extends BaseTestCase {
|
|||
protected void setUp() throws Exception {
|
||||
cproject= CProjectHelper.createCProject("PDOMCBugsTest"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
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());
|
||||
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class PDOMLocationTests extends BaseTestCase {
|
|||
cproject= CProjectHelper.createCCProject("PDOMLocationTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Symbian - Initial implementation
|
||||
* Symbian - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.pdom.tests;
|
||||
|
||||
|
@ -28,7 +28,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* a lo-fidelity debugging tool)
|
||||
*/
|
||||
public class PDOMPrettyPrinter implements IPDOMVisitor {
|
||||
StringBuffer indent = new StringBuffer();
|
||||
StringBuilder indent = new StringBuilder();
|
||||
final String step = " "; //$NON-NLS-1$
|
||||
|
||||
public void leave(IPDOMNode node) throws CoreException {
|
||||
|
|
|
@ -57,18 +57,19 @@ import org.osgi.framework.Bundle;
|
|||
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.
|
||||
* @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 clazz the name of the class containing the test
|
||||
* @param testName the name of the test
|
||||
* @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.
|
||||
* @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('.', '/');
|
||||
fqn = fqn.indexOf("$")==-1 ? fqn : fqn.substring(0,fqn.indexOf("$"));
|
||||
String classFile = fqn + ".java";
|
||||
|
@ -91,7 +92,7 @@ public class TestSourceReader {
|
|||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
|
||||
List contents = new ArrayList();
|
||||
StringBuffer content = new StringBuffer();
|
||||
StringBuilder content = new StringBuilder();
|
||||
for(String line = br.readLine(); line!=null; line = br.readLine()) {
|
||||
line = line.replaceFirst("^\\s*", ""); // replace leading whitespace, preserve trailing
|
||||
if(line.startsWith("//")) {
|
||||
|
@ -101,11 +102,11 @@ public class TestSourceReader {
|
|||
contents.add(content);
|
||||
if(contents.size()==sections+1)
|
||||
contents.remove(0);
|
||||
content = new StringBuffer();
|
||||
content = new StringBuilder();
|
||||
}
|
||||
int idx= line.indexOf(testName);
|
||||
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 {
|
||||
int c= 0;
|
||||
int offset= 0;
|
||||
StringBuffer buf= new StringBuffer();
|
||||
StringBuilder buf= new StringBuilder();
|
||||
while ((c = reader.read()) >= 0) {
|
||||
buf.append((char) c);
|
||||
if (c == '\n') {
|
||||
|
@ -182,7 +183,7 @@ public class TestSourceReader {
|
|||
InputStream in= FileLocator.openStream(bundle, filePath, false);
|
||||
LineNumberReader reader= new LineNumberReader(new InputStreamReader(in));
|
||||
boolean found= false;
|
||||
final StringBuffer content= new StringBuffer();
|
||||
final StringBuilder content= new StringBuilder();
|
||||
try {
|
||||
String line= reader.readLine();
|
||||
while (line != null) {
|
||||
|
@ -222,7 +223,6 @@ public class TestSourceReader {
|
|||
* @param contents the content for the file
|
||||
* @return a file object.
|
||||
* @throws CoreException
|
||||
* @throws Exception
|
||||
* @since 4.0
|
||||
*/
|
||||
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 filePath the path relative to the container to create the file at
|
||||
* @param contents the content for the file
|
||||
* @return
|
||||
* @return a file object.
|
||||
* @throws Exception
|
||||
* @throws Exception
|
||||
* @since 4.0
|
||||
*/
|
||||
public static IFile createFile(IContainer container, String filePath, String contents) throws CoreException {
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Doug Schaefer
|
||||
*/
|
||||
public class LongString implements IString {
|
||||
|
||||
private final Database db;
|
||||
private final long record;
|
||||
private int hash;
|
||||
|
@ -370,7 +369,7 @@ public class LongString implements IString {
|
|||
|
||||
public String getString() throws CoreException {
|
||||
int length = db.getInt(record + LENGTH);
|
||||
final StringBuffer buffer = new StringBuffer(length);
|
||||
final StringBuilder buffer = new StringBuilder(length);
|
||||
readChars(length, new IReader() {
|
||||
public void appendChar(char c) {
|
||||
buffer.append(c);
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Doug Schaefer
|
||||
*/
|
||||
public class ShortString implements IString {
|
||||
|
||||
private final Database db;
|
||||
private final long record;
|
||||
private int hash;
|
||||
|
@ -184,7 +183,7 @@ public class ShortString implements IString {
|
|||
|
||||
while (i1 < n1 && i2 < n2) {
|
||||
int cmp= compareChars(chunk.getChar(i1), other[i2], caseSensitive);
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
i1 += 2;
|
||||
|
@ -219,7 +218,7 @@ public class ShortString implements IString {
|
|||
|
||||
while (i1 < n1 && i2 < n2) {
|
||||
int cmp= compareChars(chunk1.getChar(i1), chunk2.getChar(i2), caseSensitive);
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
i1 += 2;
|
||||
|
@ -244,7 +243,7 @@ public class ShortString implements IString {
|
|||
|
||||
while (i1 < n1 && i2 < n2) {
|
||||
int cmp= compareChars(chunk.getChar(i1), other.charAt(i2), caseSensitive);
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
i1 += 2;
|
||||
|
@ -282,7 +281,7 @@ public class ShortString implements IString {
|
|||
final char c2= chunk2.getChar(i2);
|
||||
if (c1 != c2) {
|
||||
int cmp= compareChars(c1, c2, false); // insensitive
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
if (sensitiveCmp == 0) {
|
||||
|
@ -320,7 +319,7 @@ public class ShortString implements IString {
|
|||
final char c2= chars[i2];
|
||||
if (c1 != c2) {
|
||||
int cmp= compareChars(c1, c2, false); // insensitive
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
if (sensitiveCmp == 0) {
|
||||
|
@ -355,7 +354,7 @@ public class ShortString implements IString {
|
|||
|
||||
while (i1 < n1 && i2 < n2) {
|
||||
int cmp= compareChars(chunk.getChar(i1), other[i2], caseSensitive);
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
i1 += 2;
|
||||
|
@ -369,7 +368,7 @@ public class ShortString implements IString {
|
|||
}
|
||||
|
||||
public char charAt(int i) throws CoreException {
|
||||
long ptr = record + CHARS + (i*2);
|
||||
long ptr = record + CHARS + (i * 2);
|
||||
return db.getChar(ptr);
|
||||
}
|
||||
|
||||
|
@ -392,7 +391,7 @@ public class ShortString implements IString {
|
|||
* </ul>
|
||||
*/
|
||||
public static int compareChars(char a, char b, boolean caseSensitive) {
|
||||
if(caseSensitive) {
|
||||
if (caseSensitive) {
|
||||
if (a < b)
|
||||
return -1;
|
||||
if (a > b)
|
||||
|
@ -414,7 +413,7 @@ public class ShortString implements IString {
|
|||
* benchmark first.
|
||||
*
|
||||
* public static int compareChars(char a, char b, boolean caseSensitive) {
|
||||
if(caseSensitive) {
|
||||
if (caseSensitive) {
|
||||
if (a < b)
|
||||
return -1;
|
||||
if (a > b)
|
||||
|
|
|
@ -101,8 +101,9 @@ public class BaseUITestCase extends BaseTestCase {
|
|||
* Reads multiple sections in comments from the source of the given class.
|
||||
* @since 4.0
|
||||
*/
|
||||
public StringBuffer[] getContentsForTest(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", getClass(), getName(), sections);
|
||||
public StringBuilder[] getContentsForTest(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui",
|
||||
getClass(), getName(), sections);
|
||||
}
|
||||
|
||||
public String getAboveComment() throws IOException {
|
||||
|
|
|
@ -551,7 +551,7 @@ public class BasicCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// sf();
|
||||
// }
|
||||
public void testStaticFunctionsC() throws Exception {
|
||||
StringBuffer[] sbs= getContentsForTest(2);
|
||||
StringBuilder[] sbs= getContentsForTest(2);
|
||||
String content2= sbs[0].toString();
|
||||
String content1= content2 + sbs[1].toString();
|
||||
IFile file1= createFile(getProject(), "staticFunc1.c", content1);
|
||||
|
@ -620,7 +620,7 @@ public class BasicCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// sf();
|
||||
// }
|
||||
public void testStaticFunctionsCpp() throws Exception {
|
||||
StringBuffer[] sbs= getContentsForTest(2);
|
||||
StringBuilder[] sbs= getContentsForTest(2);
|
||||
String content2= sbs[0].toString();
|
||||
String content1= content2 + sbs[1].toString();
|
||||
IFile file1= createFile(getProject(), "staticFunc1.cpp", content1);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
|||
// n->inline_method(); // r3
|
||||
// }
|
||||
public void testMethods() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(2);
|
||||
StringBuilder[] content= getContentsForTest(2);
|
||||
String header= content[0].toString();
|
||||
String source = content[1].toString();
|
||||
IFile headerFile= createFile(fCProject.getProject(), "testMethods.h", header);
|
||||
|
@ -155,7 +155,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
|||
// method3();
|
||||
// }
|
||||
public void testMethodsInMultipleFiles() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
StringBuilder[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
@ -205,7 +205,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
|||
// method3();
|
||||
// }
|
||||
public void testMultipleImplsForMethod() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
StringBuilder[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
@ -266,7 +266,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
|||
// mc.method1();
|
||||
// }
|
||||
public void testReverseMultipleImplsForMethod() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
StringBuilder[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
|
|
@ -54,7 +54,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// field= 1;
|
||||
// }
|
||||
public void testCallHierarchyFromOutlineView_183941() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(2);
|
||||
StringBuilder[] contents = getContentsForTest(2);
|
||||
IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString());
|
||||
IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString());
|
||||
waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
|
@ -95,7 +95,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// ref2= 0;
|
||||
// }
|
||||
public void testCallHierarchyFromOutlineViewAmbiguous_183941() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(2);
|
||||
StringBuilder[] contents = getContentsForTest(2);
|
||||
IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString());
|
||||
IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString());
|
||||
waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
|
@ -363,7 +363,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// shared_func();
|
||||
// }
|
||||
public void testMultiLanguageWithPrototype_260262() throws Exception {
|
||||
final StringBuffer[] contents = getContentsForTest(3);
|
||||
final StringBuilder[] contents = getContentsForTest(3);
|
||||
final String hcontent = contents[0].toString();
|
||||
final String content_inc = contents[1].toString();
|
||||
final String content_full = content_inc + contents[2].toString();
|
||||
|
@ -393,7 +393,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// shared_func();
|
||||
// }
|
||||
public void testMultiLanguageWithInlinedfunc_260262() throws Exception {
|
||||
final StringBuffer[] contents = getContentsForTest(3);
|
||||
final StringBuilder[] contents = getContentsForTest(3);
|
||||
final String hcontent = contents[0].toString();
|
||||
final String content_inc = contents[1].toString();
|
||||
final String content_full = content_inc + contents[2].toString();
|
||||
|
@ -425,7 +425,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// return 0;
|
||||
// }
|
||||
public void testUnnamedNamespace_283679() throws Exception {
|
||||
final StringBuffer[] contents = getContentsForTest(1);
|
||||
final StringBuilder[] contents = getContentsForTest(1);
|
||||
final String content = contents[0].toString();
|
||||
IFile f2= createFile(getProject(), "testUnnamedNamespace_283679.cpp", content);
|
||||
waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
|
@ -460,7 +460,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// delete dbPtr;
|
||||
// }
|
||||
public void testCallsToFromVirtualMethod_246064() throws Exception {
|
||||
final StringBuffer[] contents = getContentsForTest(1);
|
||||
final StringBuilder[] contents = getContentsForTest(1);
|
||||
final String content = contents[0].toString();
|
||||
IFile f2= createFile(getProject(), "testCallsToFromVirtualMethod_246064.cpp", content);
|
||||
waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
|
|
|
@ -57,7 +57,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// n->inline_method(); // r3
|
||||
// }
|
||||
public void testMethods() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(2);
|
||||
CharSequence[] content= getContentsForTest(2);
|
||||
String header= content[0].toString();
|
||||
String source = content[1].toString();
|
||||
IFile headerFile= createFile(getProject(), "testMethods.h", header);
|
||||
|
@ -127,7 +127,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// method3();
|
||||
// }
|
||||
public void testMethodsInMultipleFiles() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
CharSequence[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
@ -177,7 +177,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// method3();
|
||||
// }
|
||||
public void testMultipleImplsForMethod() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
CharSequence[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
@ -237,7 +237,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// mc.method1();
|
||||
// }
|
||||
public void testReverseMultipleImplsForMethod() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
CharSequence[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
@ -294,7 +294,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// cxcpp();
|
||||
// }
|
||||
public void testCPPCallsC() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(2);
|
||||
CharSequence[] content= getContentsForTest(2);
|
||||
String cSource= content[0].toString();
|
||||
String cppSource = content[1].toString();
|
||||
IFile cFile= createFile(getProject(), "s.c", cSource);
|
||||
|
@ -339,7 +339,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// cppfunc();
|
||||
// }}
|
||||
public void testCCallsCPP() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(2);
|
||||
CharSequence[] content= getContentsForTest(2);
|
||||
String cSource= content[0].toString();
|
||||
String cppSource = content[1].toString();
|
||||
IFile cFile= createFile(getProject(), "s.c", cSource);
|
||||
|
@ -411,7 +411,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// f('1');
|
||||
// }
|
||||
public void testTemplates() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(1);
|
||||
CharSequence[] content= getContentsForTest(1);
|
||||
String source = content[0].toString();
|
||||
IFile file= createFile(getProject(), "testTemplates.cpp", source);
|
||||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
|
@ -475,7 +475,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// []{c();}();
|
||||
// }
|
||||
public void testClosures_316307() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(1);
|
||||
CharSequence[] content= getContentsForTest(1);
|
||||
String source = content[0].toString();
|
||||
IFile file= createFile(getProject(), "testClosures.cpp", source);
|
||||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
|
|
|
@ -42,7 +42,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
|||
public void testSimpleInclusion() throws Exception {
|
||||
TestScannerProvider.sIncludes= new String[]{getProject().getProject().getLocation().toOSString()};
|
||||
|
||||
StringBuffer[] contents= getContentsForTest(1);
|
||||
StringBuilder[] contents= getContentsForTest(1);
|
||||
IProject project= getProject().getProject();
|
||||
IFile user= createFile(project, "user.h", "");
|
||||
IFile system= createFile(project, "system.h", "");
|
||||
|
@ -76,7 +76,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
|||
|
||||
TestScannerProvider.sIncludes= new String[]{op.getProject().getLocation().toOSString()};
|
||||
|
||||
StringBuffer[] contents= getContentsForTest(1);
|
||||
StringBuilder[] contents= getContentsForTest(1);
|
||||
IFile user= createFile(op.getProject(), "user.h", "");
|
||||
IFile system= createFile(op.getProject(), "system.h", "");
|
||||
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, 0, "source.cpp");
|
||||
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
CProjectHelper.delete(op);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
|||
//#define MACRO2()
|
||||
//int main(int argc, char** argv) {}
|
||||
public void testSimpleOutlineContent() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(1);
|
||||
StringBuilder[] contents= getContentsForTest(1);
|
||||
IProject project= getProject().getProject();
|
||||
IFile source= createFile(project, "source.cpp", contents[0].toString());
|
||||
waitForIndexer(project, source);
|
||||
|
@ -121,7 +121,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
|||
//int Foo::field = 5;
|
||||
//void Foo::foo() {}
|
||||
public void testGroupedMembers() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
IProject project= getProject().getProject();
|
||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||
|
@ -162,7 +162,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
|||
//void Foo::foo() {}
|
||||
//}
|
||||
public void testGroupedMembersInNamespace() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
IProject project= getProject().getProject();
|
||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||
|
@ -208,7 +208,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
|||
//void Foo::foo() {}
|
||||
//}
|
||||
public void testGroupedNamespaces() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
IProject project= getProject().getProject();
|
||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||
|
@ -252,7 +252,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
|||
//void Foo::foo() {}
|
||||
//}
|
||||
public void testGroupedMembersInGroupedNamespaces() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
IProject project= getProject().getProject();
|
||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||
|
|
|
@ -58,7 +58,7 @@ import org.eclipse.cdt.internal.ui.search.PDOMSearchViewPage;
|
|||
|
||||
public class BasicSearchTest extends BaseUITestCase {
|
||||
ICProject fCProject;
|
||||
StringBuffer[] testData;
|
||||
CharSequence[] testData;
|
||||
|
||||
public static TestSuite suite() {
|
||||
return suite(BasicSearchTest.class);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class LinkedNamesFinderTest extends AST2BaseTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected CharSequence[] getContents(int sections) throws IOException {
|
||||
CTestPlugin plugin = CTestPlugin.getDefault();
|
||||
if (plugin == null)
|
||||
throw new AssertionFailedError("This test must be run as a JUnit plugin test");
|
||||
|
|
|
@ -233,7 +233,7 @@ public class AbstractAutoEditTest extends BaseTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
protected StringBuffer[] getTestContents() {
|
||||
protected CharSequence[] getTestContents() {
|
||||
try {
|
||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 2);
|
||||
} catch(IOException ioe) {
|
||||
|
@ -242,7 +242,7 @@ public class AbstractAutoEditTest extends BaseTestCase {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected StringBuffer[] getTestContents1() {
|
||||
protected CharSequence[] getTestContents1() {
|
||||
try {
|
||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 1);
|
||||
} catch(IOException ioe) {
|
||||
|
|
|
@ -99,7 +99,7 @@ public class AddBlockCommentTest extends BaseUITestCase {
|
|||
*/
|
||||
protected void assertFormatterResult(LinePosition startLinePosition, LinePosition endLinePosition)
|
||||
throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
String before = contents[0].toString();
|
||||
String after = contents[1].toString();
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class CIndenterTest extends BaseUITestCase {
|
|||
|
||||
protected void assertIndenterResult() throws Exception {
|
||||
CCorePlugin.setOptions(fOptions);
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
IDocument document= new Document(before);
|
||||
String expected= contents[1].toString();
|
||||
|
|
|
@ -59,7 +59,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
}
|
||||
|
||||
protected void assertFormatterResult() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
String expected= contents[1].toString();
|
||||
assertFormatterResult(before, expected);
|
||||
|
|
|
@ -599,7 +599,7 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
|
|||
IDocument doc = new Document();
|
||||
textTools.setupCDocument(doc);
|
||||
|
||||
StringBuffer[] raw= getTestContents();
|
||||
CharSequence[] raw= getTestContents();
|
||||
String init= raw[0].toString(), expected= raw[1].toString();
|
||||
|
||||
int caretInit= init.indexOf('X');
|
||||
|
|
|
@ -81,7 +81,7 @@ public class RemoveBlockCommentTest extends BaseUITestCase {
|
|||
protected void assertFormatterResult(
|
||||
LinePosition startLinePosition,
|
||||
LinePosition endLinePosition) throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before = contents[0].toString();
|
||||
String after = contents[1].toString();
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ShiftActionTest extends BaseUITestCase {
|
|||
// for(;;) {
|
||||
// }
|
||||
public void testShiftRight() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
String after= contents[1].toString();
|
||||
fDocument.set(before);
|
||||
|
@ -150,7 +150,7 @@ public class ShiftActionTest extends BaseUITestCase {
|
|||
// for(;;) {
|
||||
//}
|
||||
public void testShiftLeft() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
String after= contents[1].toString();
|
||||
fDocument.set(before);
|
||||
|
|
|
@ -158,7 +158,7 @@ public class SortLinesTest extends BaseUITestCase {
|
|||
// // e.h
|
||||
// #include "e.h"
|
||||
public void testSortLinesMixed() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
String after= contents[1].toString();
|
||||
fDocument.set(before);
|
||||
|
@ -179,7 +179,7 @@ public class SortLinesTest extends BaseUITestCase {
|
|||
// * Callisto
|
||||
// */
|
||||
public void testSortLinesCommentsOnly() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
String after= contents[1].toString();
|
||||
fDocument.set(before);
|
||||
|
|
|
@ -81,7 +81,7 @@ public class TemplateFormatterTest extends BaseUITestCase {
|
|||
assertFormatterResult(false);
|
||||
}
|
||||
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 expected= contents[1].toString();
|
||||
final Document document = new Document(before);
|
||||
|
|
|
@ -192,7 +192,7 @@ public class CompletionTests extends AbstractContentAssistTest {
|
|||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||
fProject= project;
|
||||
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
||||
StringBuffer sourceContent= getContentsForTest(1)[0];
|
||||
StringBuilder sourceContent= getContentsForTest(1)[0];
|
||||
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n");
|
||||
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
||||
assertTrue("No cursor location specified", fCursorOffset >= 0);
|
||||
|
@ -955,7 +955,7 @@ public class CompletionTests extends AbstractContentAssistTest {
|
|||
// #include "header191315.h"
|
||||
// void xxx() { c_lin/*cursor*/
|
||||
public void testExternC_bug191315() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
CharSequence[] content= getContentsForTest(3);
|
||||
createFile(fProject, "header191315.h", content[0].toString());
|
||||
createFile(fProject, "source191315.c", content[1].toString());
|
||||
createFile(fProject, "source191315.cpp", content[1].toString());
|
||||
|
|
|
@ -173,7 +173,7 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
|||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||
fProject= project;
|
||||
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));
|
||||
sourceContent.insert(includeOffset, "#include \""+HEADER_FILE_NAME+"\"\n");
|
||||
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
||||
|
@ -309,7 +309,7 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
|||
// #include "header191315.h"
|
||||
// void xxx() { c_lin/*cursor*/
|
||||
public void testExternC_bug191315() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
CharSequence[] content= getContentsForTest(3);
|
||||
createFile(fProject, "header191315.h", content[0].toString());
|
||||
createFile(fProject, "source191315.c", content[1].toString());
|
||||
createFile(fProject, "source191315.cpp", content[1].toString());
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ParameterHintTests extends AbstractContentAssistTest {
|
|||
@Override
|
||||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
||||
StringBuffer sourceContent= getContentsForTest(1)[0];
|
||||
StringBuilder sourceContent= getContentsForTest(1)[0];
|
||||
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n");
|
||||
assertNotNull(createFile(project, HEADER_FILE_NAME, headerContent));
|
||||
return createFile(project, SOURCE_FILE_NAME, sourceContent.toString());
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ShowCamelCasePreferenceTest extends AbstractContentAssistTest {
|
|||
@Override
|
||||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||
fProject= project;
|
||||
StringBuffer sourceContent= getContentsForTest(1)[0];
|
||||
StringBuilder sourceContent= getContentsForTest(1)[0];
|
||||
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
||||
assertTrue("No cursor location specified", fCursorOffset >= 0);
|
||||
sourceContent.delete(fCursorOffset, fCursorOffset+CURSOR_LOCATION_TAG.length());
|
||||
|
|
|
@ -673,7 +673,7 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit
|
|||
final IDocument doc = new Document();
|
||||
textTools.setupCDocument(doc);
|
||||
|
||||
StringBuffer[] raw= getTestContents();
|
||||
CharSequence[] raw= getTestContents();
|
||||
String init= raw[0].toString(), expected= raw[1].toString();
|
||||
|
||||
int caretInit= init.indexOf('X');
|
||||
|
|
|
@ -74,7 +74,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
return cPrj;
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "ui", CPPSelectionTestsAnyIndexer.class, getName(), sections);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// return (0);
|
||||
// }
|
||||
public void testBug93281() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("test93281.h", hcode);
|
||||
|
@ -161,7 +161,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// return EXIT_SUCCESS;
|
||||
// }
|
||||
public void testBug207320() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("test.h", hcode);
|
||||
|
@ -187,7 +187,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// a.assign("aaa");
|
||||
// }
|
||||
public void testTemplateClassMethod_207320() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("test.h", hcode);
|
||||
|
@ -218,7 +218,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// class MyClass;
|
||||
// struct MyStruct;
|
||||
public void testBasicDefinition() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("basicDefinition.h", hcode);
|
||||
|
@ -299,7 +299,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// #include "testBasicTemplateInstance.h"
|
||||
// N::AAA<int> a;
|
||||
public void testBasicTemplateInstance_207320() throws Exception{
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
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
|
||||
// }
|
||||
public void testBug86829A() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
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()
|
||||
// }
|
||||
public void _testBug86829B() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug86829B.h", hcode);
|
||||
|
@ -408,7 +408,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// S s;
|
||||
// Int lhs= s.a+s.b+up+down+anX+0;
|
||||
public void testCPPSpecDeclsDefs() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testCPPSpecDeclsDefs.h", hcode);
|
||||
|
@ -559,7 +559,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// using N::d; // declares
|
||||
// int a= d;
|
||||
public void testBug168533() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug168533.h", hcode);
|
||||
|
@ -595,7 +595,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// }
|
||||
// }
|
||||
public void testBug95225() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug95225.h", hcode);
|
||||
|
@ -637,7 +637,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// return *this;
|
||||
// }
|
||||
public void testBug95202() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug95202.h", hcode);
|
||||
|
@ -661,7 +661,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// abc;
|
||||
// }
|
||||
public void testBug101287() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug101287.h", hcode);
|
||||
|
@ -687,7 +687,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// void f(RTBindingEnd & end) {
|
||||
// }
|
||||
public void testBug102258() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug102258.h", hcode);
|
||||
|
@ -715,7 +715,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// return foo::g();
|
||||
// }
|
||||
public void testBug103323() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug103323.h", hcode);
|
||||
|
@ -745,7 +745,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// return 0;
|
||||
// }
|
||||
public void testBug78354() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug78354.h", hcode);
|
||||
|
@ -776,7 +776,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// return x;
|
||||
// }
|
||||
public void testBug103697() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFileWithLink("testBug103697.h", hcode);
|
||||
|
@ -803,7 +803,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// return 0;
|
||||
// }
|
||||
public void testBug108202() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug108202.h", hcode);
|
||||
|
@ -830,7 +830,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// #include "cpp.h"
|
||||
// void cpp() {}
|
||||
public void testCNavigationInCppProject_bug183973() throws Exception {
|
||||
StringBuffer[] buffers= getContents(4);
|
||||
StringBuilder[] buffers= getContents(4);
|
||||
String hccode= buffers[0].toString();
|
||||
String ccode= buffers[1].toString();
|
||||
String hcppcode= buffers[2].toString();
|
||||
|
@ -870,7 +870,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// void func(usertype t) {
|
||||
// }
|
||||
public void testFuncWithTypedefForAnonymousStruct_190730() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug190730.h", hcode);
|
||||
|
@ -896,7 +896,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// void func(userEnum t) {
|
||||
// }
|
||||
public void testFuncWithTypedefForAnonymousEnum_190730() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug190730_2.h", hcode);
|
||||
|
@ -924,7 +924,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// MY_PAR(0);
|
||||
// }
|
||||
public void testMacroNavigation() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("macrodef.h", hcode);
|
||||
|
@ -959,7 +959,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// tester= MY_PAR(gvar);
|
||||
// }
|
||||
public void testMacroNavigation_Bug208300() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("macrodef.h", hcode);
|
||||
|
@ -988,7 +988,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
|
||||
// #include "aheader.h"
|
||||
public void testIncludeNavigation() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("aheader.h", hcode);
|
||||
|
@ -1014,7 +1014,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// cxcpp();
|
||||
// }
|
||||
public void testNavigationCppCallsC() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String ccode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile cfile = importFile("s.c", ccode);
|
||||
|
@ -1052,7 +1052,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// cppfunc();
|
||||
// }}
|
||||
public void testNavigationCCallsCpp() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String ccode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile cfile = importFile("s.c", ccode);
|
||||
|
@ -1087,7 +1087,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// #endif
|
||||
// }
|
||||
public void testNavigationInDefinedExpression_215906() throws Exception {
|
||||
StringBuffer[] buffers= getContents(1);
|
||||
StringBuilder[] buffers= getContents(1);
|
||||
String code= buffers[0].toString();
|
||||
IFile file = importFile("s.cpp", code);
|
||||
waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME);
|
||||
|
@ -1118,7 +1118,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// delete xx;
|
||||
// }
|
||||
public void testNavigationToImplicitNames() throws Exception {
|
||||
StringBuffer[] buffers= getContents(1);
|
||||
StringBuilder[] buffers= getContents(1);
|
||||
String code= buffers[0].toString();
|
||||
IFile file = importFile("in.cpp", code);
|
||||
waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME);
|
||||
|
@ -1157,7 +1157,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// a + 2;
|
||||
// }
|
||||
public void testBug272744() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("test.h", hcode);
|
||||
|
@ -1203,7 +1203,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
// A a3;
|
||||
// };
|
||||
public void testImplicitConstructorCall_248855() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testImplicitConstructorCall_248855.h", hcode);
|
||||
|
@ -1234,7 +1234,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
|
|||
|
||||
// #undef MYMACRO
|
||||
public void testUndef_312399() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testUndef_312399.h", hcode);
|
||||
|
|
|
@ -992,7 +992,7 @@ public class CPPSelectionTestsNoIndexer extends BaseUITestCase {
|
|||
// typedef int (functionPointerArray[2])(int);
|
||||
// functionPointerArray fctVariablArray;
|
||||
public void testBug195822() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
String code= contents[0].toString();
|
||||
String appendCode= contents[1].toString();
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
return cPrj;
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(
|
||||
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; }
|
||||
// struct MyStruct;
|
||||
public void testBasicDefinition() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("basicDefinition.h", hcode);
|
||||
|
@ -176,7 +176,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
// struct S s;
|
||||
// Int lhs= s.a+s.b+up+down+anX+0;
|
||||
public void testCPPSpecDeclsDefs() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testCPPSpecDeclsDefs.h", hcode);
|
||||
|
@ -288,7 +288,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
// abc;
|
||||
// }
|
||||
public void testBug101287() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug101287.h", hcode);
|
||||
|
@ -312,7 +312,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
// return x;
|
||||
// }
|
||||
public void testBug103697() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFileWithLink("testBug103697.h", hcode);
|
||||
|
@ -340,7 +340,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
// return 0;
|
||||
// }
|
||||
public void testBug78354() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug78354.h", hcode);
|
||||
|
@ -373,7 +373,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
// void func(usertype t) {
|
||||
// }
|
||||
public void testFuncWithTypedefForAnonymousStruct_190730() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug190730.h", hcode);
|
||||
|
@ -399,7 +399,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
// void func(userEnum t) {
|
||||
// }
|
||||
public void testFuncWithTypedefForAnonymousEnum_190730() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("testBug190730_2.h", hcode);
|
||||
|
@ -427,7 +427,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
// MY_PAR(0);
|
||||
// }
|
||||
public void testMacroNavigation() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("macrodef.h", hcode);
|
||||
|
@ -460,7 +460,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
// int tester = MY_PAR(MY_MACRO);
|
||||
// }
|
||||
public void testMacroNavigation_Bug208300() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("macrodef.h", hcode);
|
||||
|
@ -484,7 +484,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
|
||||
// #include "aheader.h"
|
||||
public void testIncludeNavigation() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("aheader.h", hcode);
|
||||
|
@ -504,7 +504,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
|
||||
// #define DR_ACCESS_FNS(DR)
|
||||
public void testNavigationInMacroDefinition_Bug102643() throws Exception {
|
||||
StringBuffer[] buffers= getContents(2);
|
||||
StringBuilder[] buffers= getContents(2);
|
||||
String hcode= buffers[0].toString();
|
||||
String scode= buffers[1].toString();
|
||||
IFile hfile = importFile("aheader.h", hcode);
|
||||
|
@ -533,7 +533,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
// return myFunc(0);
|
||||
// }
|
||||
public void testKRstyleFunctions_Bug221635() throws Exception {
|
||||
final StringBuffer[] contents = getContentsForTest(2);
|
||||
final StringBuilder[] contents = getContentsForTest(2);
|
||||
String hcode= contents[0].toString();
|
||||
String code= contents[1].toString();
|
||||
IFile hfile = importFile("aheader.h", hcode);
|
||||
|
@ -550,7 +550,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
|||
|
||||
// int x= __LINE__;
|
||||
public void testBuiltinMacro_Bug293864() throws Exception {
|
||||
final StringBuffer[] contents = getContentsForTest(1);
|
||||
final StringBuilder[] contents = getContentsForTest(1);
|
||||
String code= contents[0].toString();
|
||||
IFile file = importFile("source.c", code);
|
||||
int offset= code.indexOf("__LINE__");
|
||||
|
|
|
@ -85,7 +85,7 @@ public class TypeHierarchyAcrossProjectsTest extends TypeHierarchyBaseTest {
|
|||
// int method4();
|
||||
// };
|
||||
public void testSimpleInheritanceAcross() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(2);
|
||||
CharSequence[] content= getContentsForTest(2);
|
||||
String header= content[0].toString();
|
||||
String source = content[1].toString();
|
||||
IFile headerFile= createFile(fCProject.getProject(), "simpleHeader.h", header);
|
||||
|
|
|
@ -81,7 +81,7 @@ public class PDOMSearchPatternQuery extends PDOMSearchQuery {
|
|||
|
||||
// Parse the pattern string
|
||||
List<Pattern> patternList = new ArrayList<Pattern>();
|
||||
StringBuffer buff = new StringBuffer();
|
||||
StringBuilder buff = new StringBuilder();
|
||||
int n = patternStr.length();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
char c = patternStr.charAt(i);
|
||||
|
@ -114,7 +114,7 @@ public class PDOMSearchPatternQuery extends PDOMSearchQuery {
|
|||
patternList.add(Pattern.compile(buff.toString()));
|
||||
else
|
||||
patternList.add(Pattern.compile(buff.toString(),Pattern.CASE_INSENSITIVE));
|
||||
buff = new StringBuffer();
|
||||
buff = new StringBuilder();
|
||||
}
|
||||
break;
|
||||
case '|': case '+': case '^': case '(': case ')': case '[': case ']':
|
||||
|
|
Loading…
Add table
Reference in a new issue