From 7f0142b2e81ac09c1a2e95d4ecdf62dfab6636d1 Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Thu, 22 Jul 2004 19:32:56 +0000 Subject: [PATCH] Replacing strings with char arrays --- .../tests/ParserSymbolTableTemplateTests.java | 862 ++++++++-------- .../parser/tests/ParserSymbolTableTest.java | 959 +++++++++--------- .../parser/tests/scanner2/ObjectMapTest.java | 12 + .../core/parser/ast/ASTDesignator.java | 7 +- .../parser/ast/ASTQualifiedNamedElement.java | 16 +- .../core/parser/ast/BaseASTFactory.java | 2 +- .../core/parser/ast/GCCASTExtension.java | 4 +- .../parser/ast/complete/ASTASMDefinition.java | 6 +- .../parser/ast/complete/ASTBaseSpecifier.java | 2 +- .../ast/complete/ASTClassSpecifier.java | 4 +- .../ASTConstructorMemberInitializer.java | 7 +- .../complete/ASTElaboratedTypeSpecifier.java | 6 +- .../ast/complete/ASTEnumerationSpecifier.java | 2 +- .../parser/ast/complete/ASTEnumerator.java | 2 +- .../core/parser/ast/complete/ASTFunction.java | 2 +- .../parser/ast/complete/ASTIdExpression.java | 6 +- .../ast/complete/ASTLinkageSpecification.java | 6 +- .../ast/complete/ASTLiteralExpression.java | 6 +- .../core/parser/ast/complete/ASTMethod.java | 2 +- .../ast/complete/ASTNamespaceAlias.java | 8 +- .../ast/complete/ASTNamespaceDefinition.java | 2 +- .../core/parser/ast/complete/ASTNode.java | 4 +- .../ast/complete/ASTParameterDeclaration.java | 7 +- .../ast/complete/ASTSimpleTypeSpecifier.java | 6 +- .../ast/complete/ASTTemplateParameter.java | 8 +- .../core/parser/ast/complete/ASTTypeId.java | 12 +- .../core/parser/ast/complete/ASTTypedef.java | 2 +- .../core/parser/ast/complete/ASTVariable.java | 2 +- .../ast/complete/CompleteParseASTFactory.java | 208 ++-- .../ast/complete/ExpressionFactory.java | 2 +- .../gcc/ASTGCCSimpleTypeSpecifier.java | 2 +- .../expression/GCCASTExpressionExtension.java | 4 +- .../core/parser/ast/gcc/ASTGCCDesignator.java | 2 +- .../ast/quick/ASTElaboratedTypeSpecifier.java | 2 +- .../core/parser/ast/quick/ASTFunction.java | 2 +- .../core/parser/ast/quick/ASTMethod.java | 2 +- .../ast/quick/ASTNamespaceDefinition.java | 2 +- .../ast/quick/ASTScopedTypeSpecifier.java | 2 +- .../ast/quick/ASTTypedefDeclaration.java | 2 +- .../core/parser/ast/quick/ASTVariable.java | 2 +- .../internal/core/parser/pst/BasicSymbol.java | 10 +- .../core/parser/pst/BasicTypeInfo.java | 50 +- .../core/parser/pst/ContainerSymbol.java | 78 +- .../parser/pst/DeferredTemplateInstance.java | 2 +- .../parser/pst/DerivableContainerSymbol.java | 14 +- .../core/parser/pst/IContainerSymbol.java | 36 +- .../parser/pst/IDerivableContainerSymbol.java | 4 +- .../core/parser/pst/IParameterizedSymbol.java | 4 +- .../cdt/internal/core/parser/pst/ISymbol.java | 4 +- .../internal/core/parser/pst/ITypeInfo.java | 2 +- .../core/parser/pst/ParameterizedSymbol.java | 28 +- .../core/parser/pst/ParserSymbolTable.java | 138 +-- .../core/parser/pst/SpecializedSymbol.java | 2 +- .../core/parser/pst/TemplateEngine.java | 21 +- .../core/parser/pst/TemplateFactory.java | 44 +- .../core/parser/pst/TemplateSymbol.java | 10 +- .../parser/scanner2/CharArrayObjectMap.java | 298 +++++- .../core/parser/scanner2/CharArraySet.java | 295 ++++++ .../core/parser/scanner2/CharArrayUtils.java | 50 +- .../core/parser/scanner2/ObjectMap.java | 14 +- 60 files changed, 1978 insertions(+), 1322 deletions(-) create mode 100644 core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArraySet.java diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTemplateTests.java index a1b0f570802..83b972cb359 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTemplateTests.java @@ -72,20 +72,20 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void testTemplateParameterAsParent() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ - ISymbol param = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol param = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( param ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( A ); A.addParent( param ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ - ISymbol i = table.newSymbol( "i", ITypeInfo.t_int ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ + ISymbol i = table.newSymbol( "i".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ B.addSymbol( i ); table.getCompilationUnit().addSymbol( B ); @@ -93,22 +93,22 @@ public class ParserSymbolTableTemplateTests extends TestCase { ArrayList args = new ArrayList(); args.add( type ); - IContainerSymbol instance = (IContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + IContainerSymbol instance = (IContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertEquals( instance.getInstantiatedSymbol(), A ); - ISymbol a = table.newSymbol( "a", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ a.setTypeSymbol( instance ); table.getCompilationUnit().addSymbol( a ); - ISymbol look = table.getCompilationUnit().lookup( "a" ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookup( "a".toCharArray() ); //$NON-NLS-1$ assertEquals( look, a ); ISymbol symbol = a.getTypeSymbol(); assertEquals( symbol, instance ); - look = instance.lookup( "i" ); //$NON-NLS-1$ + look = instance.lookup( "i".toCharArray() ); //$NON-NLS-1$ assertEquals( look, i ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -126,45 +126,45 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void testTemplateInstanceAsParent() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ - ISymbol param = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol param = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( param ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( A ); - ISymbol t = table.newSymbol( "t", ITypeInfo.t_type ); //$NON-NLS-1$ - ISymbol look = template.lookup( "T" ); //$NON-NLS-1$ + ISymbol t = table.newSymbol( "t".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol look = template.lookup( "T".toCharArray() ); //$NON-NLS-1$ assertEquals( look, param ); t.setTypeSymbol( param ); A.addSymbol( t ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( B ); ITypeInfo type = TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0 , null ); ArrayList args = new ArrayList(); args.add( type ); - look = table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), A ); B.addParent( look ); - ISymbol b = table.newSymbol( "b", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol b = table.newSymbol( "b".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ b.setTypeSymbol( B ); table.getCompilationUnit().addSymbol( b ); - look = table.getCompilationUnit().lookup( "b" ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookup( "b".toCharArray() ); //$NON-NLS-1$ assertEquals( look, b ); - look = ((IDerivableContainerSymbol) b.getTypeSymbol()).lookup( "t" ); //$NON-NLS-1$ + look = ((IDerivableContainerSymbol) b.getTypeSymbol()).lookup( "t".toCharArray() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), t ); assertTrue( look.isType( ITypeInfo.t_int ) ); @@ -190,14 +190,14 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void testTemplateParameterDefaults() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "X" ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "X".toCharArray() ); //$NON-NLS-1$ - ISymbol paramT = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol paramT = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( paramT ); - ISymbol look = template.lookup( "T" ); //$NON-NLS-1$ + ISymbol look = template.lookup( "T".toCharArray() ); //$NON-NLS-1$ assertEquals( look, paramT ); - ISymbol paramU = table.newSymbol( "U" ); //$NON-NLS-1$ + ISymbol paramU = table.newSymbol( "U".toCharArray() ); //$NON-NLS-1$ paramU.setTypeInfo( TypeInfoProvider.newTypeInfo( ITypeInfo.t_templateParameter, 0, null, null, TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, look ) ) ); template.addTemplateParameter( paramU ); @@ -206,36 +206,36 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( X ); - look = X.lookup( "T" ); //$NON-NLS-1$ + look = X.lookup( "T".toCharArray() ); //$NON-NLS-1$ assertEquals( look, paramT ); - ISymbol t = table.newSymbol( "t", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol t = table.newSymbol( "t".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ t.setTypeSymbol( look ); X.addSymbol( t ); - look = X.lookup( "U" ); //$NON-NLS-1$ + look = X.lookup( "U".toCharArray() ); //$NON-NLS-1$ assertEquals( look, paramU ); - ISymbol u = table.newSymbol( "u", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol u = table.newSymbol( "u".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ u.setTypeSymbol( look ); X.addSymbol( u ); ITypeInfo type = TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ); ArrayList args = new ArrayList(); args.add( type ); - IDerivableContainerSymbol lookX = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "X", args ); //$NON-NLS-1$ + IDerivableContainerSymbol lookX = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "X".toCharArray(), args ); //$NON-NLS-1$ assertTrue( lookX.isTemplateInstance() ); assertEquals( lookX.getInstantiatedSymbol(), X ); - look = lookX.lookup( "t" ); //$NON-NLS-1$ + look = lookX.lookup( "t".toCharArray() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), t ); assertTrue( look.isType( ITypeInfo.t_char ) ); - look = lookX.lookup( "u" ); //$NON-NLS-1$ + look = lookX.lookup( "u".toCharArray() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), u ); assertTrue( look.isType( ITypeInfo.t_char ) ); @@ -260,58 +260,58 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void testTemplateParameterAsFunctionArgument() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ - ISymbol paramT = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol paramT = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( paramT ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( A ); - ISymbol t = table.newSymbol( "t", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol t = table.newSymbol( "t".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ t.setTypeSymbol( paramT ); A.addSymbol( t ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( B ); ArrayList args = new ArrayList(); ITypeInfo arg = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, B ); args.add( arg ); - IDerivableContainerSymbol lookA = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + IDerivableContainerSymbol lookA = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( lookA.isTemplateInstance() ); assertEquals( lookA.getInstantiatedSymbol(), A ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.addParameter( ITypeInfo.t_char, 0, null, false ); table.getCompilationUnit().addSymbol( f1 ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.addParameter( lookA, 0, null, false ); table.getCompilationUnit().addSymbol( f2 ); - IParameterizedSymbol f3 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f3 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f3.addParameter( ITypeInfo.t_int, 0, null, false ); table.getCompilationUnit().addSymbol( f3 ); args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, B ) ); - IDerivableContainerSymbol lookA2 = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + IDerivableContainerSymbol lookA2 = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertEquals( lookA2, lookA ); - ISymbol a = table.newSymbol( "a", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ a.setTypeSymbol( lookA ); table.getCompilationUnit().addSymbol( a ); ArrayList params = new ArrayList(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, a ) ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( look, f2 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -329,41 +329,41 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_1__3_ParameterLookup() throws Exception{ newTable(); - IDerivableContainerSymbol T = table.newDerivableContainerSymbol( "T", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol T = table.newDerivableContainerSymbol( "T".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( T ); - ISymbol i = table.newSymbol( "i", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol i = table.newSymbol( "i".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( i ); - ITemplateSymbol template = table.newTemplateSymbol( "f" ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "f".toCharArray() ); //$NON-NLS-1$ - ISymbol paramT = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol paramT = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( paramT ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - ISymbol parami = table.newSymbol( "i", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol parami = table.newSymbol( "i".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ parami.getTypeInfo().setTemplateParameterType( ITypeInfo.t_type ); - ISymbol look = factory.lookup( "T" ); //$NON-NLS-1$ + ISymbol look = factory.lookup( "T".toCharArray() ); //$NON-NLS-1$ assertEquals( look, paramT ); parami.setTypeSymbol( look ); template.addTemplateParameter( parami ); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ - ISymbol fParam = table.newSymbol( "t", ITypeInfo.t_type ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ + ISymbol fParam = table.newSymbol( "t".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ fParam.setTypeSymbol( paramT ); f.addParameter( fParam ); factory.addSymbol( f ); - look = f.lookup( "T" ); //$NON-NLS-1$ + look = f.lookup( "T".toCharArray() ); //$NON-NLS-1$ assertEquals( look, paramT ); - look = f.lookup( "i" ); //$NON-NLS-1$ + look = f.lookup( "i".toCharArray() ); //$NON-NLS-1$ assertEquals( look, parami ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -386,9 +386,9 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_1__8_ParameterAdjustment() throws Exception{ newTable(); - ITemplateSymbol templateR = table.newTemplateSymbol( "R" ); //$NON-NLS-1$ + ITemplateSymbol templateR = table.newTemplateSymbol( "R".toCharArray() ); //$NON-NLS-1$ - ISymbol paramA = table.newSymbol( "a", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol paramA = table.newSymbol( "a".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ paramA.getTypeInfo().setTemplateParameterType( ITypeInfo.t_int ); paramA.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ) ); templateR.addTemplateParameter( paramA ); @@ -397,12 +397,12 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( templateR ); - IDerivableContainerSymbol R = table.newDerivableContainerSymbol( "R", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol R = table.newDerivableContainerSymbol( "R".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ factory.addSymbol( R ); - ITemplateSymbol templateS = table.newTemplateSymbol( "S" ); //$NON-NLS-1$ + ITemplateSymbol templateS = table.newTemplateSymbol( "S".toCharArray() ); //$NON-NLS-1$ - ISymbol paramB = table.newSymbol( "b", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol paramB = table.newSymbol( "b".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ paramB.getTypeInfo().setTemplateParameterType( ITypeInfo.t_int ); paramB.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_array ) ); templateS.addTemplateParameter( paramB ); @@ -411,10 +411,10 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( templateS ); - IDerivableContainerSymbol S = table.newDerivableContainerSymbol( "S", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol S = table.newDerivableContainerSymbol( "S".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ factory.addSymbol( S ); - ISymbol look = table.getCompilationUnit().lookup( "S" ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookup( "S".toCharArray() ); //$NON-NLS-1$ assertEquals( look, templateS ); Iterator iter = templateS.getParameterList().iterator(); @@ -425,33 +425,33 @@ public class ParserSymbolTableTemplateTests extends TestCase { assertFalse( iter.hasNext() ); assertEquals( ptr.getType(), ITypeInfo.PtrOp.t_pointer ); - ISymbol p = table.newSymbol( "p", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol p = table.newSymbol( "p".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ p.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ) ); table.getCompilationUnit().addSymbol( p ); List args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, p ) ); - look = table.getCompilationUnit().lookupTemplateId( "R", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "R".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), R ); - look = table.getCompilationUnit().lookupTemplateId( "S", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "S".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), S ); - ISymbol v = table.newSymbol( "v", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol v = table.newSymbol( "v".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ v.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_array ) ); table.getCompilationUnit().addSymbol( v ); args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, v ) ); - look = table.getCompilationUnit().lookupTemplateId( "R", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "R".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), R ); - look = table.getCompilationUnit().lookupTemplateId( "S", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "S".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), S ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -469,9 +469,9 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_3__4_ParameterDefaults() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "String" ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "String".toCharArray() ); //$NON-NLS-1$ - ISymbol param = table.newSymbol( "T" ); //$NON-NLS-1$ + ISymbol param = table.newSymbol( "T".toCharArray() ); //$NON-NLS-1$ param.setTypeInfo( TypeInfoProvider.newTypeInfo( ITypeInfo.t_templateParameter, 0, null, null, TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ) )); template.addTemplateParameter( param ); @@ -480,11 +480,11 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol string = table.newDerivableContainerSymbol( "String", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol string = table.newDerivableContainerSymbol( "String".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( string ); List args = new ArrayList(); - ISymbol look = table.getCompilationUnit().lookupTemplateId( "String", args ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookupTemplateId( "String".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), string ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -506,25 +506,25 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_3_1__2_TypeArgumentRestrictions() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "X" ); //$NON-NLS-1$ - template.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "X".toCharArray() ); //$NON-NLS-1$ + template.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - factory.addSymbol( table.newDerivableContainerSymbol( "X", ITypeInfo.t_class ) ); //$NON-NLS-1$ + factory.addSymbol( table.newDerivableContainerSymbol( "X".toCharArray(), ITypeInfo.t_class ) ); //$NON-NLS-1$ - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( f ); - IDerivableContainerSymbol S = table.newDerivableContainerSymbol( "S", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol S = table.newDerivableContainerSymbol( "S".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ f.addSymbol( S ); List args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, S ) ); try{ - f.lookupTemplateId( "X", args ); //$NON-NLS-1$ + f.lookupTemplateId( "X".toCharArray(), args ); //$NON-NLS-1$ assertTrue( false ); } catch( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_BadTemplateArgument ); @@ -533,7 +533,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, S, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ) ); try{ - f.lookupTemplateId( "X", args ); //$NON-NLS-1$ + f.lookupTemplateId( "X".toCharArray(), args ); //$NON-NLS-1$ assertTrue( false ); } catch( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_BadTemplateArgument ); @@ -557,10 +557,10 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_3_2__2_NonTypeArgumentRestrictions() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "X" ); //$NON-NLS-1$ - template.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "X".toCharArray() ); //$NON-NLS-1$ + template.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ - ISymbol param2 = table.newSymbol( "p", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol param2 = table.newSymbol( "p".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ param2.getTypeInfo().setTemplateParameterType( ITypeInfo.t_char ); param2.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ) ); template.addTemplateParameter( param2 ); @@ -569,26 +569,26 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( X ); List args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); provider.beginTypeConstruction(); provider.setType( ITypeInfo.t_char ); - provider.setDefaultObj( "Studebaker" ); //$NON-NLS-1$ + provider.setDefaultObj( "Studebaker".toCharArray() ); //$NON-NLS-1$ ITypeInfo info = provider.completeConstruction(); info.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ) ); args.add( info ); //$NON-NLS-1$ try{ - table.getCompilationUnit().lookupTemplateId( "X", args ); //$NON-NLS-1$ + table.getCompilationUnit().lookupTemplateId( "X".toCharArray(), args ); //$NON-NLS-1$ assertTrue( false ); } catch( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_BadTemplateArgument ); } - ISymbol p = table.newSymbol( "p", ITypeInfo.t_char ); //$NON-NLS-1$ + ISymbol p = table.newSymbol( "p".toCharArray(), ITypeInfo.t_char ); //$NON-NLS-1$ p.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_array ) ); table.getCompilationUnit().addSymbol( p ); @@ -596,7 +596,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, p ) ); - ISymbol look = table.getCompilationUnit().lookupTemplateId( "X", args ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookupTemplateId( "X".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), X ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -623,9 +623,9 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_3_2__3_NonTypeArgumentRestrictions() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "X" ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "X".toCharArray() ); //$NON-NLS-1$ - ISymbol param = table.newSymbol( "p", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol param = table.newSymbol( "p".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ param.getTypeInfo().setTemplateParameterType( ITypeInfo.t_int ); param.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ) ); template.addTemplateParameter( param ); @@ -634,18 +634,18 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( X ); - IDerivableContainerSymbol S = table.newDerivableContainerSymbol( "S", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol S = table.newDerivableContainerSymbol( "S".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( S ); - ISymbol m = table.newSymbol( "m", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol m = table.newSymbol( "m".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ S.addSymbol( m ); - ISymbol s = table.newSymbol( "s", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol s = table.newSymbol( "s".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ s.getTypeInfo().setBit( true, ITypeInfo.isStatic ); S.addSymbol( s ); - ISymbol t = table.newSymbol( "t", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol t = table.newSymbol( "t".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ t.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ) ); S.addSymbol( t ); @@ -656,7 +656,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { try { - table.getCompilationUnit().lookupTemplateId( "X", args ); //$NON-NLS-1$ + table.getCompilationUnit().lookupTemplateId( "X".toCharArray(), args ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_BadTemplateArgument ); @@ -667,7 +667,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { try { - table.getCompilationUnit().lookupTemplateId( "X", args ); //$NON-NLS-1$ + table.getCompilationUnit().lookupTemplateId( "X".toCharArray(), args ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_BadTemplateArgument ); @@ -678,7 +678,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { arg.applyOperatorExpression( ITypeInfo.OperatorExpression.addressof ); args.add( arg ); - assertNotNull( table.getCompilationUnit().lookupTemplateId( "X", args ) ); //$NON-NLS-1$ + assertNotNull( table.getCompilationUnit().lookupTemplateId( "X".toCharArray(), args ) ); //$NON-NLS-1$ assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -697,9 +697,9 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_3_2__4_NonTypeArgumentRestrictions() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "B" ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "B".toCharArray() ); //$NON-NLS-1$ - ISymbol I = table.newSymbol( "I", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol I = table.newSymbol( "I".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ I.getTypeInfo().setTemplateParameterType( ITypeInfo.t_int ); I.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference, true, false ) ); template.addTemplateParameter( I ); @@ -708,25 +708,25 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ factory.addSymbol( B ); List args = new ArrayList( ); - args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "1" ) ); //$NON-NLS-1$ + args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "1".toCharArray() ) ); //$NON-NLS-1$ try{ - table.getCompilationUnit().lookupTemplateId( "B", args ); //$NON-NLS-1$ + table.getCompilationUnit().lookupTemplateId( "B".toCharArray(), args ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_BadTemplateArgument ); } - ISymbol c = table.newSymbol( "c", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol c = table.newSymbol( "c".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( c ); args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, c ) ); - ISymbol look = table.getCompilationUnit().lookupTemplateId( "B", args ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookupTemplateId( "B".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), B ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -755,53 +755,53 @@ public class ParserSymbolTableTemplateTests extends TestCase { //TODO newTable(); - ITemplateSymbol templateA = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ + ITemplateSymbol templateA = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( templateA ); - templateA.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + templateA.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ - IDerivableContainerSymbol A1 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A1 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ templateA.addSymbol( A1 ); - ISymbol x1 = table.newSymbol( "x", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol x1 = table.newSymbol( "x".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ A1.addSymbol( x1 ); - ISpecializedSymbol specialization = table.newSpecializedSymbol( "A" ); //$NON-NLS-1$ + ISpecializedSymbol specialization = table.newSpecializedSymbol( "A".toCharArray() ); //$NON-NLS-1$ templateA.addSpecialization( specialization ); - ISymbol T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ specialization.addTemplateParameter( T ); specialization.addArgument( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, T, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ) ); - IDerivableContainerSymbol A2 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A2 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ specialization.addSymbol( A2 ); - ISymbol x2 = table.newSymbol( "x", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol x2 = table.newSymbol( "x".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ x2.getTypeInfo().setBit( true, ITypeInfo.isLong ); A2.addSymbol( x2 ); - ITemplateSymbol templateC = table.newTemplateSymbol( "C" ); //$NON-NLS-1$ + ITemplateSymbol templateC = table.newTemplateSymbol( "C".toCharArray() ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( templateC ); - ITemplateSymbol templateV = table.newTemplateSymbol( "V" ); //$NON-NLS-1$ + ITemplateSymbol templateV = table.newTemplateSymbol( "V".toCharArray() ); //$NON-NLS-1$ templateV.setTypeInfo( TypeInfoProvider.newTypeInfo( ITypeInfo.t_templateParameter ) ); templateV.getTypeInfo().setTemplateParameterType( ITypeInfo.t_template ); - ISymbol U = table.newSymbol( "U", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol U = table.newSymbol( "U".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ templateV.addTemplateParameter( U ); templateC.addTemplateParameter( templateV ); - IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ templateC.addSymbol( C ); List args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - ISymbol look = templateC.lookupTemplateId( "V", args ); //$NON-NLS-1$ + ISymbol look = templateC.lookupTemplateId( "V".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look != null ); assertTrue( look instanceof IDeferredTemplateInstance ); - ISymbol y = table.newSymbol( "y", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol y = table.newSymbol( "y".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ y.setTypeSymbol( look ); C.addSymbol( y ); @@ -809,25 +809,25 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ) ); - look = templateC.lookupTemplateId( "V", args ); //$NON-NLS-1$ + look = templateC.lookupTemplateId( "V".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look != null ); assertTrue( look instanceof IDeferredTemplateInstance ); - ISymbol z = table.newSymbol( "z", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol z = table.newSymbol( "z".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ z.setTypeSymbol( look ); C.addSymbol( z ); - look = table.getCompilationUnit().lookup( "A" ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookup( "A".toCharArray() ); //$NON-NLS-1$ assertEquals( look, templateA ); args.clear(); args.add ( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, look ) ); - look = table.getCompilationUnit().lookupTemplateId( "C", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "C".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), C ); IDerivableContainerSymbol lookC = (IDerivableContainerSymbol)look; - look = lookC.lookup( "y" ); //$NON-NLS-1$ + look = lookC.lookup( "y".toCharArray() ); //$NON-NLS-1$ assertEquals( look.getType(), ITypeInfo.t_type ); ISymbol symbol = look.getTypeSymbol(); @@ -835,18 +835,18 @@ public class ParserSymbolTableTemplateTests extends TestCase { assertTrue( symbol.isTemplateInstance() ); assertEquals( symbol.getInstantiatedSymbol(), A1 ); - look = ((IContainerSymbol) symbol).lookup( "x" ); //$NON-NLS-1$ + look = ((IContainerSymbol) symbol).lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( look.getType(), ITypeInfo.t_int ); assertEquals( look.getTypeInfo().checkBit( ITypeInfo.isLong ), false ); - look = lookC.lookup( "z" ); //$NON-NLS-1$ + look = lookC.lookup( "z".toCharArray() ); //$NON-NLS-1$ assertEquals( look.getType(), ITypeInfo.t_type ); symbol = look.getTypeSymbol(); assertTrue( symbol instanceof IContainerSymbol ); assertTrue( symbol.isTemplateInstance() ); assertEquals( symbol.getInstantiatedSymbol(), A2 ); - look = ((IContainerSymbol)symbol).lookup( "x" ); //$NON-NLS-1$ + look = ((IContainerSymbol)symbol).lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( look.getType(), ITypeInfo.t_int ); assertEquals( look.getTypeInfo().checkBit( ITypeInfo.isLong ), true ); @@ -869,9 +869,9 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_5_1__3_MemberFunctions() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME ); - ISymbol primaryT1 = table.newSymbol( "T1", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol primaryT2 = table.newSymbol( "T2", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); + ISymbol primaryT1 = table.newSymbol( "T1".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol primaryT2 = table.newSymbol( "T2".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( primaryT1 ); template.addTemplateParameter( primaryT2 ); @@ -879,27 +879,27 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( A ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f1", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f1".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ - ISymbol look = A.lookup( "T1" ); //$NON-NLS-1$ + ISymbol look = A.lookup( "T1".toCharArray() ); //$NON-NLS-1$ assertEquals( look, primaryT1 ); f1.setIsForwardDeclaration( true ); f1.setReturnType( look ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f2", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f2".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.setIsForwardDeclaration( true ); A.addSymbol( f1 ); A.addSymbol( f2 ); - ITemplateSymbol temp = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME ); - ISymbol U = table.newSymbol( "U", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol V = table.newSymbol( "V", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol temp = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); + ISymbol U = table.newSymbol( "U".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol V = table.newSymbol( "V".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ temp.addTemplateParameter( U ); temp.addTemplateParameter( V ); @@ -907,22 +907,22 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( temp ); - ISymbol returnType = factory.lookup( "U" ); //$NON-NLS-1$ + ISymbol returnType = factory.lookup( "U".toCharArray() ); //$NON-NLS-1$ assertEquals( returnType, U ); List args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, U ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, V ) ); - look = factory.lookupTemplateIdForDefinition( "A", args ); //$NON-NLS-1$ + look = factory.lookupTemplateIdForDefinition( "A".toCharArray(), args ); //$NON-NLS-1$ assertEquals( look, A ); factory.pushTemplateId( look, args ); - IParameterizedSymbol lookF = factory.lookupMethodForDefinition( "f1", new ArrayList() ); //$NON-NLS-1$ + IParameterizedSymbol lookF = factory.lookupMethodForDefinition( "f1".toCharArray(), new ArrayList() ); //$NON-NLS-1$ assertEquals( lookF, f1 ); assertTrue( lookF.isForwardDeclaration() ); - IParameterizedSymbol defnd = table.newParameterizedSymbol( "f1", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol defnd = table.newParameterizedSymbol( "f1".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.setForwardSymbol( defnd ); defnd.setReturnType( returnType ); factory.addSymbol( defnd ); @@ -932,12 +932,12 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ) ); - IDerivableContainerSymbol lookA = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + IDerivableContainerSymbol lookA = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( lookA.isTemplateInstance() ); assertEquals( lookA.getInstantiatedSymbol(), A ); List params = new ArrayList(); - look = lookA.qualifiedFunctionLookup( "f1", params ); //$NON-NLS-1$ + look = lookA.qualifiedFunctionLookup( "f1".toCharArray(), params ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), defnd ); assertTrue( ((IParameterizedSymbol)look).getReturnType().isType( ITypeInfo.t_int ) ); @@ -945,9 +945,9 @@ public class ParserSymbolTableTemplateTests extends TestCase { params.clear(); args.clear(); - temp = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME ); - ISymbol X = table.newSymbol( "X", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol Y = table.newSymbol( "Y", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + temp = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); + ISymbol X = table.newSymbol( "X".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol Y = table.newSymbol( "Y".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ temp.addTemplateParameter( X ); temp.addTemplateParameter( Y ); @@ -959,7 +959,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, X ) ); try{ - look = factory.lookupTemplateIdForDefinition( "A", args ); //$NON-NLS-1$ + look = factory.lookupTemplateIdForDefinition( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_BadTemplate ); @@ -979,23 +979,23 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_5_1_2_MemberClass() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ - ISymbol primaryT = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol primaryT = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( primaryT ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ factory.addSymbol( A ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ B.setIsForwardDeclaration( true ); A.addSymbol( B ); - ISymbol U = table.newSymbol( "U", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ITemplateSymbol temp = table.newTemplateSymbol( "" ); //$NON-NLS-1$ + ISymbol U = table.newSymbol( "U".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol temp = table.newTemplateSymbol( "".toCharArray() ); //$NON-NLS-1$ temp.addTemplateParameter( U ); factory = table.newTemplateFactory(); @@ -1005,20 +1005,20 @@ public class ParserSymbolTableTemplateTests extends TestCase { List args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, U ) ); - IContainerSymbol lookA = factory.lookupTemplateIdForDefinition( "A", args ); //$NON-NLS-1$ + IContainerSymbol lookA = factory.lookupTemplateIdForDefinition( "A".toCharArray(), args ); //$NON-NLS-1$ assertEquals( lookA, A ); factory.pushTemplateId( lookA, args ); - ISymbol look = lookA.lookupMemberForDefinition( "B" ); //$NON-NLS-1$ + ISymbol look = lookA.lookupMemberForDefinition( "B".toCharArray() ); //$NON-NLS-1$ assertEquals( look, B ); - IDerivableContainerSymbol newB = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol newB = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ look.setForwardSymbol( newB ); factory.addSymbol( newB ); - ISymbol i = table.newSymbol( "i", ITypeInfo.t_type ); //$NON-NLS-1$ - look = newB.lookup( "U" ); //$NON-NLS-1$ + ISymbol i = table.newSymbol( "i".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ + look = newB.lookup( "U".toCharArray() ); //$NON-NLS-1$ assertEquals( look, U ); i.setTypeSymbol( U ); newB.addSymbol( i ); @@ -1026,18 +1026,18 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - look = table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), A ); assertTrue( look instanceof IDerivableContainerSymbol ); lookA = (IDerivableContainerSymbol) look; - look = lookA.qualifiedLookup( "B" ); //$NON-NLS-1$ + look = lookA.qualifiedLookup( "B".toCharArray() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), newB ); - look = ((IDerivableContainerSymbol) look).lookup( "i" ); //$NON-NLS-1$ + look = ((IDerivableContainerSymbol) look).lookup( "i".toCharArray() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), i ); assertEquals( look.getType(), ITypeInfo.t_int ); @@ -1056,28 +1056,28 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_5_1_3_StaticDataMember() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "X" ); //$NON-NLS-1$ - ISymbol T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "X".toCharArray() ); //$NON-NLS-1$ + ISymbol T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( T ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( X ); - ISymbol look = X.lookup( "T" ); //$NON-NLS-1$ + ISymbol look = X.lookup( "T".toCharArray() ); //$NON-NLS-1$ assertEquals( look, T ); - ISymbol s = table.newSymbol( "s", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol s = table.newSymbol( "s".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ s.setTypeSymbol( look ); s.getTypeInfo().setBit( true, ITypeInfo.isStatic ); s.setIsForwardDeclaration( true ); X.addSymbol( s ); - ITemplateSymbol temp = table.newTemplateSymbol( "" ); //$NON-NLS-1$ - ISymbol paramU = table.newSymbol( "U", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol temp = table.newTemplateSymbol( "".toCharArray() ); //$NON-NLS-1$ + ISymbol paramU = table.newSymbol( "U".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ temp.addTemplateParameter( paramU ); factory = table.newTemplateFactory(); @@ -1087,15 +1087,15 @@ public class ParserSymbolTableTemplateTests extends TestCase { List args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, paramU ) ); - look = factory.lookupTemplateIdForDefinition( "X", args ); //$NON-NLS-1$ + look = factory.lookupTemplateIdForDefinition( "X".toCharArray(), args ); //$NON-NLS-1$ assertEquals( look, X ); factory.pushTemplateId( X, args ); - look = ((IContainerSymbol)look).lookupMemberForDefinition("s" ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).lookupMemberForDefinition("s".toCharArray() ); //$NON-NLS-1$ assertEquals( look, s ); assertTrue( look.isForwardDeclaration() ); - ISymbol newS = table.newSymbol( "s", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol newS = table.newSymbol( "s".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ newS.setTypeSymbol( paramU ); look.setForwardSymbol( newS ); @@ -1105,12 +1105,12 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_float, 0, null ) ); - look = table.getCompilationUnit().lookupTemplateId( "X", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "X".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), X ); - look = ((IContainerSymbol)look).qualifiedLookup( "s" ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).qualifiedLookup( "s".toCharArray() ); //$NON-NLS-1$ assertTrue( look.isType( ITypeInfo.t_float ) ); assertTrue( look.isTemplateInstance() ); @@ -1131,74 +1131,74 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_5_2__1_MemberTemplates() throws Exception{ newTable(); - ITemplateSymbol template1 = table.newTemplateSymbol( "string" ); //$NON-NLS-1$ - template1.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template1 = table.newTemplateSymbol( "string".toCharArray() ); //$NON-NLS-1$ + template1.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template1 ); - IDerivableContainerSymbol string = table.newDerivableContainerSymbol( "string", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol string = table.newDerivableContainerSymbol( "string".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( string ); - ITemplateSymbol template2 = table.newTemplateSymbol( "compare" ); //$NON-NLS-1$ - ISymbol T2 = table.newSymbol( "T2", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template2 = table.newTemplateSymbol( "compare".toCharArray() ); //$NON-NLS-1$ + ISymbol T2 = table.newSymbol( "T2".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template2.addTemplateParameter( T2 ); factory = table.newTemplateFactory(); factory.setContainingSymbol( string ); factory.pushTemplate( template2 ); - IParameterizedSymbol compare = table.newParameterizedSymbol( "compare", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol compare = table.newParameterizedSymbol( "compare".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ compare.setIsForwardDeclaration( true ); compare.addParameter( T2, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference, true, false ), false ); - ISymbol returnType = table.newSymbol( "", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol returnType = table.newSymbol( "".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ returnType.setTypeSymbol( T2 ); compare.setReturnType( returnType ); factory.addSymbol( compare ); - ITemplateSymbol temp = table.newTemplateSymbol( "" ); //$NON-NLS-1$ - ISymbol U = table.newSymbol( "U", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol temp = table.newTemplateSymbol( "".toCharArray() ); //$NON-NLS-1$ + ISymbol U = table.newSymbol( "U".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ temp.addTemplateParameter( U ); factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( temp ); - ITemplateSymbol temp2 = table.newTemplateSymbol( "" ); //$NON-NLS-1$ - ISymbol V = table.newSymbol( "V", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol temp2 = table.newTemplateSymbol( "".toCharArray() ); //$NON-NLS-1$ + ISymbol V = table.newSymbol( "V".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ temp2.addTemplateParameter( V ); factory.pushTemplate( temp2 ); - ISymbol lookV = factory.lookup( "V" ); //$NON-NLS-1$ + ISymbol lookV = factory.lookup( "V".toCharArray() ); //$NON-NLS-1$ assertEquals( lookV, V ); List args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, U ) ); - ISymbol look = factory.lookupTemplateIdForDefinition( "string", args ); //$NON-NLS-1$ + ISymbol look = factory.lookupTemplateIdForDefinition( "string".toCharArray(), args ); //$NON-NLS-1$ assertEquals( look, string ); factory.pushTemplateId( look, args ); args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, lookV, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference, true, false ), false ) ); - look = ((IContainerSymbol)look).lookupMethodForDefinition( "compare", args ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).lookupMethodForDefinition( "compare".toCharArray(), args ); //$NON-NLS-1$ assertEquals( look, compare ); - IParameterizedSymbol compareDef = table.newParameterizedSymbol( "compare", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol compareDef = table.newParameterizedSymbol( "compare".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ compareDef.addParameter( lookV, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference, true, false ), false ); - ISymbol defReturn = table.newSymbol( "", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol defReturn = table.newSymbol( "".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ defReturn.setTypeSymbol( lookV ); compareDef.setReturnType( defReturn ); compare.setForwardSymbol( compareDef ); factory.addSymbol( compareDef ); - look = compareDef.lookup( "U" ); //$NON-NLS-1$ + look = compareDef.lookup( "U".toCharArray() ); //$NON-NLS-1$ assertEquals( look, U ); - ISymbol u = table.newSymbol( "u", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol u = table.newSymbol( "u".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ u.setTypeSymbol( look ); compareDef.addSymbol( u ); @@ -1206,18 +1206,18 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - look = table.getCompilationUnit().lookupTemplateId( "string", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "string".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), string ); - look = ((IDerivableContainerSymbol)look).lookupTemplateId( "compare", args ); //$NON-NLS-1$ + look = ((IDerivableContainerSymbol)look).lookupTemplateId( "compare".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertTrue( look.getInstantiatedSymbol().isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol().getInstantiatedSymbol(), compareDef ); assertTrue( ((IParameterizedSymbol)look).getReturnType().isType( ITypeInfo.t_int ) ); - look = ((IContainerSymbol)look).lookup( "u" ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).lookup( "u".toCharArray() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertTrue( look.getInstantiatedSymbol().isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol().getInstantiatedSymbol(), u ); @@ -1237,25 +1237,25 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_5_2__3_VirtualMemberFunctionTemplate() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ - template.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ + template.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ factory.addSymbol( A ); - ITemplateSymbol memberTemplate = table.newTemplateSymbol( "g" ); //$NON-NLS-1$ - ISymbol C = table.newSymbol( "C", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol memberTemplate = table.newTemplateSymbol( "g".toCharArray() ); //$NON-NLS-1$ + ISymbol C = table.newSymbol( "C".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ memberTemplate.addTemplateParameter( C ); factory = table.newTemplateFactory(); factory.setContainingSymbol( A ); factory.pushTemplate( memberTemplate ); - IParameterizedSymbol g = table.newParameterizedSymbol( "g", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol g = table.newParameterizedSymbol( "g".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ g.addParameter( C, 0, null, false ); g.getTypeInfo().setBit( true, ITypeInfo.isVirtual ); @@ -1266,7 +1266,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { assertEquals( e.reason, ParserSymbolTableException.r_BadTemplate ); } - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f.getTypeInfo().setBit( true, ITypeInfo.isVirtual ); A.addSymbol( f ); @@ -1298,30 +1298,30 @@ public class ParserSymbolTableTemplateTests extends TestCase { //TODO newTable(); - IContainerSymbol N = table.newContainerSymbol( "N", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol N = table.newContainerSymbol( "N".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( N ); - ITemplateSymbol template = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ - template.addTemplateParameter( table.newSymbol( "T1", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ - template.addTemplateParameter( table.newSymbol( "T2", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + template.addTemplateParameter( table.newSymbol( "T1".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + template.addTemplateParameter( table.newSymbol( "T2".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ - IDerivableContainerSymbol A1 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A1 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ template.addSymbol( A1 ); N.addSymbol( template ); - table.getCompilationUnit().addUsingDeclaration( "A", N ); //$NON-NLS-1$ + table.getCompilationUnit().addUsingDeclaration( "A".toCharArray(), N ); //$NON-NLS-1$ - ISpecializedSymbol spec = table.newSpecializedSymbol( "A" ); //$NON-NLS-1$ - ISymbol T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISpecializedSymbol spec = table.newSpecializedSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ spec.addTemplateParameter( T ); spec.addArgument( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, T ) ); spec.addArgument( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, T, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ) ); - IDerivableContainerSymbol A2 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A2 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ spec.addSymbol( A2 ); template.addSpecialization( spec ); @@ -1329,7 +1329,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ) ); - ISymbol look = table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look != null ); assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), A2 ); @@ -1356,16 +1356,16 @@ public class ParserSymbolTableTemplateTests extends TestCase { //TODO newTable(); - IDerivableContainerSymbol cls1 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ - IDerivableContainerSymbol cls2 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ - IDerivableContainerSymbol cls3 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ - IDerivableContainerSymbol cls4 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ - IDerivableContainerSymbol cls5 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol cls1 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol cls2 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol cls3 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol cls4 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol cls5 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ - ITemplateSymbol template1 = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ - ISymbol T1p1 = table.newSymbol( "T1", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol T1p2 = table.newSymbol( "T2", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol T1p3 = table.newSymbol( "I", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template1 = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol T1p1 = table.newSymbol( "T1".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol T1p2 = table.newSymbol( "T2".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol T1p3 = table.newSymbol( "I".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ T1p3.getTypeInfo().setTemplateParameterType( ITypeInfo.t_int ); template1.addTemplateParameter( T1p1 ); @@ -1374,9 +1374,9 @@ public class ParserSymbolTableTemplateTests extends TestCase { template1.addSymbol( cls1 ); table.getCompilationUnit().addSymbol( template1 ); - ISpecializedSymbol template2 = table.newSpecializedSymbol( "A" ); //$NON-NLS-1$ - ISymbol T2p1 = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol T2p2 = table.newSymbol( "I", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISpecializedSymbol template2 = table.newSpecializedSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol T2p1 = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol T2p2 = table.newSymbol( "I".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ T2p2.getTypeInfo().setTemplateParameterType( ITypeInfo.t_int ); template2.addTemplateParameter( T2p1 ); @@ -1392,10 +1392,10 @@ public class ParserSymbolTableTemplateTests extends TestCase { template2.addSymbol( cls2 ); template1.addSpecialization( template2 ); - ISpecializedSymbol template3 = table.newSpecializedSymbol( "A" ); //$NON-NLS-1$ - ISymbol T3p1 = table.newSymbol( "T1", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol T3p2 = table.newSymbol( "T2", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol T3p3 = table.newSymbol( "I", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISpecializedSymbol template3 = table.newSpecializedSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol T3p1 = table.newSymbol( "T1".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol T3p2 = table.newSymbol( "T2".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol T3p3 = table.newSymbol( "I".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ T3p3.getTypeInfo().setTemplateParameterType( ITypeInfo.t_int ); template3.addTemplateParameter( T3p1 ); @@ -1412,13 +1412,13 @@ public class ParserSymbolTableTemplateTests extends TestCase { template3.addSymbol( cls3 ); template1.addSpecialization( template3 ); - ISpecializedSymbol template4 = table.newSpecializedSymbol( "A" ); //$NON-NLS-1$ - ISymbol T4p1 = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISpecializedSymbol template4 = table.newSpecializedSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol T4p1 = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template4.addTemplateParameter( T4p1 ); ITypeInfo T4a1 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ); ITypeInfo T4a2 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, T4p1, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); - ITypeInfo T4a3 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "5" ); //$NON-NLS-1$ + ITypeInfo T4a3 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "5".toCharArray() ); //$NON-NLS-1$ template4.addArgument( T4a1 ); template4.addArgument( T4a2 ); @@ -1426,10 +1426,10 @@ public class ParserSymbolTableTemplateTests extends TestCase { template4.addSymbol( cls4 ); template1.addSpecialization( template4 ); - ISpecializedSymbol template5 = table.newSpecializedSymbol( "A" ); //$NON-NLS-1$ - ISymbol T5p1 = table.newSymbol( "T1", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol T5p2 = table.newSymbol( "T2", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol T5p3 = table.newSymbol( "I", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISpecializedSymbol template5 = table.newSpecializedSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol T5p1 = table.newSymbol( "T1".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol T5p2 = table.newSymbol( "T2".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol T5p3 = table.newSymbol( "I".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ T5p3.getTypeInfo().setTemplateParameterType( ITypeInfo.t_int ); template5.addTemplateParameter( T5p1 ); @@ -1446,14 +1446,14 @@ public class ParserSymbolTableTemplateTests extends TestCase { template5.addSymbol( cls5 ); template1.addSpecialization( template5 ); - ITemplateSymbol a = (ITemplateSymbol) table.getCompilationUnit().lookup( "A" ); //$NON-NLS-1$ + ITemplateSymbol a = (ITemplateSymbol) table.getCompilationUnit().lookup( "A".toCharArray() ); //$NON-NLS-1$ assertEquals( a, template1 ); ArrayList args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "1" ) ); //$NON-NLS-1$ + args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "1".toCharArray() ) ); //$NON-NLS-1$ IContainerSymbol a1 = (IContainerSymbol) a.instantiate( args ); assertTrue( a1.isTemplateInstance() ); @@ -1462,7 +1462,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ) ); - args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "1" ) ); //$NON-NLS-1$ + args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "1".toCharArray() ) ); //$NON-NLS-1$ IContainerSymbol a2 = (IContainerSymbol) a.instantiate( args ); assertTrue( a2.isTemplateInstance() ); @@ -1471,7 +1471,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ) ); - args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "5" ) ); //$NON-NLS-1$ + args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "5".toCharArray() ) ); //$NON-NLS-1$ IContainerSymbol a3 = (IContainerSymbol) a.instantiate( args ); assertTrue( a3.isTemplateInstance() ); assertEquals( a3.getInstantiatedSymbol(), cls4 ); @@ -1479,7 +1479,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ) ); - args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "1" ) ); //$NON-NLS-1$ + args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "1".toCharArray() ) ); //$NON-NLS-1$ IContainerSymbol a4 = (IContainerSymbol) a.instantiate( args ); assertTrue( a4.isTemplateInstance() ); assertEquals( a4.getInstantiatedSymbol(), cls5 ); @@ -1487,7 +1487,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ) ); - args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "2" ) ); //$NON-NLS-1$ + args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null, null, "2".toCharArray() ) ); //$NON-NLS-1$ try{ a.instantiate( args ); @@ -1512,43 +1512,43 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_5_5_2__5_OrderingFunctionTemplates_1() throws Exception{ newTable(); - ITemplateSymbol template1 = table.newTemplateSymbol( "f" ); //$NON-NLS-1$ - template1.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template1 = table.newTemplateSymbol( "f".toCharArray() ); //$NON-NLS-1$ + template1.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template1 ); - ISymbol T = template1.lookup( "T" ); //$NON-NLS-1$ - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + ISymbol T = template1.lookup( "T".toCharArray() ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.addParameter( T, 0, null, false ); factory.addSymbol( f1 ); - ITemplateSymbol template2 = table.newTemplateSymbol( "f" ); //$NON-NLS-1$ - template2.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template2 = table.newTemplateSymbol( "f".toCharArray() ); //$NON-NLS-1$ + template2.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template2 ); - T = template2.lookup( "T" ); //$NON-NLS-1$ - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + T = template2.lookup( "T".toCharArray() ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.addParameter( T, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); factory.addSymbol( f2 ); - ITemplateSymbol template3 = table.newTemplateSymbol( "f" ); //$NON-NLS-1$ - template3.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template3 = table.newTemplateSymbol( "f".toCharArray() ); //$NON-NLS-1$ + template3.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template3 ); - T = template3.lookup( "T" ); //$NON-NLS-1$ - IParameterizedSymbol f3 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + T = template3.lookup( "T".toCharArray() ); //$NON-NLS-1$ + IParameterizedSymbol f3 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f3.addParameter( T, ITypeInfo.isConst, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer, false, false ), false ); factory.addSymbol( f3 ); - ISymbol p = table.newSymbol( "p", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol p = table.newSymbol( "p".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ p.getTypeInfo().setBit( true, ITypeInfo.isConst ); p.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer, false, false ) ); table.getCompilationUnit().addSymbol( p ); @@ -1556,7 +1556,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { List params = new ArrayList(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, p ) ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), f3 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -1574,35 +1574,35 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_5_5_2__5_OrderingFunctionTemplates_2() throws Exception{ newTable(); - ITemplateSymbol template1 = table.newTemplateSymbol( "g" ); //$NON-NLS-1$ - template1.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template1 = table.newTemplateSymbol( "g".toCharArray() ); //$NON-NLS-1$ + template1.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template1 ); - ISymbol T = template1.lookup( "T" ); //$NON-NLS-1$ - IParameterizedSymbol g1 = table.newParameterizedSymbol( "g", ITypeInfo.t_function ); //$NON-NLS-1$ + ISymbol T = template1.lookup( "T".toCharArray() ); //$NON-NLS-1$ + IParameterizedSymbol g1 = table.newParameterizedSymbol( "g".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ g1.addParameter( T, 0, null, false ); factory.addSymbol( g1 ); - ITemplateSymbol template2 = table.newTemplateSymbol( "g" ); //$NON-NLS-1$ - template2.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template2 = table.newTemplateSymbol( "g".toCharArray() ); //$NON-NLS-1$ + template2.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template2 ); - T = template2.lookup( "T" ); //$NON-NLS-1$ - IParameterizedSymbol g2 = table.newParameterizedSymbol( "g", ITypeInfo.t_function ); //$NON-NLS-1$ + T = template2.lookup( "T".toCharArray() ); //$NON-NLS-1$ + IParameterizedSymbol g2 = table.newParameterizedSymbol( "g".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ g2.addParameter( T, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference ), false ); factory.addSymbol( g2 ); - ISymbol x = table.newSymbol( "x", ITypeInfo.t_float ); //$NON-NLS-1$ + ISymbol x = table.newSymbol( "x".toCharArray(), ITypeInfo.t_float ); //$NON-NLS-1$ List params = new ArrayList(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, x ) ); try{ - table.getCompilationUnit().unqualifiedFunctionLookup( "g", params ); //$NON-NLS-1$ + table.getCompilationUnit().unqualifiedFunctionLookup( "g".toCharArray(), params ); //$NON-NLS-1$ assertTrue( false ); } catch( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous ); @@ -1626,59 +1626,59 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_5_5_2__5_OrderingFunctionTemplates_3() throws Exception{ newTable(); - ITemplateSymbol templateA = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ - templateA.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol templateA = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ + templateA.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( templateA ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ factory.addSymbol( A ); - ITemplateSymbol template1 = table.newTemplateSymbol( "h" ); //$NON-NLS-1$ - template1.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template1 = table.newTemplateSymbol( "h".toCharArray() ); //$NON-NLS-1$ + template1.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template1 ); - ISymbol T = template1.lookup( "T" ); //$NON-NLS-1$ - IParameterizedSymbol h1 = table.newParameterizedSymbol( "h", ITypeInfo.t_function ); //$NON-NLS-1$ + ISymbol T = template1.lookup( "T".toCharArray() ); //$NON-NLS-1$ + IParameterizedSymbol h1 = table.newParameterizedSymbol( "h".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ h1.addParameter( T, ITypeInfo.isConst, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference, false, false ),false ); factory.addSymbol( h1 ); - ITemplateSymbol template2 = table.newTemplateSymbol( "h" ); //$NON-NLS-1$ - template2.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template2 = table.newTemplateSymbol( "h".toCharArray() ); //$NON-NLS-1$ + template2.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template2 ); - T = template2.lookup( "T" ); //$NON-NLS-1$ + T = template2.lookup( "T".toCharArray() ); //$NON-NLS-1$ - IParameterizedSymbol h2 = table.newParameterizedSymbol( "h", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol h2 = table.newParameterizedSymbol( "h".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ List argList = new ArrayList(); argList.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, T ) ); h2.addParameter( templateA.instantiate( argList ), 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference ), false ); factory.addSymbol( h2 ); - ISymbol z = table.newSymbol( "z", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol z = table.newSymbol( "z".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ List args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - ISymbol look = table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), A ); z.setTypeSymbol( look ); List params = new ArrayList(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, z ) ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "h", params ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "h".toCharArray(), params ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), h2 ); - ISymbol z2 = table.newSymbol( "z2", ITypeInfo.t_type ); //$NON-NLS-1$ - look = table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + ISymbol z2 = table.newSymbol( "z2".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), A ); z2.setTypeSymbol( look ); @@ -1686,7 +1686,7 @@ public class ParserSymbolTableTemplateTests extends TestCase { params.clear(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, z2 ) ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "h", params ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "h".toCharArray(), params ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), h1 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -1706,18 +1706,18 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_6_1__1_TemplateName() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "X" ); //$NON-NLS-1$ - ISymbol T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "X".toCharArray() ); //$NON-NLS-1$ + ISymbol T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( T ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( X ); - ISymbol look = X.lookup( "X" ); //$NON-NLS-1$ + ISymbol look = X.lookup( "X".toCharArray() ); //$NON-NLS-1$ assertTrue( look != null ); assertTrue( look instanceof IDeferredTemplateInstance ); @@ -1746,23 +1746,23 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_6_1__2_SpecializationName() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "Y" ); //$NON-NLS-1$ - ISymbol T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "Y".toCharArray() ); //$NON-NLS-1$ + ISymbol T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( T ); - IDerivableContainerSymbol Y1 = table.newDerivableContainerSymbol( "Y", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol Y1 = table.newDerivableContainerSymbol( "Y".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ template.addSymbol( Y1 ); table.getCompilationUnit().addSymbol( template ); - ISpecializedSymbol spec = table.newSpecializedSymbol( "Y" ); //$NON-NLS-1$ + ISpecializedSymbol spec = table.newSpecializedSymbol( "Y".toCharArray() ); //$NON-NLS-1$ spec.addArgument( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); template.addSpecialization( spec ); - IDerivableContainerSymbol Y2 = table.newDerivableContainerSymbol( "Y", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol Y2 = table.newDerivableContainerSymbol( "Y".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ spec.addSymbol( Y2 ); - ISymbol look = Y2.lookup( "Y" ); //$NON-NLS-1$ + ISymbol look = Y2.lookup( "Y".toCharArray() ); //$NON-NLS-1$ assertTrue( look != null ); assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), Y2 ); @@ -1788,10 +1788,10 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_6_1__4_ParameterRedeclaration() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "Y" ); //$NON-NLS-1$ - template.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "Y".toCharArray() ); //$NON-NLS-1$ + template.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ - ISymbol i = table.newSymbol( "i", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol i = table.newSymbol( "i".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ i.getTypeInfo().setTemplateParameterType( ITypeInfo.t_int ); template.addTemplateParameter( i ); @@ -1799,10 +1799,10 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol Y = table.newDerivableContainerSymbol( "Y", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol Y = table.newDerivableContainerSymbol( "Y".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( Y ); - ISymbol T = table.newSymbol( "T", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ try{ Y.addSymbol( T ); assertTrue( false ); @@ -1810,19 +1810,19 @@ public class ParserSymbolTableTemplateTests extends TestCase { assertEquals( e.reason, ParserSymbolTableException.r_RedeclaredTemplateParam ); } - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ Y.addSymbol( f ); try{ - f.addSymbol( table.newSymbol( "T", ITypeInfo.t_char ) ); //$NON-NLS-1$ + f.addSymbol( table.newSymbol( "T".toCharArray(), ITypeInfo.t_char ) ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_RedeclaredTemplateParam ); } - ITemplateSymbol template2 = table.newTemplateSymbol( "X" ); //$NON-NLS-1$ + ITemplateSymbol template2 = table.newTemplateSymbol( "X".toCharArray() ); //$NON-NLS-1$ try{ - template2.addTemplateParameter( table.newSymbol( "X", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + template2.addTemplateParameter( table.newSymbol( "X".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ assertTrue( false ); } catch( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_BadTemplateParameter ); @@ -1850,23 +1850,23 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_7_3__5_ExplicitSpecialization() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ - ISymbol T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( T ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ factory.addSymbol( A ); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f.addParameter( T, 0, null, false ); A.addSymbol( f ); - ITemplateSymbol temp = table.newTemplateSymbol( "" ); //$NON-NLS-1$ + ITemplateSymbol temp = table.newTemplateSymbol( "".toCharArray() ); //$NON-NLS-1$ factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( temp ); @@ -1875,34 +1875,34 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); - ITemplateSymbol templateSpec = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME ); + ITemplateSymbol templateSpec = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); factory.pushTemplate( templateSpec ); - IDerivableContainerSymbol ASpec = table.newDerivableContainerSymbol( "A", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol ASpec = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); factory.addTemplateId( ASpec, args ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.addParameter( ITypeInfo.t_int, 0, null, false ); f2.setIsForwardDeclaration( true ); ASpec.addSymbol( f2 ); - IParameterizedSymbol f3 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f3 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f3.addParameter( ITypeInfo.t_int, 0, null, false ); - IDerivableContainerSymbol look = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + IDerivableContainerSymbol look = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), ASpec ); - ISymbol flook = look.lookupMethodForDefinition( "f", args ); //$NON-NLS-1$ + ISymbol flook = look.lookupMethodForDefinition( "f".toCharArray(), args ); //$NON-NLS-1$ assertTrue( flook.isTemplateInstance() ); assertEquals( flook.getInstantiatedSymbol(), f2 ); flook.setForwardSymbol( f3 ); look.addSymbol( f3 ); - look = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ - flook = look.qualifiedFunctionLookup( "f", args ); //$NON-NLS-1$ + look = (IDerivableContainerSymbol) table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ + flook = look.qualifiedFunctionLookup( "f".toCharArray(), args ); //$NON-NLS-1$ assertEquals( flook, f3 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -1919,57 +1919,57 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_7_3__11_ExplicitSpecializationArgumentDeduction() throws Exception{ newTable(); - ITemplateSymbol templateArray = table.newTemplateSymbol( "Array" ); //$NON-NLS-1$ - templateArray.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol templateArray = table.newTemplateSymbol( "Array".toCharArray() ); //$NON-NLS-1$ + templateArray.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( templateArray ); - IDerivableContainerSymbol array = table.newDerivableContainerSymbol( "Array", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol array = table.newDerivableContainerSymbol( "Array".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( array ); - ITemplateSymbol templateSort = table.newTemplateSymbol( "sort" ); //$NON-NLS-1$ - ISymbol T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol templateSort = table.newTemplateSymbol( "sort".toCharArray() ); //$NON-NLS-1$ + ISymbol T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ templateSort.addTemplateParameter( T ); factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( templateSort ); - IParameterizedSymbol sort = table.newParameterizedSymbol( "sort", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol sort = table.newParameterizedSymbol( "sort".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ List args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, T ) ); - ISymbol arrayLook = factory.lookupTemplateId( "Array", args ); //$NON-NLS-1$ + ISymbol arrayLook = factory.lookupTemplateId( "Array".toCharArray(), args ); //$NON-NLS-1$ sort.addParameter( arrayLook, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference ), false ); factory.addSymbol( sort ); - ITemplateSymbol temp = table.newTemplateSymbol( "" ); //$NON-NLS-1$ + ITemplateSymbol temp = table.newTemplateSymbol( "".toCharArray() ); //$NON-NLS-1$ factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( temp ); - IParameterizedSymbol newSort = table.newParameterizedSymbol( "sort", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol newSort = table.newParameterizedSymbol( "sort".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - arrayLook = table.getCompilationUnit().lookupTemplateId( "Array", args ); //$NON-NLS-1$ + arrayLook = table.getCompilationUnit().lookupTemplateId( "Array".toCharArray(), args ); //$NON-NLS-1$ assertTrue( arrayLook.isTemplateInstance() ); assertEquals( arrayLook.getInstantiatedSymbol(), array ); newSort.addParameter( arrayLook, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference ), false ); factory.addSymbol( newSort ); - ISymbol a = table.newSymbol( "a", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ a.setTypeSymbol( arrayLook ); args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, a ) ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "sort", args ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "sort".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), newSort ); @@ -1993,38 +1993,38 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_7_3__12_ExplicitSpecializationOverloadedFunction() throws Exception{ newTable(); - ITemplateSymbol template1 = table.newTemplateSymbol( "f" ); //$NON-NLS-1$ - ISymbol T1 = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template1 = table.newTemplateSymbol( "f".toCharArray() ); //$NON-NLS-1$ + ISymbol T1 = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template1.addTemplateParameter( T1 ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template1 ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.addParameter( T1, 0, null, false ); factory.addSymbol( f1 ); - ITemplateSymbol template2 = table.newTemplateSymbol( "f" ); //$NON-NLS-1$ - ISymbol T2 = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template2 = table.newTemplateSymbol( "f".toCharArray() ); //$NON-NLS-1$ + ISymbol T2 = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template2.addTemplateParameter( T2 ); factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template2 ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.addParameter( T2, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); factory.addSymbol( f2 ); factory = table.newTemplateFactory(); - ITemplateSymbol template = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME ); + ITemplateSymbol template = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IParameterizedSymbol f3 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f3 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f3.addParameter( ITypeInfo.t_int, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); List args = new ArrayList(); @@ -2034,31 +2034,31 @@ public class ParserSymbolTableTemplateTests extends TestCase { args = new ArrayList(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - template = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME ); + template = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IParameterizedSymbol f4 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f4 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f4.addParameter( ITypeInfo.t_int, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); factory.addTemplateId( f4, args ); args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ) ); - template = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME ); + template = table.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IParameterizedSymbol f5 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f5 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f5.addParameter( ITypeInfo.t_char, 0, null, false ); factory.addSymbol( f5 ); args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ) ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", args ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), f5 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -2082,23 +2082,23 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_8_2_4__5_ArgumentDeduction() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "f" ); //$NON-NLS-1$ - ISymbol T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "f".toCharArray() ); //$NON-NLS-1$ + ISymbol T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( T ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ - ISymbol lookT = template.lookup( "T" ); //$NON-NLS-1$ + ISymbol lookT = template.lookup( "T".toCharArray() ); //$NON-NLS-1$ assertEquals( lookT, T ); - ISymbol paramX = table.newSymbol( "x", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol paramX = table.newSymbol( "x".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ paramX.setTypeSymbol( lookT ); - ISymbol paramY = table.newSymbol( "y", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol paramY = table.newSymbol( "y".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ paramY.setTypeSymbol( lookT ); f.addParameter( paramX ); @@ -2106,17 +2106,17 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.addSymbol( f ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( A ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ B.addParent( A ); table.getCompilationUnit().addSymbol( B ); - ISymbol a = table.newSymbol( "a", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ a.setTypeSymbol( A ); - ISymbol b = table.newSymbol( "b", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol b = table.newSymbol( "b".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ b.setTypeSymbol( B ); table.getCompilationUnit().addSymbol( a ); @@ -2128,26 +2128,26 @@ public class ParserSymbolTableTemplateTests extends TestCase { argList.add( aParam ); argList.add( bParam ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", argList ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), argList ); //$NON-NLS-1$ assertEquals( look, null ); argList.clear(); argList.add( bParam ); argList.add( aParam ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", argList ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), argList ); //$NON-NLS-1$ assertEquals( look, null ); argList.clear(); argList.add( aParam ); argList.add( aParam ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", argList ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), argList ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), f ); argList.clear(); argList.add( bParam ); argList.add( bParam ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", argList ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), argList ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance()); assertEquals( look.getInstantiatedSymbol(), f ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -2168,49 +2168,49 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_8_2_4__6_ArgumentDeduction() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "f" ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "f".toCharArray() ); //$NON-NLS-1$ - template.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ - template.addTemplateParameter( table.newSymbol( "U", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + template.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + template.addTemplateParameter( table.newSymbol( "U".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IParameterizedSymbol paramFunction = table.newParameterizedSymbol( "", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol paramFunction = table.newParameterizedSymbol( "".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ paramFunction.setIsTemplateMember( true ); - ISymbol T = template.lookup( "T" ); //$NON-NLS-1$ - ISymbol U = template.lookup( "U" ); //$NON-NLS-1$ + ISymbol T = template.lookup( "T".toCharArray() ); //$NON-NLS-1$ + ISymbol U = template.lookup( "U".toCharArray() ); //$NON-NLS-1$ paramFunction.setReturnType( T ); paramFunction.addParameter( T, 0, null, false ); paramFunction.addParameter( U, 0, null, false ); paramFunction.addParameter( U, 0, null, false ); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f.addParameter( paramFunction, 0, null, false ); factory.addSymbol( f ); - IParameterizedSymbol g1 = table.newParameterizedSymbol( "g1", ITypeInfo.t_function ); //$NON-NLS-1$ - g1.setReturnType( table.newSymbol( "", ITypeInfo.t_int ) ); //$NON-NLS-1$ + IParameterizedSymbol g1 = table.newParameterizedSymbol( "g1".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ + g1.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_int ) ); //$NON-NLS-1$ g1.addParameter( ITypeInfo.t_int, 0, null, false ); g1.addParameter( ITypeInfo.t_float, 0, null, false ); g1.addParameter( ITypeInfo.t_float, 0, null, false ); table.getCompilationUnit().addSymbol( g1 ); - IParameterizedSymbol g2 = table.newParameterizedSymbol( "g2", ITypeInfo.t_function ); //$NON-NLS-1$ - g2.setReturnType( table.newSymbol( "", ITypeInfo.t_char ) ); //$NON-NLS-1$ + IParameterizedSymbol g2 = table.newParameterizedSymbol( "g2".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ + g2.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_char ) ); //$NON-NLS-1$ g2.addParameter( ITypeInfo.t_int, 0, null, false ); g2.addParameter( ITypeInfo.t_float, 0, null, false ); g2.addParameter( ITypeInfo.t_float, 0, null, false ); table.getCompilationUnit().addSymbol( g2); - IParameterizedSymbol g3 = table.newParameterizedSymbol( "g3", ITypeInfo.t_function ); //$NON-NLS-1$ - g3.setReturnType( table.newSymbol( "", ITypeInfo.t_int ) ); //$NON-NLS-1$ + IParameterizedSymbol g3 = table.newParameterizedSymbol( "g3".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ + g3.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_int ) ); //$NON-NLS-1$ g3.addParameter( ITypeInfo.t_int, 0, null, false ); g3.addParameter( ITypeInfo.t_char, 0, null, false ); g3.addParameter( ITypeInfo.t_float, 0, null, false ); @@ -2221,16 +2221,16 @@ public class ParserSymbolTableTemplateTests extends TestCase { List argList = new ArrayList(); argList.add( arg ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", argList ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), argList ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), f ); arg.setTypeSymbol( g2 ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", argList ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), argList ); //$NON-NLS-1$ assertEquals( look, null ); arg.setTypeSymbol( g3 ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", argList ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), argList ); //$NON-NLS-1$ assertEquals( look, null ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -2246,24 +2246,24 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_8_2_4__7_ArgumentDeduction() throws Exception{ newTable(); - ITemplateSymbol template = table.newTemplateSymbol( "f" ); //$NON-NLS-1$ - ISymbol T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "f".toCharArray() ); //$NON-NLS-1$ + ISymbol T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( T ); ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f.addParameter( T, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer, true, false ), false ); factory.addSymbol( f ); - ISymbol p = table.newSymbol( "p", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol p = table.newSymbol( "p".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ p.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ) ); List params = new ArrayList(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, p ) ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertTrue( look != null ); assertTrue( look.isTemplateInstance() ); @@ -2304,40 +2304,40 @@ public class ParserSymbolTableTemplateTests extends TestCase { public void test_14_8_2_4__8_ArgumentDeduction() throws Exception{ newTable(); - ITemplateSymbol templateB = table.newTemplateSymbol( "B" ); //$NON-NLS-1$ - templateB.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol templateB = table.newTemplateSymbol( "B".toCharArray() ); //$NON-NLS-1$ + templateB.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ ITemplateFactory factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( templateB ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ factory.addSymbol( B ); - ITemplateSymbol templateD = table.newTemplateSymbol( "D" ); //$NON-NLS-1$ - templateD.addTemplateParameter( table.newSymbol( "T", ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ + ITemplateSymbol templateD = table.newTemplateSymbol( "D".toCharArray() ); //$NON-NLS-1$ + templateD.addTemplateParameter( table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ) ); //$NON-NLS-1$ factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( templateD ); - IDerivableContainerSymbol D = table.newDerivableContainerSymbol( "D", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol D = table.newDerivableContainerSymbol( "D".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ factory.addSymbol( D ); - ISymbol T = templateD.lookup( "T" ); //$NON-NLS-1$ + ISymbol T = templateD.lookup( "T".toCharArray() ); //$NON-NLS-1$ List args = new ArrayList (); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, T ) ); - ISymbol look = table.getCompilationUnit().lookupTemplateId( "B", args ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookupTemplateId( "B".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look instanceof IDeferredTemplateInstance ); assertEquals( ((IDeferredTemplateInstance)look).getTemplate(), templateB ); D.addParent( look ); - IDerivableContainerSymbol D2 = table.newDerivableContainerSymbol( "D2", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol D2 = table.newDerivableContainerSymbol( "D2".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - look = table.getCompilationUnit().lookupTemplateId( "B", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "B".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), B ); @@ -2345,55 +2345,55 @@ public class ParserSymbolTableTemplateTests extends TestCase { table.getCompilationUnit().addSymbol( D2 ); - ITemplateSymbol templatef = table.newTemplateSymbol( "f" ); //$NON-NLS-1$ - T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol templatef = table.newTemplateSymbol( "f".toCharArray() ); //$NON-NLS-1$ + T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ templatef.addTemplateParameter( T ); factory = table.newTemplateFactory(); factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( templatef ); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, T ) ); - look = table.getCompilationUnit().lookupTemplateId( "B", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "B".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look instanceof IDeferredTemplateInstance ); assertEquals( ((IDeferredTemplateInstance)look).getTemplate(), templateB ); - ISymbol param = table.newSymbol( "", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol param = table.newSymbol( "".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ param.setTypeSymbol( look ); param.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference ) ); f.addParameter( param ); factory.addSymbol( f ); - ISymbol d = table.newSymbol( "d", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol d = table.newSymbol( "d".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - look = table.getCompilationUnit().lookupTemplateId( "D", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "D".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), D ); d.setTypeSymbol( look ); table.getCompilationUnit().addSymbol( d ); - ISymbol d2 = table.newSymbol( "d2", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol d2 = table.newSymbol( "d2".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ d2.setTypeSymbol( D2 ); table.getCompilationUnit().addSymbol( d2 ); args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, d ) ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look != null ); assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), f ); args.clear(); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, d2 ) ); - ISymbol look2 = table.getCompilationUnit().unqualifiedFunctionLookup( "f", args ); //$NON-NLS-1$ + ISymbol look2 = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look2 != null ); assertTrue( look2.isTemplateInstance() ); assertEquals( look2.getInstantiatedSymbol(), f ); @@ -2439,9 +2439,9 @@ public class ParserSymbolTableTemplateTests extends TestCase { newTable(); //template < class T1, class T2 > class A { void f(); }; - ITemplateSymbol template = table.newTemplateSymbol( "A" ); //$NON-NLS-1$ - ISymbol T1 = table.newSymbol( "T1", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol T2 = table.newSymbol( "T2", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol template = table.newTemplateSymbol( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol T1 = table.newSymbol( "T1".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol T2 = table.newSymbol( "T2".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ template.addTemplateParameter( T1 ); template.addTemplateParameter( T2 ); @@ -2449,16 +2449,16 @@ public class ParserSymbolTableTemplateTests extends TestCase { factory.setContainingSymbol( table.getCompilationUnit() ); factory.pushTemplate( template ); - IDerivableContainerSymbol A1 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A1 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addSymbol( A1 ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.setIsForwardDeclaration( true ); A1.addSymbol( f1 ); //template < class T > class A < T, T > { void f(); }; - ITemplateSymbol spec1 = table.newTemplateSymbol(""); //$NON-NLS-1$ - ISymbol spec1_T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol spec1 = table.newTemplateSymbol("".toCharArray()); //$NON-NLS-1$ + ISymbol spec1_T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ spec1.addTemplateParameter( spec1_T ); factory = table.newTemplateFactory(); @@ -2469,16 +2469,16 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, spec1_T ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, spec1_T ) ); - IDerivableContainerSymbol A2 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A2 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addTemplateId( A2, args ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.setIsForwardDeclaration( true ); A2.addSymbol( f2 ); //template < class T > class A < char, T > { void f(); }; - ITemplateSymbol spec2 = table.newTemplateSymbol(""); //$NON-NLS-1$ - ISymbol spec2_T = table.newSymbol( "T", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol spec2 = table.newTemplateSymbol("".toCharArray()); //$NON-NLS-1$ + ISymbol spec2_T = table.newSymbol( "T".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ spec2.addTemplateParameter( spec2_T ); factory = table.newTemplateFactory(); @@ -2489,17 +2489,17 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, spec2_T ) ); - IDerivableContainerSymbol A3 = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A3 = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ factory.addTemplateId( A3, args ); - IParameterizedSymbol f3 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f3 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f3.setIsForwardDeclaration( true ); A3.addSymbol( f3 ); //template < class U, class V > void A::f(){ int c; } - ITemplateSymbol templateDef = table.newTemplateSymbol(""); //$NON-NLS-1$ - ISymbol U = table.newSymbol( "U", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ - ISymbol V = table.newSymbol( "V", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol templateDef = table.newTemplateSymbol("".toCharArray()); //$NON-NLS-1$ + ISymbol U = table.newSymbol( "U".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ISymbol V = table.newSymbol( "V".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ templateDef.addTemplateParameter( U ); templateDef.addTemplateParameter( V ); @@ -2511,22 +2511,22 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, U ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, V ) ); - ISymbol symbol = factory.lookupTemplateId( "A", args ); //$NON-NLS-1$ + ISymbol symbol = factory.lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertEquals( ((IDeferredTemplateInstance)symbol).getTemplate(), template ); factory.pushTemplateId( symbol, args ); - ISymbol look = factory.lookupMethodForDefinition( "f", new ArrayList() ); //$NON-NLS-1$ + ISymbol look = factory.lookupMethodForDefinition( "f".toCharArray(), new ArrayList() ); //$NON-NLS-1$ assertEquals( look, f1 ); - IParameterizedSymbol f1Def = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1Def = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.setForwardSymbol( f1Def ); factory.addSymbol( f1Def ); - ISymbol c1 = table.newSymbol( "c", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol c1 = table.newSymbol( "c".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ f1Def.addSymbol( c1 ); //template < class W > void A < W, W >::f(){ char c; } - ITemplateSymbol specDef1 = table.newTemplateSymbol(""); //$NON-NLS-1$ - ISymbol W = table.newSymbol( "W", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol specDef1 = table.newTemplateSymbol("".toCharArray()); //$NON-NLS-1$ + ISymbol W = table.newSymbol( "W".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ specDef1.addTemplateParameter( W ); factory = table.newTemplateFactory(); @@ -2537,21 +2537,21 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, W ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, W ) ); - symbol = factory.lookupTemplateId( "A", args ); //$NON-NLS-1$ + symbol = factory.lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ factory.pushTemplateId( symbol, args ); - look = factory.lookupMethodForDefinition( "f", new ArrayList() ); //$NON-NLS-1$ + look = factory.lookupMethodForDefinition( "f".toCharArray(), new ArrayList() ); //$NON-NLS-1$ assertEquals( look, f2 ); - IParameterizedSymbol f2Def = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2Def = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.setForwardSymbol( f2Def ); factory.addSymbol( f2Def ); - ISymbol c2 = table.newSymbol( "c", ITypeInfo.t_char ); //$NON-NLS-1$ + ISymbol c2 = table.newSymbol( "c".toCharArray(), ITypeInfo.t_char ); //$NON-NLS-1$ f2Def.addSymbol( c2 ); //template < class X > void < char, X >::f(){ float c; } - ITemplateSymbol specDef2 = table.newTemplateSymbol(""); //$NON-NLS-1$ - ISymbol X = table.newSymbol( "X", ITypeInfo.t_templateParameter ); //$NON-NLS-1$ + ITemplateSymbol specDef2 = table.newTemplateSymbol("".toCharArray()); //$NON-NLS-1$ + ISymbol X = table.newSymbol( "X".toCharArray(), ITypeInfo.t_templateParameter ); //$NON-NLS-1$ specDef2.addTemplateParameter( X ); factory = table.newTemplateFactory(); @@ -2562,16 +2562,16 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, X ) ); - symbol = factory.lookupTemplateId( "A", args ); //$NON-NLS-1$ + symbol = factory.lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ factory.pushTemplateId( symbol, args ); - look = factory.lookupMethodForDefinition( "f", new ArrayList() ); //$NON-NLS-1$ + look = factory.lookupMethodForDefinition( "f".toCharArray(), new ArrayList() ); //$NON-NLS-1$ assertEquals( look, f3 ); - IParameterizedSymbol f3Def = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f3Def = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f3.setForwardSymbol( f3Def ); factory.addSymbol( f3Def ); - ISymbol c3 = table.newSymbol( "c", ITypeInfo.t_float ); //$NON-NLS-1$ + ISymbol c3 = table.newSymbol( "c".toCharArray(), ITypeInfo.t_float ); //$NON-NLS-1$ f3Def.addSymbol( c3 ); //A< int, char > a1; @@ -2579,15 +2579,15 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ) ); - look = table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), A1 ); - look = ((IContainerSymbol)look).qualifiedFunctionLookup( "f", new ArrayList() ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).qualifiedFunctionLookup( "f".toCharArray(), new ArrayList() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), f1Def ); - look = ((IContainerSymbol)look).qualifiedLookup( "c" ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).qualifiedLookup( "c".toCharArray() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), c1 ); assertTrue( look.isType( ITypeInfo.t_int ) ); @@ -2597,15 +2597,15 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - look = table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), A2 ); - look = ((IContainerSymbol)look).qualifiedFunctionLookup( "f", new ArrayList() ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).qualifiedFunctionLookup( "f".toCharArray(), new ArrayList() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), f2Def ); - look = ((IContainerSymbol)look).qualifiedLookup( "c" ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).qualifiedLookup( "c".toCharArray() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), c2 ); assertTrue( look.isType( ITypeInfo.t_char ) ); @@ -2615,15 +2615,15 @@ public class ParserSymbolTableTemplateTests extends TestCase { args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ) ); args.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - look = table.getCompilationUnit().lookupTemplateId( "A", args ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookupTemplateId( "A".toCharArray(), args ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), A3 ); - look = ((IContainerSymbol)look).qualifiedFunctionLookup( "f", new ArrayList() ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).qualifiedFunctionLookup( "f".toCharArray(), new ArrayList() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), f3Def ); - look = ((IContainerSymbol)look).qualifiedLookup( "c" ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).qualifiedLookup( "c".toCharArray() ); //$NON-NLS-1$ assertTrue( look.isTemplateInstance() ); assertEquals( look.getInstantiatedSymbol(), c3 ); assertTrue( look.isType( ITypeInfo.t_float ) ); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java index ff8a2ef95c7..7d6741bd3c3 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java @@ -43,7 +43,8 @@ import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTableException; import org.eclipse.cdt.internal.core.parser.pst.StandardSymbolExtension; import org.eclipse.cdt.internal.core.parser.pst.TypeFilter; import org.eclipse.cdt.internal.core.parser.pst.TypeInfoProvider; -import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayObjectMap; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayUtils; @@ -85,19 +86,19 @@ public class ParserSymbolTableTest extends TestCase { public void testSimpleAdd() throws Exception{ newTable(); //create the symbol table - ISymbol x = table.newSymbol( "x" ); //$NON-NLS-1$ + ISymbol x = table.newSymbol( "x".toCharArray() ); //$NON-NLS-1$ x.setTypeInfo( TypeInfoProvider.newTypeInfo() ); IContainerSymbol compUnit = table.getCompilationUnit(); compUnit.addSymbol( x ); - ObjectMap declarations = compUnit.getContainedSymbols(); + CharArrayObjectMap declarations = compUnit.getContainedSymbols(); assertEquals( 1, declarations.size() ); ISymbol contained = (ISymbol) declarations.getAt( 0 ); assertEquals( declarations.size(), 1 ); assertEquals( x, contained ); - assertEquals( contained.getName(), "x" ); //$NON-NLS-1$ + assertTrue( CharArrayUtils.equals(contained.getName(), "x".toCharArray()) ); //$NON-NLS-1$ assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -109,10 +110,10 @@ public class ParserSymbolTableTest extends TestCase { public void testSimpleLookup() throws Exception{ newTable(); //new symbol table - ISymbol x = table.newSymbol( "x", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol x = table.newSymbol( "x".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( x ); - ISymbol look = table.getCompilationUnit().lookup( "x" ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( x, look ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -121,7 +122,7 @@ public class ParserSymbolTableTest extends TestCase { public void testLookupNonExistant() throws Exception{ newTable(); - ISymbol look = table.getCompilationUnit().lookup("boo"); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookup("boo".toCharArray()); //$NON-NLS-1$ assertEquals( look, null ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -129,7 +130,7 @@ public class ParserSymbolTableTest extends TestCase { public void testSimpleSetGetObject() throws Exception{ newTable(); - IContainerSymbol x = table.newContainerSymbol( "x", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol x = table.newContainerSymbol( "x".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ ISymbolASTExtension extension = new StandardSymbolExtension(x,null); @@ -137,7 +138,7 @@ public class ParserSymbolTableTest extends TestCase { table.getCompilationUnit().addSymbol( x ); - ISymbol look = table.getCompilationUnit().lookup( "x" ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( look.getASTExtension(), extension ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -152,24 +153,24 @@ public class ParserSymbolTableTest extends TestCase { public void testHide() throws Exception{ newTable(); - ISymbol firstX = table.newSymbol("x"); //$NON-NLS-1$ + ISymbol firstX = table.newSymbol("x".toCharArray()); //$NON-NLS-1$ firstX.setTypeInfo( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); table.getCompilationUnit().addSymbol( firstX ); - IDerivableContainerSymbol firstClass = table.newDerivableContainerSymbol("class"); //$NON-NLS-1$ + IDerivableContainerSymbol firstClass = table.newDerivableContainerSymbol("class".toCharArray()); //$NON-NLS-1$ firstClass.setType( ITypeInfo.t_class ); table.getCompilationUnit().addSymbol( firstClass ); - ISymbol look = firstClass.lookup( "x" ); //$NON-NLS-1$ + ISymbol look = firstClass.lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( look, firstX ); - ISymbol secondX = table.newSymbol("x"); //$NON-NLS-1$ + ISymbol secondX = table.newSymbol("x".toCharArray()); //$NON-NLS-1$ firstClass.addSymbol( secondX ); - look = firstClass.lookup( "x" ); //$NON-NLS-1$ + look = firstClass.lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( look, secondX ); - look = table.getCompilationUnit().lookup( "x" ); //$NON-NLS-1$ + look = table.getCompilationUnit().lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( look, firstX ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -182,14 +183,14 @@ public class ParserSymbolTableTest extends TestCase { public void testContainingScopeLookup() throws Exception{ newTable(); - ISymbol x = table.newSymbol("x"); //$NON-NLS-1$ + ISymbol x = table.newSymbol("x".toCharArray()); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( x ); - IDerivableContainerSymbol decl = table.newDerivableContainerSymbol("class"); //$NON-NLS-1$ + IDerivableContainerSymbol decl = table.newDerivableContainerSymbol("class".toCharArray()); //$NON-NLS-1$ decl.setType( ITypeInfo.t_class ); table.getCompilationUnit().addSymbol( decl ); - ISymbol look = decl.lookup( "x" ); //$NON-NLS-1$ + ISymbol look = decl.lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( x, look ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -204,20 +205,20 @@ public class ParserSymbolTableTest extends TestCase { public void testParentLookup() throws Exception{ newTable(); - IDerivableContainerSymbol parent = table.newDerivableContainerSymbol("parent"); //$NON-NLS-1$ + IDerivableContainerSymbol parent = table.newDerivableContainerSymbol("parent".toCharArray()); //$NON-NLS-1$ parent.setType( ITypeInfo.t_class ); - IDerivableContainerSymbol class1 = table.newDerivableContainerSymbol("class"); //$NON-NLS-1$ + IDerivableContainerSymbol class1 = table.newDerivableContainerSymbol("class".toCharArray()); //$NON-NLS-1$ class1.setType( ITypeInfo.t_class ); class1.addParent( parent ); - ISymbol decl = table.newSymbol( "x", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol decl = table.newSymbol( "x".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ parent.addSymbol( decl ); table.getCompilationUnit().addSymbol( parent ); table.getCompilationUnit().addSymbol( class1 ); - ISymbol look = class1.lookup( "x" ); //$NON-NLS-1$ + ISymbol look = class1.lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( look, decl ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -234,17 +235,17 @@ public class ParserSymbolTableTest extends TestCase { public void testAmbiguousParentLookup() throws Exception{ testParentLookup(); - IDerivableContainerSymbol parent2 = table.newDerivableContainerSymbol("parent2"); //$NON-NLS-1$ + IDerivableContainerSymbol parent2 = table.newDerivableContainerSymbol("parent2".toCharArray()); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( parent2 ); - IDerivableContainerSymbol class1 = (IDerivableContainerSymbol) table.getCompilationUnit().lookup( "class" ); //$NON-NLS-1$ + IDerivableContainerSymbol class1 = (IDerivableContainerSymbol) table.getCompilationUnit().lookup( "class".toCharArray() ); //$NON-NLS-1$ class1.addParent( parent2 ); - ISymbol decl = table.newSymbol( "x", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol decl = table.newSymbol( "x".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ parent2.addSymbol( decl ); try{ - class1.lookup( "x" ); //$NON-NLS-1$ + class1.lookup( "x".toCharArray() ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ){ @@ -261,17 +262,17 @@ public class ParserSymbolTableTest extends TestCase { public void testCircularParentLookup() throws Exception{ newTable(); - IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a"); //$NON-NLS-1$ + IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a".toCharArray()); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( a ); - IDerivableContainerSymbol b = table.newDerivableContainerSymbol("b"); //$NON-NLS-1$ + IDerivableContainerSymbol b = table.newDerivableContainerSymbol("b".toCharArray()); //$NON-NLS-1$ b.addParent( a ); table.getCompilationUnit().addSymbol( b ); a.addParent( b ); try{ - a.lookup("foo"); //$NON-NLS-1$ + a.lookup("foo".toCharArray()); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e) { assertEquals( e.reason, ParserSymbolTableException.r_CircularInheritance ); @@ -293,13 +294,13 @@ public class ParserSymbolTableTest extends TestCase { public void testVirtualParentLookup() throws Exception{ newTable(); - IDerivableContainerSymbol decl = table.newDerivableContainerSymbol("class"); //$NON-NLS-1$ - IDerivableContainerSymbol c = table.newDerivableContainerSymbol("C"); //$NON-NLS-1$ + IDerivableContainerSymbol decl = table.newDerivableContainerSymbol("class".toCharArray()); //$NON-NLS-1$ + IDerivableContainerSymbol c = table.newDerivableContainerSymbol("C".toCharArray()); //$NON-NLS-1$ - IDerivableContainerSymbol a = table.newDerivableContainerSymbol("A"); //$NON-NLS-1$ + IDerivableContainerSymbol a = table.newDerivableContainerSymbol("A".toCharArray()); //$NON-NLS-1$ a.addParent( c, true, ASTAccessVisibility.PUBLIC, 3, null ); - IDerivableContainerSymbol b = table.newDerivableContainerSymbol("B"); //$NON-NLS-1$ + IDerivableContainerSymbol b = table.newDerivableContainerSymbol("B".toCharArray()); //$NON-NLS-1$ b.addParent( c, true, ASTAccessVisibility.PUBLIC, 6, null ); decl.addParent( a ); @@ -308,14 +309,14 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); compUnit.addSymbol( c ); - ISymbol x = table.newSymbol( "x", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol x = table.newSymbol( "x".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ c.addSymbol( x ); compUnit.addSymbol( decl ); compUnit.addSymbol( a ); compUnit.addSymbol( b ); - ISymbol look = decl.lookup( "x" ); //$NON-NLS-1$ + ISymbol look = decl.lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( look, x ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -337,9 +338,9 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IDerivableContainerSymbol cls = (IDerivableContainerSymbol) compUnit.lookup("class"); //$NON-NLS-1$ - IDerivableContainerSymbol c = (IDerivableContainerSymbol) compUnit.lookup("C"); //$NON-NLS-1$ - IDerivableContainerSymbol d = table.newDerivableContainerSymbol("D"); //$NON-NLS-1$ + IDerivableContainerSymbol cls = (IDerivableContainerSymbol) compUnit.lookup("class".toCharArray()); //$NON-NLS-1$ + IDerivableContainerSymbol c = (IDerivableContainerSymbol) compUnit.lookup("C".toCharArray()); //$NON-NLS-1$ + IDerivableContainerSymbol d = table.newDerivableContainerSymbol("D".toCharArray()); //$NON-NLS-1$ d.addParent( c ); cls.addParent( d ); @@ -347,7 +348,7 @@ public class ParserSymbolTableTest extends TestCase { compUnit.addSymbol( d ); try{ - cls.lookup( "x" ); //$NON-NLS-1$ + cls.lookup( "x".toCharArray() ); //$NON-NLS-1$ assertTrue( false ); } catch( ParserSymbolTableException e){ @@ -372,10 +373,10 @@ public class ParserSymbolTableTest extends TestCase { public void testStaticEnumParentLookup() throws Exception{ newTable(); - IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a" ); //$NON-NLS-1$ - IDerivableContainerSymbol b = table.newDerivableContainerSymbol( "b" ); //$NON-NLS-1$ - IDerivableContainerSymbol c = table.newDerivableContainerSymbol( "c" ); //$NON-NLS-1$ - IDerivableContainerSymbol d = table.newDerivableContainerSymbol( "d" ); //$NON-NLS-1$ + IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a".toCharArray() ); //$NON-NLS-1$ + IDerivableContainerSymbol b = table.newDerivableContainerSymbol( "b".toCharArray() ); //$NON-NLS-1$ + IDerivableContainerSymbol c = table.newDerivableContainerSymbol( "c".toCharArray() ); //$NON-NLS-1$ + IDerivableContainerSymbol d = table.newDerivableContainerSymbol( "d".toCharArray() ); //$NON-NLS-1$ IContainerSymbol compUnit = table.getCompilationUnit(); @@ -384,14 +385,14 @@ public class ParserSymbolTableTest extends TestCase { compUnit.addSymbol( c ); compUnit.addSymbol( d ); - IContainerSymbol enum = table.newContainerSymbol( "enum", ITypeInfo.t_enumeration ); //$NON-NLS-1$ + IContainerSymbol enum = table.newContainerSymbol( "enum".toCharArray(), ITypeInfo.t_enumeration ); //$NON-NLS-1$ - ISymbol enumerator = table.newSymbol( "enumerator", ITypeInfo.t_enumerator ); //$NON-NLS-1$ + ISymbol enumerator = table.newSymbol( "enumerator".toCharArray(), ITypeInfo.t_enumerator ); //$NON-NLS-1$ - ISymbol stat = table.newSymbol( "static", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol stat = table.newSymbol( "static".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ stat.getTypeInfo().setBit( true, ITypeInfo.isStatic ); - ISymbol x = table.newSymbol( "x", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol x = table.newSymbol( "x".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ d.addSymbol( enum ); d.addSymbol( stat ); @@ -405,7 +406,7 @@ public class ParserSymbolTableTest extends TestCase { c.addParent( d ); try{ - a.lookup( "enumerator" ); //$NON-NLS-1$ + a.lookup( "enumerator".toCharArray() ); //$NON-NLS-1$ assertTrue( true ); } catch ( ParserSymbolTableException e){ @@ -413,7 +414,7 @@ public class ParserSymbolTableTest extends TestCase { } try{ - a.lookup( "static" ); //$NON-NLS-1$ + a.lookup( "static".toCharArray() ); //$NON-NLS-1$ assertTrue( true ); } catch ( ParserSymbolTableException e){ @@ -421,7 +422,7 @@ public class ParserSymbolTableTest extends TestCase { } try{ - a.lookup( "x" ); //$NON-NLS-1$ + a.lookup( "x".toCharArray() ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e){ @@ -438,24 +439,24 @@ public class ParserSymbolTableTest extends TestCase { public void testElaboratedLookup() throws Exception{ newTable(); - IDerivableContainerSymbol cls = table.newDerivableContainerSymbol( "class" ); //$NON-NLS-1$ + IDerivableContainerSymbol cls = table.newDerivableContainerSymbol( "class".toCharArray() ); //$NON-NLS-1$ cls.setType( ITypeInfo.t_class ); - IDerivableContainerSymbol struct = table.newDerivableContainerSymbol("struct"); //$NON-NLS-1$ + IDerivableContainerSymbol struct = table.newDerivableContainerSymbol("struct".toCharArray()); //$NON-NLS-1$ struct.setType( ITypeInfo.t_struct ); - IContainerSymbol union = table.newContainerSymbol("union"); //$NON-NLS-1$ + IContainerSymbol union = table.newContainerSymbol("union".toCharArray()); //$NON-NLS-1$ union.setType( ITypeInfo.t_union ); - IDerivableContainerSymbol hideCls = table.newDerivableContainerSymbol( "class" ); //$NON-NLS-1$ + IDerivableContainerSymbol hideCls = table.newDerivableContainerSymbol( "class".toCharArray() ); //$NON-NLS-1$ hideCls.setType( ITypeInfo.t_int ); - IDerivableContainerSymbol hideStruct = table.newDerivableContainerSymbol("struct"); //$NON-NLS-1$ + IDerivableContainerSymbol hideStruct = table.newDerivableContainerSymbol("struct".toCharArray()); //$NON-NLS-1$ hideStruct.setType( ITypeInfo.t_int ); - IContainerSymbol hideUnion = table.newContainerSymbol("union"); //$NON-NLS-1$ + IContainerSymbol hideUnion = table.newContainerSymbol("union".toCharArray()); //$NON-NLS-1$ hideUnion.setType( ITypeInfo.t_int ); - IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a"); //$NON-NLS-1$ - IDerivableContainerSymbol b = table.newDerivableContainerSymbol("b"); //$NON-NLS-1$ + IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a".toCharArray()); //$NON-NLS-1$ + IDerivableContainerSymbol b = table.newDerivableContainerSymbol("b".toCharArray()); //$NON-NLS-1$ a.addSymbol(hideCls); a.addSymbol(hideStruct); @@ -470,11 +471,11 @@ public class ParserSymbolTableTest extends TestCase { table.getCompilationUnit().addSymbol( a ); table.getCompilationUnit().addSymbol( b ); - ISymbol look = a.elaboratedLookup( ITypeInfo.t_class, "class" ); //$NON-NLS-1$ + ISymbol look = a.elaboratedLookup( ITypeInfo.t_class, "class".toCharArray() ); //$NON-NLS-1$ assertEquals( look, cls ); - look = a.elaboratedLookup( ITypeInfo.t_struct, "struct" ); //$NON-NLS-1$ + look = a.elaboratedLookup( ITypeInfo.t_struct, "struct".toCharArray() ); //$NON-NLS-1$ assertEquals( look, struct ); - look = a.elaboratedLookup( ITypeInfo.t_union, "union" ); //$NON-NLS-1$ + look = a.elaboratedLookup( ITypeInfo.t_union, "union".toCharArray() ); //$NON-NLS-1$ assertEquals( look, union ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -494,26 +495,26 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); //pre-condition - IContainerSymbol A = table.newContainerSymbol("A"); //$NON-NLS-1$ + IContainerSymbol A = table.newContainerSymbol("A".toCharArray()); //$NON-NLS-1$ compUnit.addSymbol(A); - ISymbol member = table.newSymbol("member"); //$NON-NLS-1$ + ISymbol member = table.newSymbol("member".toCharArray()); //$NON-NLS-1$ A.addSymbol(member); //at time of "A a;" - ISymbol look = compUnit.lookup("A"); //$NON-NLS-1$ + ISymbol look = compUnit.lookup("A".toCharArray()); //$NON-NLS-1$ assertEquals( look, A ); - ISymbol a = table.newSymbol("a"); //$NON-NLS-1$ + ISymbol a = table.newSymbol("a".toCharArray()); //$NON-NLS-1$ a.setTypeSymbol( look ); compUnit.addSymbol( a ); //later "a.member" - look = compUnit.lookup("a"); //$NON-NLS-1$ + look = compUnit.lookup("a".toCharArray()); //$NON-NLS-1$ assertEquals( look, a ); IContainerSymbol type = (IContainerSymbol) look.getTypeSymbol(); assertEquals( type, A ); - look = type.lookup("member"); //$NON-NLS-1$ + look = type.lookup("member".toCharArray()); //$NON-NLS-1$ assertEquals( look, member ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -537,22 +538,22 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IDerivableContainerSymbol struct = table.newDerivableContainerSymbol("stat"); //$NON-NLS-1$ + IDerivableContainerSymbol struct = table.newDerivableContainerSymbol("stat".toCharArray()); //$NON-NLS-1$ struct.setType( ITypeInfo.t_struct ); compUnit.addSymbol( struct ); - IParameterizedSymbol function = table.newParameterizedSymbol( "stat" ); //$NON-NLS-1$ + IParameterizedSymbol function = table.newParameterizedSymbol( "stat".toCharArray() ); //$NON-NLS-1$ function.setType( ITypeInfo.t_function ); compUnit.addSymbol( function ); - IParameterizedSymbol f = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ f.setType( ITypeInfo.t_function ); compUnit.addSymbol( f ); - ISymbol look = f.elaboratedLookup( ITypeInfo.t_struct, "stat" ); //$NON-NLS-1$ + ISymbol look = f.elaboratedLookup( ITypeInfo.t_struct, "stat".toCharArray() ); //$NON-NLS-1$ assertEquals( look, struct ); - look = f.lookup( "stat" ); //$NON-NLS-1$ + look = f.lookup( "stat".toCharArray() ); //$NON-NLS-1$ assertEquals( look, function ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -591,55 +592,55 @@ public class ParserSymbolTableTest extends TestCase { public void testUsingDirectives_1() throws Exception{ newTable(); - IContainerSymbol nsA = table.newContainerSymbol("A"); //$NON-NLS-1$ + IContainerSymbol nsA = table.newContainerSymbol("A".toCharArray()); //$NON-NLS-1$ nsA.setType( ITypeInfo.t_namespace ); table.getCompilationUnit().addSymbol( nsA ); - ISymbol nsA_i = table.newSymbol("i"); //$NON-NLS-1$ + ISymbol nsA_i = table.newSymbol("i".toCharArray()); //$NON-NLS-1$ nsA.addSymbol( nsA_i ); - IContainerSymbol nsB = table.newContainerSymbol("B"); //$NON-NLS-1$ + IContainerSymbol nsB = table.newContainerSymbol("B".toCharArray()); //$NON-NLS-1$ nsB.setType( ITypeInfo.t_namespace ); nsA.addSymbol( nsB ); - IContainerSymbol nsC = table.newContainerSymbol("C"); //$NON-NLS-1$ + IContainerSymbol nsC = table.newContainerSymbol("C".toCharArray()); //$NON-NLS-1$ nsC.setType( ITypeInfo.t_namespace ); nsB.addSymbol( nsC ); - ISymbol nsC_i = table.newSymbol("i"); //$NON-NLS-1$ + ISymbol nsC_i = table.newSymbol("i".toCharArray()); //$NON-NLS-1$ nsC.addSymbol( nsC_i ); - ISymbol look = nsB.lookup("C"); //$NON-NLS-1$ + ISymbol look = nsB.lookup("C".toCharArray()); //$NON-NLS-1$ assertEquals( look, nsC ); nsB.addUsingDirective( nsC ); - IParameterizedSymbol f1 = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ f1.setType( ITypeInfo.t_function ); nsB.addSymbol( f1 ); - look = f1.lookup( "i" ); //$NON-NLS-1$ + look = f1.lookup( "i".toCharArray() ); //$NON-NLS-1$ assertEquals( look, nsC_i ); //C::i visible and hides A::i - IContainerSymbol nsD = table.newContainerSymbol("D"); //$NON-NLS-1$ + IContainerSymbol nsD = table.newContainerSymbol("D".toCharArray()); //$NON-NLS-1$ nsD.setType( ITypeInfo.t_namespace ); nsA.addSymbol( nsD ); - look = nsD.lookup("B"); //$NON-NLS-1$ + look = nsD.lookup("B".toCharArray()); //$NON-NLS-1$ assertEquals( look, nsB ); nsD.addUsingDirective( nsB ); - look = nsD.lookup("C"); //$NON-NLS-1$ + look = nsD.lookup("C".toCharArray()); //$NON-NLS-1$ assertEquals( look, nsC ); nsD.addUsingDirective( nsC ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f2" ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f2".toCharArray() ); //$NON-NLS-1$ f2.setType( ITypeInfo.t_function ); nsD.addSymbol( f2 ); try { - look = f2.lookup( "i" ); //$NON-NLS-1$ + look = f2.lookup( "i".toCharArray() ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ) @@ -648,18 +649,18 @@ public class ParserSymbolTableTest extends TestCase { assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous ); } - IParameterizedSymbol f3 = table.newParameterizedSymbol("f3"); //$NON-NLS-1$ + IParameterizedSymbol f3 = table.newParameterizedSymbol("f3".toCharArray()); //$NON-NLS-1$ f3.setType( ITypeInfo.t_function ); nsA.addSymbol( f3 ); - look = f3.lookup("i"); //$NON-NLS-1$ + look = f3.lookup("i".toCharArray()); //$NON-NLS-1$ assertEquals( look, nsA_i ); //uses A::i - IParameterizedSymbol f4 = table.newParameterizedSymbol("f4"); //$NON-NLS-1$ + IParameterizedSymbol f4 = table.newParameterizedSymbol("f4".toCharArray()); //$NON-NLS-1$ f4.setType( ITypeInfo.t_function ); table.getCompilationUnit().addSymbol( f4 ); - look = f4.lookup("i"); //$NON-NLS-1$ + look = f4.lookup("i".toCharArray()); //$NON-NLS-1$ assertEquals( look, null );//neither i is visible here. assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -689,24 +690,24 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IContainerSymbol nsM = table.newContainerSymbol( "M" ); //$NON-NLS-1$ + IContainerSymbol nsM = table.newContainerSymbol( "M".toCharArray() ); //$NON-NLS-1$ nsM.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsM ); - ISymbol nsM_i = table.newSymbol("i"); //$NON-NLS-1$ + ISymbol nsM_i = table.newSymbol("i".toCharArray()); //$NON-NLS-1$ nsM.addSymbol( nsM_i ); - IContainerSymbol nsN = table.newContainerSymbol( "N" ); //$NON-NLS-1$ + IContainerSymbol nsN = table.newContainerSymbol( "N".toCharArray() ); //$NON-NLS-1$ nsN.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsN ); - ISymbol nsN_i = table.newSymbol("i"); //$NON-NLS-1$ + ISymbol nsN_i = table.newSymbol("i".toCharArray()); //$NON-NLS-1$ nsN.addSymbol( nsN_i ); nsN.addUsingDirective( nsM ); - IParameterizedSymbol f = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ compUnit.addSymbol( f ); f.addUsingDirective( nsN ); @@ -714,7 +715,7 @@ public class ParserSymbolTableTest extends TestCase { ISymbol look = null; try { - look = f.lookup( "i" ); //$NON-NLS-1$ + look = f.lookup( "i".toCharArray() ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ) @@ -723,10 +724,10 @@ public class ParserSymbolTableTest extends TestCase { assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous ); } - look = f.lookupNestedNameSpecifier("N"); //$NON-NLS-1$ + look = f.lookupNestedNameSpecifier("N".toCharArray()); //$NON-NLS-1$ assertEquals( look, nsN ); - look = ((IContainerSymbol) look).qualifiedLookup("i"); //ok //$NON-NLS-1$ + look = ((IContainerSymbol) look).qualifiedLookup("i".toCharArray()); //ok //$NON-NLS-1$ assertEquals( look, nsN_i ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -760,36 +761,36 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IContainerSymbol nsA = table.newContainerSymbol("A"); //$NON-NLS-1$ + IContainerSymbol nsA = table.newContainerSymbol("A".toCharArray()); //$NON-NLS-1$ nsA.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsA ); - ISymbol a = table.newSymbol("a"); //$NON-NLS-1$ + ISymbol a = table.newSymbol("a".toCharArray()); //$NON-NLS-1$ nsA.addSymbol( a ); - IContainerSymbol nsB = table.newContainerSymbol("B"); //$NON-NLS-1$ + IContainerSymbol nsB = table.newContainerSymbol("B".toCharArray()); //$NON-NLS-1$ nsB.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsB ); nsB.addUsingDirective( nsA ); - IContainerSymbol nsC = table.newContainerSymbol("C"); //$NON-NLS-1$ + IContainerSymbol nsC = table.newContainerSymbol("C".toCharArray()); //$NON-NLS-1$ nsC.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsC ); nsC.addUsingDirective( nsA ); - IContainerSymbol nsBC = table.newContainerSymbol("BC"); //$NON-NLS-1$ + IContainerSymbol nsBC = table.newContainerSymbol("BC".toCharArray()); //$NON-NLS-1$ nsBC.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsBC ); nsBC.addUsingDirective( nsB ); nsBC.addUsingDirective( nsC ); - IParameterizedSymbol f = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ f.setType(ITypeInfo.t_function); compUnit.addSymbol( f ); - ISymbol look = f.lookupNestedNameSpecifier("BC"); //$NON-NLS-1$ + ISymbol look = f.lookupNestedNameSpecifier("BC".toCharArray()); //$NON-NLS-1$ assertEquals( look, nsBC ); - look = ((IContainerSymbol)look).qualifiedLookup("a"); //$NON-NLS-1$ + look = ((IContainerSymbol)look).qualifiedLookup("a".toCharArray()); //$NON-NLS-1$ assertEquals( look, a ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -822,41 +823,41 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IContainerSymbol nsB = table.newContainerSymbol( "B" ); //$NON-NLS-1$ + IContainerSymbol nsB = table.newContainerSymbol( "B".toCharArray() ); //$NON-NLS-1$ nsB.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsB ); - ISymbol b = table.newSymbol("b"); //$NON-NLS-1$ + ISymbol b = table.newSymbol("b".toCharArray()); //$NON-NLS-1$ nsB.addSymbol( b ); - IContainerSymbol nsA = table.newContainerSymbol( "A" ); //$NON-NLS-1$ + IContainerSymbol nsA = table.newContainerSymbol( "A".toCharArray() ); //$NON-NLS-1$ nsA.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsA ); nsA.addUsingDirective( nsB ); - ISymbol a = table.newSymbol("a"); //$NON-NLS-1$ + ISymbol a = table.newSymbol("a".toCharArray()); //$NON-NLS-1$ nsA.addSymbol( a ); nsB.addUsingDirective( nsA ); - IParameterizedSymbol f = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ compUnit.addSymbol(f); - IContainerSymbol lookA = f.lookupNestedNameSpecifier("A"); //$NON-NLS-1$ + IContainerSymbol lookA = f.lookupNestedNameSpecifier("A".toCharArray()); //$NON-NLS-1$ assertEquals( lookA, nsA ); - ISymbol look = lookA.qualifiedLookup("a"); //$NON-NLS-1$ + ISymbol look = lookA.qualifiedLookup("a".toCharArray()); //$NON-NLS-1$ assertEquals( look, a ); - look = lookA.qualifiedLookup("b"); //$NON-NLS-1$ + look = lookA.qualifiedLookup("b".toCharArray()); //$NON-NLS-1$ assertEquals( look, b ); - IContainerSymbol lookB = f.lookupNestedNameSpecifier("B"); //$NON-NLS-1$ - look = lookB.qualifiedLookup("a"); //$NON-NLS-1$ + IContainerSymbol lookB = f.lookupNestedNameSpecifier("B".toCharArray()); //$NON-NLS-1$ + look = lookB.qualifiedLookup("a".toCharArray()); //$NON-NLS-1$ assertEquals( look, a ); - look = lookB.qualifiedLookup("b"); //$NON-NLS-1$ + look = lookB.qualifiedLookup("b".toCharArray()); //$NON-NLS-1$ assertEquals( look, b ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -888,23 +889,23 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IContainerSymbol nsA = table.newContainerSymbol( "A" ); //$NON-NLS-1$ + IContainerSymbol nsA = table.newContainerSymbol( "A".toCharArray() ); //$NON-NLS-1$ nsA.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsA ); - IContainerSymbol nsB = table.newContainerSymbol( "B" ); //$NON-NLS-1$ + IContainerSymbol nsB = table.newContainerSymbol( "B".toCharArray() ); //$NON-NLS-1$ nsB.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsB ); nsB.addUsingDirective( nsA ); nsA.addUsingDirective( nsB ); - IParameterizedSymbol f = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ compUnit.addSymbol(f); f.addUsingDirective(nsA); f.addUsingDirective(nsB); - ISymbol look = f.lookup("i"); //$NON-NLS-1$ + ISymbol look = f.lookup("i".toCharArray()); //$NON-NLS-1$ assertEquals( look, null ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -938,55 +939,55 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IContainerSymbol nsA = table.newContainerSymbol("A"); //$NON-NLS-1$ + IContainerSymbol nsA = table.newContainerSymbol("A".toCharArray()); //$NON-NLS-1$ nsA.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsA ); - IContainerSymbol structX = table.newContainerSymbol("x"); //$NON-NLS-1$ + IContainerSymbol structX = table.newContainerSymbol("x".toCharArray()); //$NON-NLS-1$ structX.setType( ITypeInfo.t_struct ); nsA.addSymbol( structX ); - ISymbol intX = table.newSymbol("x"); //$NON-NLS-1$ + ISymbol intX = table.newSymbol("x".toCharArray()); //$NON-NLS-1$ intX.setType( ITypeInfo.t_int ); nsA.addSymbol( intX ); - ISymbol intY = table.newSymbol("y"); //$NON-NLS-1$ + ISymbol intY = table.newSymbol("y".toCharArray()); //$NON-NLS-1$ intY.setType( ITypeInfo.t_int ); nsA.addSymbol( intY ); - IContainerSymbol nsB = table.newContainerSymbol("B"); //$NON-NLS-1$ + IContainerSymbol nsB = table.newContainerSymbol("B".toCharArray()); //$NON-NLS-1$ nsB.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsB ); - IContainerSymbol structY = table.newContainerSymbol("y"); //$NON-NLS-1$ + IContainerSymbol structY = table.newContainerSymbol("y".toCharArray()); //$NON-NLS-1$ structY.setType( ITypeInfo.t_struct ); nsB.addSymbol( structY ); - IContainerSymbol nsC = table.newContainerSymbol("C"); //$NON-NLS-1$ + IContainerSymbol nsC = table.newContainerSymbol("C".toCharArray()); //$NON-NLS-1$ nsC.setType( ITypeInfo.t_namespace); compUnit.addSymbol( nsC ); - ISymbol look = nsC.lookup("A"); //$NON-NLS-1$ + ISymbol look = nsC.lookup("A".toCharArray()); //$NON-NLS-1$ assertEquals( look, nsA ); nsC.addUsingDirective( nsA ); - look = nsC.lookup("B"); //$NON-NLS-1$ + look = nsC.lookup("B".toCharArray()); //$NON-NLS-1$ assertEquals( look, nsB ); nsC.addUsingDirective( nsB ); //lookup C::x - look = nsC.lookupNestedNameSpecifier("C"); //$NON-NLS-1$ + look = nsC.lookupNestedNameSpecifier("C".toCharArray()); //$NON-NLS-1$ assertEquals( look, nsC ); - look = ((IContainerSymbol)look).qualifiedLookup( "x" ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).qualifiedLookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( look, intX ); //lookup C::y - look = nsC.lookupNestedNameSpecifier("C"); //$NON-NLS-1$ + look = nsC.lookupNestedNameSpecifier("C".toCharArray()); //$NON-NLS-1$ assertEquals( look, nsC ); try{ - look = ((IContainerSymbol)look).qualifiedLookup( "y" ); //$NON-NLS-1$ + look = ((IContainerSymbol)look).qualifiedLookup( "y".toCharArray() ); //$NON-NLS-1$ assertTrue(false); } catch ( ParserSymbolTableException e ) { assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous ); @@ -997,7 +998,7 @@ public class ParserSymbolTableTest extends TestCase { /** * In a definition for a namespace member in which the declarator-id is a * qualified-id, given that the qualified-id for the namespace member has - * the form "nested-name-specifier unqualified-id", the unqualified-id shall + * the form "nested-name-specifier unqualified-id".toCharArray(), the unqualified-id shall * name a member of the namespace designated by the nested-name-specifier. * * namespace A{ @@ -1013,28 +1014,28 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IContainerSymbol nsA = table.newContainerSymbol( "A" ); //$NON-NLS-1$ + IContainerSymbol nsA = table.newContainerSymbol( "A".toCharArray() ); //$NON-NLS-1$ nsA.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( nsA ); - IContainerSymbol nsB = table.newContainerSymbol( "B" ); //$NON-NLS-1$ + IContainerSymbol nsB = table.newContainerSymbol( "B".toCharArray() ); //$NON-NLS-1$ nsB.setType( ITypeInfo.t_namespace ); nsA.addSymbol( nsB ); - IParameterizedSymbol f1 = table.newParameterizedSymbol("f1"); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol("f1".toCharArray()); //$NON-NLS-1$ f1.setType( ITypeInfo.t_function ); nsB.addSymbol( f1 ); nsA.addUsingDirective( nsB ); - IContainerSymbol lookA = compUnit.lookupNestedNameSpecifier( "A" ); //$NON-NLS-1$ + IContainerSymbol lookA = compUnit.lookupNestedNameSpecifier( "A".toCharArray() ); //$NON-NLS-1$ assertEquals( nsA, lookA ); - ISymbol look = lookA.lookupMemberForDefinition( "f1" ); //$NON-NLS-1$ + ISymbol look = lookA.lookupMemberForDefinition( "f1".toCharArray() ); //$NON-NLS-1$ assertEquals( look, null ); //but notice if you wanted to do A::f1 as a function call, it is ok - look = lookA.qualifiedLookup( "f1" ); //$NON-NLS-1$ + look = lookA.qualifiedLookup( "f1".toCharArray() ); //$NON-NLS-1$ assertEquals( look, f1 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -1068,19 +1069,19 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol("B"); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol("B".toCharArray()); //$NON-NLS-1$ B.setType( ITypeInfo.t_struct ); compUnit.addSymbol( B ); - IParameterizedSymbol f = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ f.setType( ITypeInfo.t_function ); B.addSymbol( f ); - IContainerSymbol E = table.newContainerSymbol( "E" ); //$NON-NLS-1$ + IContainerSymbol E = table.newContainerSymbol( "E".toCharArray() ); //$NON-NLS-1$ E.setType( ITypeInfo.t_enumeration ); B.addSymbol( E ); - ISymbol e = table.newSymbol( "e" ); //$NON-NLS-1$ + ISymbol e = table.newSymbol( "e".toCharArray() ); //$NON-NLS-1$ e.setType( ITypeInfo.t_enumerator ); E.addSymbol( e ); @@ -1088,36 +1089,36 @@ public class ParserSymbolTableTest extends TestCase { * TBD: Anonymous unions are not yet implemented */ - IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C" ); //$NON-NLS-1$ + IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C".toCharArray() ); //$NON-NLS-1$ C.setType( ITypeInfo.t_class ); compUnit.addSymbol( C ); - IParameterizedSymbol g = table.newParameterizedSymbol( "g" ); //$NON-NLS-1$ + IParameterizedSymbol g = table.newParameterizedSymbol( "g".toCharArray() ); //$NON-NLS-1$ g.setType( ITypeInfo.t_function ); C.addSymbol( g ); - IDerivableContainerSymbol D = table.newDerivableContainerSymbol( "D" ); //$NON-NLS-1$ + IDerivableContainerSymbol D = table.newDerivableContainerSymbol( "D".toCharArray() ); //$NON-NLS-1$ D.setType( ITypeInfo.t_struct ); - ISymbol look = compUnit.lookup( "B" ); //$NON-NLS-1$ + ISymbol look = compUnit.lookup( "B".toCharArray() ); //$NON-NLS-1$ assertEquals( look, B ); D.addParent( B ); compUnit.addSymbol( D ); - IContainerSymbol lookB = D.lookupNestedNameSpecifier("B"); //$NON-NLS-1$ + IContainerSymbol lookB = D.lookupNestedNameSpecifier("B".toCharArray()); //$NON-NLS-1$ assertEquals( lookB, B ); - D.addUsingDeclaration( "f", lookB ); //$NON-NLS-1$ - D.addUsingDeclaration( "e", lookB ); //$NON-NLS-1$ + D.addUsingDeclaration( "f".toCharArray(), lookB ); //$NON-NLS-1$ + D.addUsingDeclaration( "e".toCharArray(), lookB ); //$NON-NLS-1$ //TBD anonymous union - //D.addUsingDeclaration( "x", lookB ); + //D.addUsingDeclaration( "x".toCharArray(), lookB ); - look = D.lookupNestedNameSpecifier("C"); //$NON-NLS-1$ + look = D.lookupNestedNameSpecifier("C".toCharArray()); //$NON-NLS-1$ assertEquals( look, C ); try{ - D.addUsingDeclaration( "g", C ); //$NON-NLS-1$ + D.addUsingDeclaration( "g".toCharArray(), C ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException exception ){ @@ -1155,35 +1156,35 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IContainerSymbol A = table.newContainerSymbol( "A", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol A = table.newContainerSymbol( "A".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ compUnit.addSymbol( A ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ - f1.setReturnType( table.newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ + f1.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_void ) ); //$NON-NLS-1$ f1.addParameter( ITypeInfo.t_int, 0, null, false ); A.addSymbol( f1 ); - ISymbol look = compUnit.lookupNestedNameSpecifier("A"); //$NON-NLS-1$ + ISymbol look = compUnit.lookupNestedNameSpecifier("A".toCharArray()); //$NON-NLS-1$ assertEquals( look, A ); - IUsingDeclarationSymbol using = compUnit.addUsingDeclaration( "f", A ); //$NON-NLS-1$ + IUsingDeclarationSymbol using = compUnit.addUsingDeclaration( "f".toCharArray(), A ); //$NON-NLS-1$ assertEquals( using.getReferencedSymbols().size(), 1 ); assertEquals( using.getReferencedSymbols().get(0), f1 ); IParameterizedSymbol usingF = (IParameterizedSymbol)using.getDeclaredSymbols().get(0); - look = compUnit.lookup("A"); //$NON-NLS-1$ + look = compUnit.lookup("A".toCharArray()); //$NON-NLS-1$ assertEquals( look, A ); - IParameterizedSymbol f2 = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ f2.setType( ITypeInfo.t_function ); - f2.setReturnType( table.newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + f2.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_void ) ); //$NON-NLS-1$ f2.addParameter( ITypeInfo.t_char, 0, null, false ); A.addSymbol( f2 ); - IParameterizedSymbol foo = table.newParameterizedSymbol("foo"); //$NON-NLS-1$ + IParameterizedSymbol foo = table.newParameterizedSymbol("foo".toCharArray()); //$NON-NLS-1$ foo.setType( ITypeInfo.t_function ); compUnit.addSymbol( foo ); @@ -1191,19 +1192,19 @@ public class ParserSymbolTableTest extends TestCase { ITypeInfo param = TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ); paramList.add( param ); - look = foo.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = foo.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, usingF ); assertTrue( usingF.hasSameParameters( f1 ) ); - IParameterizedSymbol bar = table.newParameterizedSymbol( "bar" ); //$NON-NLS-1$ + IParameterizedSymbol bar = table.newParameterizedSymbol( "bar".toCharArray() ); //$NON-NLS-1$ bar.setType( ITypeInfo.t_function ); bar.addParameter( ITypeInfo.t_char, 0, null, false ); compUnit.addSymbol( bar ); - look = bar.lookupNestedNameSpecifier( "A" ); //$NON-NLS-1$ + look = bar.lookupNestedNameSpecifier( "A".toCharArray() ); //$NON-NLS-1$ assertEquals( look, A ); - using = bar.addUsingDeclaration( "f", A ); //$NON-NLS-1$ + using = bar.addUsingDeclaration( "f".toCharArray(), A ); //$NON-NLS-1$ List list = using.getReferencedSymbols(); assertTrue( list.contains( f1 ) ); @@ -1213,7 +1214,7 @@ public class ParserSymbolTableTest extends TestCase { int index = list.indexOf( f2 ); list = using.getDeclaredSymbols(); - look = bar.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = bar.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertTrue( look != null ); assertEquals( look, list.get( index ) ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -1230,16 +1231,16 @@ public class ParserSymbolTableTest extends TestCase { public void testThisPointer() throws Exception{ newTable(); - IDerivableContainerSymbol cls = table.newDerivableContainerSymbol( "class", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol cls = table.newDerivableContainerSymbol( "class".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ - IParameterizedSymbol fn = table.newParameterizedSymbol("function", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol fn = table.newParameterizedSymbol("function".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ fn.setType( ITypeInfo.t_function ); fn.getTypeInfo().setBit( true, ITypeInfo.isConst ); table.getCompilationUnit().addSymbol( cls ); cls.addSymbol( fn ); - ISymbol look = fn.lookup("this"); //$NON-NLS-1$ + ISymbol look = fn.lookup("this".toCharArray()); //$NON-NLS-1$ assertTrue( look != null ); assertEquals( look.getType(), ITypeInfo.t_type ); @@ -1262,20 +1263,20 @@ public class ParserSymbolTableTest extends TestCase { public void testEnumerator() throws Exception{ newTable(); - IContainerSymbol cls = table.newContainerSymbol("class"); //$NON-NLS-1$ + IContainerSymbol cls = table.newContainerSymbol("class".toCharArray()); //$NON-NLS-1$ cls.setType( ITypeInfo.t_class ); - IContainerSymbol enumeration = table.newContainerSymbol("enumeration"); //$NON-NLS-1$ + IContainerSymbol enumeration = table.newContainerSymbol("enumeration".toCharArray()); //$NON-NLS-1$ enumeration.setType( ITypeInfo.t_enumeration ); table.getCompilationUnit().addSymbol( cls ); cls.addSymbol( enumeration ); - ISymbol enumerator = table.newSymbol( "enumerator" ); //$NON-NLS-1$ + ISymbol enumerator = table.newSymbol( "enumerator".toCharArray() ); //$NON-NLS-1$ enumerator.setType( ITypeInfo.t_enumerator ); enumeration.addSymbol( enumerator ); - ISymbol look = cls.lookup( "enumerator" ); //$NON-NLS-1$ + ISymbol look = cls.lookup( "enumerator".toCharArray() ); //$NON-NLS-1$ assertEquals( look, enumerator ); assertEquals( look.getContainingSymbol(), cls ); assertEquals( look.getTypeSymbol(), enumeration ); @@ -1300,48 +1301,48 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IContainerSymbol NS = table.newContainerSymbol("NS"); //$NON-NLS-1$ + IContainerSymbol NS = table.newContainerSymbol("NS".toCharArray()); //$NON-NLS-1$ NS.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( NS ); - IDerivableContainerSymbol T = table.newDerivableContainerSymbol("T"); //$NON-NLS-1$ + IDerivableContainerSymbol T = table.newDerivableContainerSymbol("T".toCharArray()); //$NON-NLS-1$ T.setType( ITypeInfo.t_class ); NS.addSymbol( T ); - IParameterizedSymbol f = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ f.setType( ITypeInfo.t_function ); - f.setReturnType( table.newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + f.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_void ) ); //$NON-NLS-1$ - ISymbol look = NS.lookup( "T" ); //$NON-NLS-1$ + ISymbol look = NS.lookup( "T".toCharArray() ); //$NON-NLS-1$ assertEquals( look, T ); f.addParameter( look, 0, null, false ); NS.addSymbol( f ); - look = compUnit.lookupNestedNameSpecifier( "NS" ); //$NON-NLS-1$ + look = compUnit.lookupNestedNameSpecifier( "NS".toCharArray() ); //$NON-NLS-1$ assertEquals( look, NS ); - look = NS.qualifiedLookup( "T" ); //$NON-NLS-1$ + look = NS.qualifiedLookup( "T".toCharArray() ); //$NON-NLS-1$ assertEquals( look, T ); - ISymbol param = table.newSymbol("parm"); //$NON-NLS-1$ + ISymbol param = table.newSymbol("parm".toCharArray()); //$NON-NLS-1$ param.setType( ITypeInfo.t_type ); param.setTypeSymbol( look ); compUnit.addSymbol( param ); - IParameterizedSymbol main = table.newParameterizedSymbol("main"); //$NON-NLS-1$ + IParameterizedSymbol main = table.newParameterizedSymbol("main".toCharArray()); //$NON-NLS-1$ main.setType( ITypeInfo.t_function ); - main.setReturnType( table.newSymbol( "", ITypeInfo.t_int ) ); //$NON-NLS-1$ + main.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_int ) ); //$NON-NLS-1$ compUnit.addSymbol( main ); ArrayList paramList = new ArrayList(); - look = main.lookup( "parm" ); //$NON-NLS-1$ + look = main.lookup( "parm".toCharArray() ); //$NON-NLS-1$ assertEquals( look, param ); ITypeInfo p = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, look ); paramList.add( p ); - look = main.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = main.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -1374,62 +1375,62 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IContainerSymbol NS1 = table.newContainerSymbol( "NS1" ); //$NON-NLS-1$ + IContainerSymbol NS1 = table.newContainerSymbol( "NS1".toCharArray() ); //$NON-NLS-1$ NS1.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( NS1 ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ - f1.setReturnType( table.newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ + f1.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_void ) ); //$NON-NLS-1$ f1.addParameter( ITypeInfo.t_void, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); NS1.addSymbol( f1 ); - IContainerSymbol NS2 = table.newContainerSymbol( "NS2" ); //$NON-NLS-1$ + IContainerSymbol NS2 = table.newContainerSymbol( "NS2".toCharArray() ); //$NON-NLS-1$ NS2.setType( ITypeInfo.t_namespace ); compUnit.addSymbol( NS2 ); - ISymbol look = NS2.lookup( "NS1" ); //$NON-NLS-1$ + ISymbol look = NS2.lookup( "NS1".toCharArray() ); //$NON-NLS-1$ assertEquals( look, NS1 ); NS2.addUsingDirective( NS1 ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B" ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray() ); //$NON-NLS-1$ B.setType( ITypeInfo.t_class ); NS2.addSymbol( B ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f2.setType( ITypeInfo.t_function ); - f2.setReturnType( table.newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + f2.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_void ) ); //$NON-NLS-1$ f2.addParameter( ITypeInfo.t_void, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); NS2.addSymbol( f2 ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A" ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray() ); //$NON-NLS-1$ A.setType( ITypeInfo.t_class ); - look = compUnit.lookupNestedNameSpecifier( "NS2" ); //$NON-NLS-1$ + look = compUnit.lookupNestedNameSpecifier( "NS2".toCharArray() ); //$NON-NLS-1$ assertEquals( look, NS2 ); - look = NS2.qualifiedLookup( "B" ); //$NON-NLS-1$ + look = NS2.qualifiedLookup( "B".toCharArray() ); //$NON-NLS-1$ assertEquals( look, B ); A.addParent( B ); compUnit.addSymbol( A ); - look = compUnit.lookup( "A" ); //$NON-NLS-1$ + look = compUnit.lookup( "A".toCharArray() ); //$NON-NLS-1$ assertEquals( look, A ); - ISymbol a = table.newSymbol( "a" ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray() ); //$NON-NLS-1$ a.setType( ITypeInfo.t_type ); a.setTypeSymbol( look ); compUnit.addSymbol( a ); ArrayList paramList = new ArrayList(); - look = compUnit.lookup( "a" ); //$NON-NLS-1$ + look = compUnit.lookup( "a".toCharArray() ); //$NON-NLS-1$ assertEquals( look, a ); ITypeInfo param = TypeInfoProvider.newTypeInfo( look.getType(), 0, look, null, false ); //new PtrOp( PtrOp.t_reference ) param.applyOperatorExpression( ITypeInfo.OperatorExpression.addressof ); paramList.add( param ); - look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f2 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -1459,41 +1460,41 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C" ); //$NON-NLS-1$ + IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C".toCharArray() ); //$NON-NLS-1$ C.setType( ITypeInfo.t_class ); compUnit.addSymbol(C); - IParameterizedSymbol f1 = table.newParameterizedSymbol("foo"); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol("foo".toCharArray()); //$NON-NLS-1$ f1.setType( ITypeInfo.t_function ); - f1.setReturnType( table.newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + f1.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_void ) ); //$NON-NLS-1$ f1.addParameter( ITypeInfo.t_int, 0, null, false ); C.addSymbol( f1 ); - IParameterizedSymbol f2 = table.newParameterizedSymbol("foo"); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol("foo".toCharArray()); //$NON-NLS-1$ f2.setType( ITypeInfo.t_function ); - f2.setReturnType( table.newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + f2.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_void ) ); //$NON-NLS-1$ f2.addParameter( ITypeInfo.t_int, 0, null, false ); f2.addParameter( ITypeInfo.t_char, 0, null, false ); C.addSymbol( f2 ); - IParameterizedSymbol f3 = table.newParameterizedSymbol("foo"); //$NON-NLS-1$ + IParameterizedSymbol f3 = table.newParameterizedSymbol("foo".toCharArray()); //$NON-NLS-1$ f3.setType( ITypeInfo.t_function ); - f3.setReturnType( table.newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + f3.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_void ) ); //$NON-NLS-1$ f3.addParameter( ITypeInfo.t_int, 0, null, false ); f3.addParameter( ITypeInfo.t_char, 0, null, false ); f3.addParameter( C, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); C.addSymbol( f3 ); - ISymbol look = compUnit.lookup("C"); //$NON-NLS-1$ + ISymbol look = compUnit.lookup("C".toCharArray()); //$NON-NLS-1$ assertEquals( look, C ); - ISymbol c = table.newSymbol("c"); //$NON-NLS-1$ + ISymbol c = table.newSymbol("c".toCharArray()); //$NON-NLS-1$ c.setType( ITypeInfo.t_type ); c.setTypeSymbol( look ); c.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer, false, false ) ); compUnit.addSymbol( c ); - look = compUnit.lookup( "c" ); //$NON-NLS-1$ + look = compUnit.lookup( "c".toCharArray() ); //$NON-NLS-1$ assertEquals( look, c ); assertEquals( look.getTypeSymbol(), C ); @@ -1504,15 +1505,15 @@ public class ParserSymbolTableTest extends TestCase { ITypeInfo p3 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, c ); paramList.add( p1 ); - look = C.memberFunctionLookup( "foo", paramList ); //$NON-NLS-1$ + look = C.memberFunctionLookup( "foo".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f1 ); paramList.add( p2 ); - look = C.memberFunctionLookup( "foo", paramList ); //$NON-NLS-1$ + look = C.memberFunctionLookup( "foo".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f2 ); paramList.add( p3 ); - look = C.memberFunctionLookup( "foo", paramList ); //$NON-NLS-1$ + look = C.memberFunctionLookup( "foo".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f3 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -1534,12 +1535,12 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IParameterizedSymbol f1 = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ f1.setType( ITypeInfo.t_function ); f1.addParameter( ITypeInfo.t_int, 0, null, false ); compUnit.addSymbol( f1 ); - IParameterizedSymbol f2 = table.newParameterizedSymbol("f"); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol("f".toCharArray()); //$NON-NLS-1$ f2.setType( ITypeInfo.t_function ); f2.addParameter( ITypeInfo.t_char, 0, null, true ); compUnit.addSymbol( f2 ); @@ -1548,22 +1549,22 @@ public class ParserSymbolTableTest extends TestCase { ITypeInfo p1 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ); paramList.add( p1 ); - ISymbol look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + ISymbol look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f1 ); paramList.clear(); ITypeInfo p2 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ); paramList.add( p2 ); - look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f2 ); paramList.clear(); ITypeInfo p3 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_bool, 0, null ); paramList.add( p3 ); - look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f1 ); - look = compUnit.unqualifiedFunctionLookup( "f", null ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), null ); //$NON-NLS-1$ assertEquals( look, f2 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -1590,36 +1591,36 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A" ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray() ); //$NON-NLS-1$ A.setType( ITypeInfo.t_class ); compUnit.addSymbol( A ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B" ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray() ); //$NON-NLS-1$ B.setType( ITypeInfo.t_class ); B.addParent( A ); compUnit.addSymbol( B ); - IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C" ); //$NON-NLS-1$ + IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C".toCharArray() ); //$NON-NLS-1$ C.setType( ITypeInfo.t_class ); C.addParent( B ); compUnit.addSymbol( C ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f1.setType( ITypeInfo.t_function ); f1.addParameter( A, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); compUnit.addSymbol( f1 ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f2.setType( ITypeInfo.t_function ); f2.addParameter( B, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); compUnit.addSymbol( f2 ); - ISymbol a = table.newSymbol( "a" ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray() ); //$NON-NLS-1$ a.setType( ITypeInfo.t_type ); a.setTypeSymbol( A ); a.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer, false, false ) ); - ISymbol c = table.newSymbol( "c" ); //$NON-NLS-1$ + ISymbol c = table.newSymbol( "c".toCharArray() ); //$NON-NLS-1$ c.setType( ITypeInfo.t_type ); c.setTypeSymbol( C ); c.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer, false, false ) ); @@ -1627,13 +1628,13 @@ public class ParserSymbolTableTest extends TestCase { ArrayList paramList = new ArrayList(); ITypeInfo p1 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, a ); paramList.add( p1 ); - ISymbol look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + ISymbol look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f1 ); paramList.clear(); ITypeInfo p2 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, c ); paramList.add( p2 ); - look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f2 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -1663,38 +1664,38 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A" ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray() ); //$NON-NLS-1$ A.setType( ITypeInfo.t_class ); compUnit.addSymbol( A ); - ISymbol B = table.newSymbol( "B" ); //$NON-NLS-1$ + ISymbol B = table.newSymbol( "B".toCharArray() ); //$NON-NLS-1$ B.setType( ITypeInfo.t_type ); B.setTypeSymbol( A ); B.getTypeInfo().setBit( true, ITypeInfo.isTypedef ); B.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer, false, false ) ); compUnit.addSymbol( B ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f1.setType( ITypeInfo.t_function ); f1.addParameter( A, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); compUnit.addSymbol( f1 ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f2.setType( ITypeInfo.t_function ); f2.addParameter( A, 0, null, false ); compUnit.addSymbol( f2 ); - ISymbol a = table.newSymbol( "a" ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray() ); //$NON-NLS-1$ a.setType( ITypeInfo.t_type ); a.setTypeSymbol( A ); compUnit.addSymbol( a ); - ISymbol b = table.newSymbol( "b" ); //$NON-NLS-1$ + ISymbol b = table.newSymbol( "b".toCharArray() ); //$NON-NLS-1$ b.setType( ITypeInfo.t_type ); b.setTypeSymbol( B ); compUnit.addSymbol( b ); - ISymbol array = table.newSymbol( "array" ); //$NON-NLS-1$ + ISymbol array = table.newSymbol( "array".toCharArray() ); //$NON-NLS-1$ array.setType( ITypeInfo.t_type ); array.setTypeSymbol( A ); array.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_array, false, false ) ); @@ -1703,28 +1704,28 @@ public class ParserSymbolTableTest extends TestCase { ITypeInfo p = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, a ); paramList.add( p ); - ISymbol look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + ISymbol look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f2 ); p.applyOperatorExpression( ITypeInfo.OperatorExpression.addressof ); - look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f1 ); p.setTypeSymbol( b ); p.getPtrOperators().clear(); - look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f1 ); p = p.getFinalType( null ); p.applyOperatorExpression( ITypeInfo.OperatorExpression.indirection ); paramList.clear(); paramList.add( p ); - look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f2 ); p.setTypeSymbol( array ); p.getPtrOperators().clear(); - look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f1 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -1750,25 +1751,25 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A" ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray() ); //$NON-NLS-1$ A.setType( ITypeInfo.t_class ); compUnit.addSymbol( A ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B" ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray() ); //$NON-NLS-1$ B.setType( ITypeInfo.t_class ); compUnit.addSymbol( B ); - IParameterizedSymbol constructor = table.newParameterizedSymbol("B"); //$NON-NLS-1$ + IParameterizedSymbol constructor = table.newParameterizedSymbol("B".toCharArray()); //$NON-NLS-1$ constructor.setType( ITypeInfo.t_constructor ); constructor.addParameter( A, 0, null, false ); B.addConstructor( constructor ); - IParameterizedSymbol f = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f.setType( ITypeInfo.t_function ); f.addParameter( B, 0, null, false ); compUnit.addSymbol( f ); - ISymbol a = table.newSymbol( "a" ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray() ); //$NON-NLS-1$ a.setTypeInfo( TypeInfoProvider.newTypeInfo( ITypeInfo.t_type ) ); a.setTypeSymbol( A ); compUnit.addSymbol( a ); @@ -1777,7 +1778,7 @@ public class ParserSymbolTableTest extends TestCase { ITypeInfo p = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, a ); paramList.add( p ); - ISymbol look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + ISymbol look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -1808,29 +1809,29 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f1.setType( ITypeInfo.t_function ); f1.addParameter( ITypeInfo.t_int, ITypeInfo.isConst, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer, false, false ), false ); f1.addParameter( ITypeInfo.t_int, ITypeInfo.isShort, null, false ); compUnit.addSymbol( f1 ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f2.setType( ITypeInfo.t_function ); f2.addParameter( ITypeInfo.t_int, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); f2.addParameter( ITypeInfo.t_int, 0, null, false ); compUnit.addSymbol( f2 ); - ISymbol i = table.newSymbol( "i" ); //$NON-NLS-1$ + ISymbol i = table.newSymbol( "i".toCharArray() ); //$NON-NLS-1$ i.setType( ITypeInfo.t_int ); compUnit.addSymbol( i ); - ISymbol s = table.newSymbol( "s" ); //$NON-NLS-1$ + ISymbol s = table.newSymbol( "s".toCharArray() ); //$NON-NLS-1$ s.setType( ITypeInfo.t_int ); s.getTypeInfo().setBit( true, ITypeInfo.isShort ); compUnit.addSymbol( s ); - IParameterizedSymbol main = table.newParameterizedSymbol( "main" ); //$NON-NLS-1$ + IParameterizedSymbol main = table.newParameterizedSymbol( "main".toCharArray() ); //$NON-NLS-1$ main.setType( ITypeInfo.t_function ); compUnit.addSymbol( main ); @@ -1844,7 +1845,7 @@ public class ParserSymbolTableTest extends TestCase { ISymbol look = null; try{ - look = main.unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + look = main.unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous ); @@ -1854,14 +1855,14 @@ public class ParserSymbolTableTest extends TestCase { ITypeInfo p3 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, ITypeInfo.isLong, null ); params.add( p1 ); params.add( p3 ); - look = main.unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + look = main.unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( look, f2 ); params.clear(); ITypeInfo p4 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_char, 0, null ); params.add( p1 ); params.add( p4 ); - look = main.unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + look = main.unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( look, f2 ); params.clear(); @@ -1869,7 +1870,7 @@ public class ParserSymbolTableTest extends TestCase { params.add( p1 ); params.add( p3 ); - look = main.unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + look = main.unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( look, f1 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -1903,30 +1904,30 @@ public class ParserSymbolTableTest extends TestCase { IContainerSymbol compUnit = table.getCompilationUnit(); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B" ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray() ); //$NON-NLS-1$ B.setType( ITypeInfo.t_class ); compUnit.addSymbol( B ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A" ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray() ); //$NON-NLS-1$ A.setType( ITypeInfo.t_class ); compUnit.addSymbol( A ); - IParameterizedSymbol constructA = table.newParameterizedSymbol( "A" ); //$NON-NLS-1$ + IParameterizedSymbol constructA = table.newParameterizedSymbol( "A".toCharArray() ); //$NON-NLS-1$ constructA.setType( ITypeInfo.t_constructor ); constructA.addParameter( B, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference ), false ); A.addConstructor( constructA ); - IParameterizedSymbol operator = table.newParameterizedSymbol( "operator A" ); //$NON-NLS-1$ + IParameterizedSymbol operator = table.newParameterizedSymbol( "operator A".toCharArray() ); //$NON-NLS-1$ operator.setType( ITypeInfo.t_function ); B.addSymbol( operator ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f1.setType( ITypeInfo.t_function ); f1.addParameter( A, 0, null, false ); compUnit.addSymbol( f1 ); - ISymbol b = table.newSymbol( "b" ); //$NON-NLS-1$ + ISymbol b = table.newSymbol( "b".toCharArray() ); //$NON-NLS-1$ b.setType( ITypeInfo.t_type ); b.setTypeSymbol( B ); @@ -1937,39 +1938,39 @@ public class ParserSymbolTableTest extends TestCase { ISymbol look = null; try{ - look = compUnit.unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertTrue( false ); } catch( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous ); } - IDerivableContainerSymbol C = table.newDerivableContainerSymbol("C"); //$NON-NLS-1$ + IDerivableContainerSymbol C = table.newDerivableContainerSymbol("C".toCharArray()); //$NON-NLS-1$ C.setType( ITypeInfo.t_class ); compUnit.addSymbol( C ); - IParameterizedSymbol constructC = table.newParameterizedSymbol("C"); //$NON-NLS-1$ + IParameterizedSymbol constructC = table.newParameterizedSymbol("C".toCharArray()); //$NON-NLS-1$ constructC.setType( ITypeInfo.t_constructor ); constructC.addParameter( B, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference ), false ); C.addConstructor( constructC ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f2.setType( ITypeInfo.t_function ); f2.addParameter( C, 0, null, false ); compUnit.addSymbol( f2 ); try{ - look = compUnit.unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertTrue( false ); } catch( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous ); } - IParameterizedSymbol f3 = table.newParameterizedSymbol( "f" ); //$NON-NLS-1$ + IParameterizedSymbol f3 = table.newParameterizedSymbol( "f".toCharArray() ); //$NON-NLS-1$ f3.setType( ITypeInfo.t_function ); f3.addParameter( B, 0, null, false ); compUnit.addSymbol( f3 ); - look = compUnit.unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + look = compUnit.unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( look, f3 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -1977,24 +1978,24 @@ public class ParserSymbolTableTest extends TestCase { // public void testMarkRollback() throws Exception{ // newTable(); // -// IDerivableContainerSymbol A = table.newDerivableContainerSymbol("A"); +// IDerivableContainerSymbol A = table.newDerivableContainerSymbol("A".toCharArray()); // A.setType( TypeInfo.t_class ); // table.getCompilationUnit().addSymbol( A ); // // Mark mark = table.setMark(); // -// ISymbol f = table.newSymbol("f"); +// ISymbol f = table.newSymbol("f".toCharArray()); // A.addSymbol( f ); // -// ISymbol look = A.lookup("f"); +// ISymbol look = A.lookup("f".toCharArray()); // assertEquals( look, f ); // // assertTrue( table.rollBack( mark ) ); // -// look = A.lookup("f"); +// look = A.lookup("f".toCharArray()); // assertEquals( look, null ); // -// IDerivableContainerSymbol B = table.newDerivableContainerSymbol("B"); +// IDerivableContainerSymbol B = table.newDerivableContainerSymbol("B".toCharArray()); // B.setType( TypeInfo.t_class ); // // mark = table.setMark(); @@ -2003,7 +2004,7 @@ public class ParserSymbolTableTest extends TestCase { // A.addParent( B ); // Mark mark3 = table.setMark(); // -// IParameterizedSymbol C = table.newParameterizedSymbol("C"); +// IParameterizedSymbol C = table.newParameterizedSymbol("C".toCharArray()); // C.addParameter( TypeInfo.t_class, 0, null, false ); // // assertEquals( C.getParameterList().size(), 1 ); @@ -2037,20 +2038,20 @@ public class ParserSymbolTableTest extends TestCase { public void testForwardClassDeclaration() throws Exception{ newTable(); - ISymbol forwardSymbol = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + ISymbol forwardSymbol = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ forwardSymbol.setIsForwardDeclaration( true ); table.getCompilationUnit().addSymbol( forwardSymbol ); /*...*/ - ISymbol lookup = table.getCompilationUnit().lookup( "A" ); //$NON-NLS-1$ - ISymbol otherLookup = table.getCompilationUnit().elaboratedLookup( ITypeInfo.t_class, "A" ); //$NON-NLS-1$ + ISymbol lookup = table.getCompilationUnit().lookup( "A".toCharArray() ); //$NON-NLS-1$ + ISymbol otherLookup = table.getCompilationUnit().elaboratedLookup( ITypeInfo.t_class, "A".toCharArray() ); //$NON-NLS-1$ assertEquals( lookup, otherLookup ); assertEquals( lookup, forwardSymbol ); - ISymbol a = table.newSymbol( "a", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ a.setTypeSymbol( forwardSymbol ); a.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ) ); @@ -2058,21 +2059,21 @@ public class ParserSymbolTableTest extends TestCase { /*...*/ - lookup = table.getCompilationUnit().lookup( "A" ); //$NON-NLS-1$ - IDerivableContainerSymbol classA = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().lookup( "A".toCharArray() ); //$NON-NLS-1$ + IDerivableContainerSymbol classA = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ assertTrue( lookup.isForwardDeclaration() ); lookup.setForwardSymbol( classA ); table.getCompilationUnit().addSymbol( classA ); - lookup = table.getCompilationUnit().lookup( "a" ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().lookup( "a".toCharArray() ); //$NON-NLS-1$ assertEquals( lookup, a ); assertEquals( a.getTypeSymbol(), classA ); - lookup = table.getCompilationUnit().lookup( "A" ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().lookup( "A".toCharArray() ); //$NON-NLS-1$ assertEquals( lookup, classA ); - lookup = table.getCompilationUnit().elaboratedLookup( ITypeInfo.t_class, "A" ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().elaboratedLookup( ITypeInfo.t_class, "A".toCharArray() ); //$NON-NLS-1$ assertEquals( lookup, classA ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -2102,22 +2103,22 @@ public class ParserSymbolTableTest extends TestCase { public void testForwardDeclarationUsedAsFunctionParam() throws Exception{ newTable(); - ISymbol forwardSymbol = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + ISymbol forwardSymbol = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ forwardSymbol.setIsForwardDeclaration( true ); table.getCompilationUnit().addSymbol( forwardSymbol ); /*...*/ - IDerivableContainerSymbol classB = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol classB = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ - IParameterizedSymbol fn1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ - ISymbol lookup = table.getCompilationUnit().lookup( "A" ); //$NON-NLS-1$ + IParameterizedSymbol fn1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ + ISymbol lookup = table.getCompilationUnit().lookup( "A".toCharArray() ); //$NON-NLS-1$ assertEquals( lookup, forwardSymbol ); fn1.addParameter( lookup, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); fn1.getTypeInfo().setBit( true, ITypeInfo.isStatic ); classB.addSymbol( fn1 ); - IParameterizedSymbol fn2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol fn2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ fn2.addParameter( ITypeInfo.t_int, 0, null, false ); fn2.getTypeInfo().setBit( true, ITypeInfo.isStatic ); classB.addSymbol( fn2 ); @@ -2126,8 +2127,8 @@ public class ParserSymbolTableTest extends TestCase { /*...*/ - ISymbol a1 = table.newSymbol( "a1", ITypeInfo.t_type ); //$NON-NLS-1$ - lookup = table.getCompilationUnit().lookup( "A" ); //$NON-NLS-1$ + ISymbol a1 = table.newSymbol( "a1".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().lookup( "A".toCharArray() ); //$NON-NLS-1$ assertEquals( lookup, forwardSymbol ); a1.setTypeSymbol( lookup ); a1.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ) ); @@ -2136,15 +2137,15 @@ public class ParserSymbolTableTest extends TestCase { /*...*/ - lookup = table.getCompilationUnit().lookup( "A" ); //$NON-NLS-1$ - IDerivableContainerSymbol classA = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().lookup( "A".toCharArray() ); //$NON-NLS-1$ + IDerivableContainerSymbol classA = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ assertTrue( lookup.isForwardDeclaration() ); lookup.setForwardSymbol( classA ); table.getCompilationUnit().addSymbol( classA ); /*..*/ - ISymbol a2 = table.newSymbol( "a2", ITypeInfo.t_type ); //$NON-NLS-1$ - lookup = table.getCompilationUnit().lookup( "A" ); //$NON-NLS-1$ + ISymbol a2 = table.newSymbol( "a2".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().lookup( "A".toCharArray() ); //$NON-NLS-1$ assertEquals( lookup, classA ); a2.setTypeSymbol( lookup ); a2.addPtrOperator( new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ) ); @@ -2156,13 +2157,13 @@ public class ParserSymbolTableTest extends TestCase { ArrayList paramList = new ArrayList(); ITypeInfo p1 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, a1 ); paramList.add( p1 ); - ISymbol look = classB.memberFunctionLookup( "f", paramList ); //$NON-NLS-1$ + ISymbol look = classB.memberFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, fn1 ); paramList.clear(); p1 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, a2 ); paramList.add( p1 ); - look = classB.memberFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = classB.memberFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, fn1 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -2170,15 +2171,15 @@ public class ParserSymbolTableTest extends TestCase { public void testConstructors() throws Exception{ newTable(); - IDerivableContainerSymbol classA = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol classA = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ - IParameterizedSymbol constructor1 = table.newParameterizedSymbol( "A", ITypeInfo.t_constructor ); //$NON-NLS-1$ + IParameterizedSymbol constructor1 = table.newParameterizedSymbol( "A".toCharArray(), ITypeInfo.t_constructor ); //$NON-NLS-1$ constructor1.addParameter( classA, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference ), false ); - IParameterizedSymbol constructor2 = table.newParameterizedSymbol( "A", ITypeInfo.t_constructor ); //$NON-NLS-1$ + IParameterizedSymbol constructor2 = table.newParameterizedSymbol( "A".toCharArray(), ITypeInfo.t_constructor ); //$NON-NLS-1$ constructor2.addParameter( ITypeInfo.t_int, 0, null, false ); - IParameterizedSymbol constructor3 = table.newParameterizedSymbol( "A", ITypeInfo.t_constructor ); //$NON-NLS-1$ + IParameterizedSymbol constructor3 = table.newParameterizedSymbol( "A".toCharArray(), ITypeInfo.t_constructor ); //$NON-NLS-1$ constructor3.addParameter( ITypeInfo.t_char, 0, null, false ); classA.addConstructor( constructor1 ); @@ -2218,21 +2219,21 @@ public class ParserSymbolTableTest extends TestCase { public void testNamespaceAlias() throws Exception{ newTable(); - IContainerSymbol NSA = table.newContainerSymbol( "A", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol NSA = table.newContainerSymbol( "A".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( NSA ); - ISymbol x = table.newSymbol( "x", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol x = table.newSymbol( "x".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ NSA.addSymbol( x ); - IContainerSymbol NSB = table.newContainerSymbol( "B", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol NSB = table.newContainerSymbol( "B".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ NSB.setForwardSymbol( NSA ); //alias B to A table.getCompilationUnit().addSymbol( NSB ); - ISymbol lookup = table.getCompilationUnit().lookup( "B" ); //$NON-NLS-1$ + ISymbol lookup = table.getCompilationUnit().lookup( "B".toCharArray() ); //$NON-NLS-1$ assertEquals( lookup, NSB ); - lookup = NSB.lookup( "x" ); //$NON-NLS-1$ + lookup = NSB.lookup( "x".toCharArray() ); //$NON-NLS-1$ assertEquals( lookup, x ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -2254,26 +2255,26 @@ public class ParserSymbolTableTest extends TestCase { public void testUsingNamespaceAlias() throws Exception{ newTable(); - IContainerSymbol NSA = table.newContainerSymbol( "A", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol NSA = table.newContainerSymbol( "A".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( NSA ); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ - f.setReturnType( table.newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ + f.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_void ) ); //$NON-NLS-1$ NSA.addSymbol( f ); - IContainerSymbol NSB = table.newContainerSymbol( "B", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol NSB = table.newContainerSymbol( "B".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ NSB.setForwardSymbol( NSA ); table.getCompilationUnit().addSymbol( NSB ); //look for function that has no parameters ArrayList paramList = new ArrayList(); - ISymbol look = NSB.qualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + ISymbol look = NSB.qualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f ); table.getCompilationUnit().addUsingDirective( NSB ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, f ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -2289,10 +2290,10 @@ public class ParserSymbolTableTest extends TestCase { public void testBadParameterInfo() throws Exception{ newTable(); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ - f.setReturnType( table.newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ + f.setReturnType( table.newSymbol( "".toCharArray(), ITypeInfo.t_void ) ); //$NON-NLS-1$ - IDerivableContainerSymbol a = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol a = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( a ); f.addParameter( a, 0, null, false ); @@ -2305,15 +2306,15 @@ public class ParserSymbolTableTest extends TestCase { paramList.add( param ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, null ); - ISymbol intermediate = table.newSymbol( "", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol intermediate = table.newSymbol( "".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ param.setTypeSymbol( intermediate ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), paramList ); //$NON-NLS-1$ assertEquals( look, null ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -2337,18 +2338,18 @@ public class ParserSymbolTableTest extends TestCase { public void testGetConditionalOperand_bug43106() throws Exception{ newTable(); - IDerivableContainerSymbol clsA = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ - IDerivableContainerSymbol clsB = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol clsA = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol clsB = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ clsB.addParent( clsA ); table.getCompilationUnit().addSymbol( clsA ); table.getCompilationUnit().addSymbol( clsB ); - ISymbol a = table.newSymbol( "a", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ a.setTypeSymbol( clsA ); - ISymbol b = table.newSymbol( "b", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol b = table.newSymbol( "b".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ b.setTypeSymbol( clsB ); table.getCompilationUnit().addSymbol( a ); @@ -2362,9 +2363,9 @@ public class ParserSymbolTableTest extends TestCase { ITypeInfo returned = table.getConditionalOperand( secondOp, thirdOp ); assertEquals( returned, secondOp ); - IDerivableContainerSymbol clsC = table.newDerivableContainerSymbol( "C", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol clsC = table.newDerivableContainerSymbol( "C".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( clsC ); - ISymbol c = table.newSymbol( "c", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol c = table.newSymbol( "c".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ c.setTypeSymbol( clsC ); table.getCompilationUnit().addSymbol( c ); @@ -2374,11 +2375,11 @@ public class ParserSymbolTableTest extends TestCase { returned = table.getConditionalOperand( secondOp, anotherOp ); assertEquals( returned, null ); - IParameterizedSymbol constructorA = table.newParameterizedSymbol( "A", ITypeInfo.t_constructor ); //$NON-NLS-1$ + IParameterizedSymbol constructorA = table.newParameterizedSymbol( "A".toCharArray(), ITypeInfo.t_constructor ); //$NON-NLS-1$ constructorA.addParameter( clsC, 0, null, false ); clsA.addConstructor( constructorA ); - IParameterizedSymbol constructorC = table.newParameterizedSymbol( "C", ITypeInfo.t_constructor ); //$NON-NLS-1$ + IParameterizedSymbol constructorC = table.newParameterizedSymbol( "C".toCharArray(), ITypeInfo.t_constructor ); //$NON-NLS-1$ constructorC.addParameter( clsA, 0, null, false ); clsC.addConstructor( constructorC ); @@ -2412,17 +2413,17 @@ public class ParserSymbolTableTest extends TestCase { public void testDerivedReference() throws Exception{ newTable(); - IDerivableContainerSymbol clsA = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ - IDerivableContainerSymbol clsB = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ - IDerivableContainerSymbol clsC = table.newDerivableContainerSymbol( "C", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol clsA = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol clsB = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol clsC = table.newDerivableContainerSymbol( "C".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ clsB.addParent( clsA ); clsC.addParent( clsA, false, ASTAccessVisibility.PRIVATE, 0, null ); - ISymbol b = table.newSymbol("b", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol b = table.newSymbol("b".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ b.setTypeSymbol( clsB ); - ISymbol c = table.newSymbol("c", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol c = table.newSymbol("c".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ c.setTypeSymbol( clsC ); table.getCompilationUnit().addSymbol( clsA ); @@ -2431,7 +2432,7 @@ public class ParserSymbolTableTest extends TestCase { table.getCompilationUnit().addSymbol( b ); table.getCompilationUnit().addSymbol( c ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.addParameter( clsA, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference ), false ); table.getCompilationUnit().addSymbol( f1 ); @@ -2439,21 +2440,21 @@ public class ParserSymbolTableTest extends TestCase { ITypeInfo param = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, b ); parameters.add( param ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", parameters ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), parameters ); //$NON-NLS-1$ assertEquals( look, f1 ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.addParameter( clsB, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_reference ), false ); table.getCompilationUnit().addSymbol( f2 ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", parameters ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), parameters ); //$NON-NLS-1$ assertEquals( look, f2 ); parameters.clear(); param = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, c ); parameters.add( param ); try{ - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", parameters ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), parameters ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ){ //good @@ -2486,18 +2487,18 @@ public class ParserSymbolTableTest extends TestCase { public void testAddCopyConstructor() throws Exception { newTable(); - IDerivableContainerSymbol clsA = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol clsA = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( clsA ); - ISymbol a = table.newSymbol( "a", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol a = table.newSymbol( "a".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ a.setTypeSymbol( clsA ); table.getCompilationUnit().addSymbol( a ); - IDerivableContainerSymbol clsB = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol clsB = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ clsB.addParent( clsA ); table.getCompilationUnit().addSymbol( clsB ); - ISymbol b = table.newSymbol( "b", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol b = table.newSymbol( "b".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ b.setTypeSymbol( clsB ); table.getCompilationUnit().addSymbol( b ); @@ -2518,7 +2519,7 @@ public class ParserSymbolTableTest extends TestCase { public void testbug43834() throws Exception{ newTable(); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( f ); ArrayList parameters = new ArrayList(); @@ -2526,14 +2527,14 @@ public class ParserSymbolTableTest extends TestCase { parameters.add( param ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", parameters ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), parameters ); //$NON-NLS-1$ assertEquals( look, f ); f.addParameter( ITypeInfo.t_void, 0, null, false ); parameters.clear(); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", parameters ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), parameters ); //$NON-NLS-1$ assertEquals( look, f ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -2554,25 +2555,25 @@ public class ParserSymbolTableTest extends TestCase { */ public void testBug43503_AmbiguousUsing() throws Exception{ newTable(); - IContainerSymbol NSA = table.newContainerSymbol( "A", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol NSA = table.newContainerSymbol( "A".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( NSA ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ NSA.addSymbol( f1 ); - IContainerSymbol NSB = table.newContainerSymbol( "B", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol NSB = table.newContainerSymbol( "B".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( NSB ); - ISymbol f2 = table.newSymbol( "f", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol f2 = table.newSymbol( "f".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ NSB.addSymbol( f2 ); - IContainerSymbol NSC = table.newContainerSymbol( "C", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol NSC = table.newContainerSymbol( "C".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( NSC ); NSC.addUsingDirective( NSA ); NSC.addUsingDirective( NSB ); try{ - NSC.addUsingDeclaration( "f" ); //$NON-NLS-1$ + NSC.addUsingDeclaration( "f".toCharArray() ); //$NON-NLS-1$ assertTrue( false ); } catch ( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous ); @@ -2590,16 +2591,16 @@ public class ParserSymbolTableTest extends TestCase { public void testBug43503_UnableToResolveFunction() throws Exception{ newTable(); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.addParameter( ITypeInfo.t_int, 0, null, false ); table.getCompilationUnit().addSymbol( f1 ); table.getCompilationUnit().addSymbol( f2 ); try{ - table.getCompilationUnit().lookup( "f" ); //$NON-NLS-1$ + table.getCompilationUnit().lookup( "f".toCharArray() ); //$NON-NLS-1$ assertTrue( false ); } catch( ParserSymbolTableException e ){ assertEquals( e.reason, ParserSymbolTableException.r_UnableToResolveFunction ); @@ -2620,13 +2621,13 @@ public class ParserSymbolTableTest extends TestCase { public void testBug44510() throws Exception{ newTable(); - IParameterizedSymbol init1 = table.newParameterizedSymbol( "initialize", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol init1 = table.newParameterizedSymbol( "initialize".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( init1 ); - IParameterizedSymbol init2 = table.newParameterizedSymbol( "initialize", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol init2 = table.newParameterizedSymbol( "initialize".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "initialize", new ArrayList() ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "initialize".toCharArray(), new ArrayList() ); //$NON-NLS-1$ assertEquals( look, init1 ); init1.setIsForwardDeclaration( true ); @@ -2634,7 +2635,7 @@ public class ParserSymbolTableTest extends TestCase { table.getCompilationUnit().addSymbol( init2 ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "initialize", new ArrayList() ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "initialize".toCharArray(), new ArrayList() ); //$NON-NLS-1$ assertEquals( look, init2 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -2656,34 +2657,34 @@ public class ParserSymbolTableTest extends TestCase { public void testBug46882() throws Exception{ newTable(); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( A ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.addParameter( ITypeInfo.t_int, 0, null, false ); A.addSymbol( f1 ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ A.addSymbol( f2 ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ B.addParent( A ); table.getCompilationUnit().addSymbol( B ); - IParameterizedSymbol f3 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f3 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f3.addParameter( ITypeInfo.t_char, 0, null, false ); B.addSymbol( f3 ); List params = new ArrayList(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - ISymbol look = B.qualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + ISymbol look = B.qualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( look, f3 ); params.clear(); - look = B.qualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + look = B.qualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( look, null ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -2698,16 +2699,16 @@ public class ParserSymbolTableTest extends TestCase { public void testPrefixLookup_Unqualified() throws Exception { newTable( ParserLanguage.CPP, ParserMode.COMPLETION_PARSE ); - ISymbol aVar = table.newSymbol( "aVar", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol aVar = table.newSymbol( "aVar".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( aVar ); - IParameterizedSymbol foo = table.newParameterizedSymbol( "foo", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol foo = table.newParameterizedSymbol( "foo".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( foo ); - ISymbol anotherVar = table.newSymbol( "anotherVar", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol anotherVar = table.newSymbol( "anotherVar".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ foo.addSymbol( anotherVar ); - List results = foo.prefixLookup( null, "a", false, null ); //$NON-NLS-1$ + List results = foo.prefixLookup( null, "a".toCharArray(), false, null ); //$NON-NLS-1$ assertTrue( results != null ); assertEquals( results.size(), 2 ); @@ -2730,19 +2731,19 @@ public class ParserSymbolTableTest extends TestCase { public void testPrefixLookup_Qualified() throws Exception { newTable( ParserLanguage.CPP, ParserMode.COMPLETION_PARSE ); - ISymbol aVar = table.newSymbol( "aVar", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol aVar = table.newSymbol( "aVar".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( aVar ); - IDerivableContainerSymbol D = table.newDerivableContainerSymbol( "D", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol D = table.newDerivableContainerSymbol( "D".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( D ); - ISymbol aField = table.newSymbol( "aField", ITypeInfo.t_int ); //$NON-NLS-1$ - IParameterizedSymbol aMethod = table.newParameterizedSymbol( "aMethod", ITypeInfo.t_function ); //$NON-NLS-1$ + ISymbol aField = table.newSymbol( "aField".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ + IParameterizedSymbol aMethod = table.newParameterizedSymbol( "aMethod".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ D.addSymbol( aField ); D.addSymbol( aMethod ); - List results = D.prefixLookup( null, "a", true, null ); //$NON-NLS-1$ + List results = D.prefixLookup( null, "a".toCharArray(), true, null ); //$NON-NLS-1$ assertTrue( results != null ); assertEquals( results.size(), 2 ); @@ -2772,31 +2773,31 @@ public class ParserSymbolTableTest extends TestCase { public void testPrefixLookup_Inheritance() throws Exception { newTable( ParserLanguage.CPP, ParserMode.COMPLETION_PARSE ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( A ); - ISymbol aVar = table.newSymbol( "aVar", ITypeInfo.t_int ); //$NON-NLS-1$ - ISymbol anotherVar1 = table.newSymbol( "anotherVar", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol aVar = table.newSymbol( "aVar".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol anotherVar1 = table.newSymbol( "anotherVar".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ A.addSymbol( aVar ); A.addSymbol( anotherVar1 ); - IParameterizedSymbol af1 = table.newParameterizedSymbol( "af", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol af1 = table.newParameterizedSymbol( "af".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ A.addSymbol( af1 ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ B.addParent( A ); table.getCompilationUnit().addSymbol( B ); - ISymbol anotherVar2 = table.newSymbol( "anotherVar", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol anotherVar2 = table.newSymbol( "anotherVar".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ B.addSymbol( anotherVar2 ); - IParameterizedSymbol af2 = table.newParameterizedSymbol( "af", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol af2 = table.newParameterizedSymbol( "af".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ af2.addParameter( ITypeInfo.t_char, 0, null, false ); B.addSymbol( af2 ); - List results = B.prefixLookup( null, "a", true, null ); //$NON-NLS-1$ + List results = B.prefixLookup( null, "a".toCharArray(), true, null ); //$NON-NLS-1$ assertTrue( results != null ); assertEquals( results.size(), 3 ); @@ -2834,35 +2835,35 @@ public class ParserSymbolTableTest extends TestCase { public void testPrefixLookup_Ambiguities() throws Exception{ newTable( ParserLanguage.CPP, ParserMode.COMPLETION_PARSE ); - ISymbol aa = table.newSymbol( "aa", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol aa = table.newSymbol( "aa".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( aa ); - IContainerSymbol ns = table.newContainerSymbol( "", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol ns = table.newContainerSymbol( "".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( ns ); - IContainerSymbol U = table.newContainerSymbol( "U", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol U = table.newContainerSymbol( "U".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ ns.addSymbol( U ); - ISymbol a1 = table.newSymbol( "a", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol a1 = table.newSymbol( "a".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ U.addSymbol( a1 ); - IContainerSymbol V = table.newContainerSymbol( "V", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol V = table.newContainerSymbol( "V".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ ns.addSymbol( V ); - ISymbol a2 = table.newSymbol( "a", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol a2 = table.newSymbol( "a".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ V.addSymbol( a2 ); - IContainerSymbol W = table.newContainerSymbol( "W", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol W = table.newContainerSymbol( "W".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ ns.addSymbol( W ); - ISymbol a3 = table.newSymbol( "a", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol a3 = table.newSymbol( "a".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ W.addSymbol( a3 ); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ ns.addSymbol( f ); f.addUsingDirective( U ); f.addUsingDirective( V ); f.addUsingDirective( W ); - List results = f.prefixLookup( null, "a", false, null ); //$NON-NLS-1$ + List results = f.prefixLookup( null, "a".toCharArray(), false, null ); //$NON-NLS-1$ assertTrue( results != null ); assertEquals( results.size(), 1 ); @@ -2885,17 +2886,17 @@ public class ParserSymbolTableTest extends TestCase { public void testQualifiedUnqualifiedLookup() throws Exception{ newTable(); - ISymbol i = table.newSymbol( "i", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol i = table.newSymbol( "i".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( i ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( A ); - IParameterizedSymbol g = table.newParameterizedSymbol( "g", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol g = table.newParameterizedSymbol( "g".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ A.addSymbol( g ); - assertEquals( null, A.qualifiedLookup( "i" ) ); //$NON-NLS-1$ - assertEquals( i, g.lookup( "i" ) ); //$NON-NLS-1$ + assertEquals( null, A.qualifiedLookup( "i".toCharArray() ) ); //$NON-NLS-1$ + assertEquals( i, g.lookup( "i".toCharArray() ) ); //$NON-NLS-1$ assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -2915,16 +2916,16 @@ public class ParserSymbolTableTest extends TestCase { public void testVisibilityDetermination() throws Exception{ newTable(); - IDerivableContainerSymbol D = table.newDerivableContainerSymbol( "D", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol D = table.newDerivableContainerSymbol( "D".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( D ); - IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ - ISymbol i = table.newSymbol( "i", ITypeInfo.t_int ); //$NON-NLS-1$ - ISymbol j = table.newSymbol( "j", ITypeInfo.t_int ); //$NON-NLS-1$ + IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ + ISymbol i = table.newSymbol( "i".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol j = table.newSymbol( "j".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( A ); - ISymbol friend = A.lookupForFriendship( "D" ); //$NON-NLS-1$ + ISymbol friend = A.lookupForFriendship( "D".toCharArray() ); //$NON-NLS-1$ assertEquals( friend, D ); A.addFriend( friend ); @@ -2947,11 +2948,11 @@ public class ParserSymbolTableTest extends TestCase { extension = new StandardSymbolExtension( j, (ASTSymbol) field ); j.setASTExtension( extension ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ B.addParent( A, false, ASTAccessVisibility.PRIVATE, 0, null ); table.getCompilationUnit().addSymbol( B ); - IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ C.addParent( B ); C.addParent( A ); table.getCompilationUnit().addSymbol( C ); @@ -2981,34 +2982,34 @@ public class ParserSymbolTableTest extends TestCase { */ public void testPrefixFiltering() throws Exception{ newTable( ParserLanguage.CPP, ParserMode.COMPLETION_PARSE ); - IDerivableContainerSymbol a1 = table.newDerivableContainerSymbol( "a1", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol a1 = table.newDerivableContainerSymbol( "a1".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( a1 ); - IParameterizedSymbol aFoo = table.newParameterizedSymbol( "aFoo", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol aFoo = table.newParameterizedSymbol( "aFoo".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( aFoo ); - ISymbol aa = table.newSymbol( "aa", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol aa = table.newSymbol( "aa".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( aa ); - IDerivableContainerSymbol A2 = table.newDerivableContainerSymbol( "A2", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol A2 = table.newDerivableContainerSymbol( "A2".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( A2 ); - IDerivableContainerSymbol a3 = table.newDerivableContainerSymbol( "a3", ITypeInfo.t_struct ); //$NON-NLS-1$ + IDerivableContainerSymbol a3 = table.newDerivableContainerSymbol( "a3".toCharArray(), ITypeInfo.t_struct ); //$NON-NLS-1$ A2.addSymbol( a3 ); - ISymbol a3_int = table.newSymbol( "a3", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol a3_int = table.newSymbol( "a3".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ A2.addSymbol( a3_int ); - IParameterizedSymbol aF = table.newParameterizedSymbol( "aF", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol aF = table.newParameterizedSymbol( "aF".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ A2.addSymbol( aF ); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ A2.addSymbol( f ); - ISymbol aLocal = table.newSymbol( "aLocal", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol aLocal = table.newSymbol( "aLocal".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ f.addSymbol( aLocal ); - List results = f.prefixLookup( new TypeFilter( LookupKind.STRUCTURES ), "A", false, null ); //$NON-NLS-1$ + List results = f.prefixLookup( new TypeFilter( LookupKind.STRUCTURES ), "A".toCharArray(), false, null ); //$NON-NLS-1$ assertEquals( results.size(), 3 ); @@ -3016,7 +3017,7 @@ public class ParserSymbolTableTest extends TestCase { assertTrue( results.contains( A2 ) ); assertTrue( results.contains( a3 ) ); - results = f.prefixLookup( null, "a", false, null ); //$NON-NLS-1$ + results = f.prefixLookup( null, "a".toCharArray(), false, null ); //$NON-NLS-1$ assertEquals( results.size(), 7 ); assertTrue( results.contains( aF ) ); assertTrue( results.contains( A2 ) ); @@ -3026,23 +3027,23 @@ public class ParserSymbolTableTest extends TestCase { assertTrue( results.contains( aa ) ); assertTrue( results.contains( aLocal ) ); - results = f.prefixLookup( new TypeFilter( LookupKind.FUNCTIONS ), "a", false, null ); //$NON-NLS-1$ + results = f.prefixLookup( new TypeFilter( LookupKind.FUNCTIONS ), "a".toCharArray(), false, null ); //$NON-NLS-1$ assertEquals( results.size(), 1 ); assertTrue( results.contains( aFoo ) ); - results = f.prefixLookup( new TypeFilter( LookupKind.METHODS ), "a", false, null ); //$NON-NLS-1$ + results = f.prefixLookup( new TypeFilter( LookupKind.METHODS ), "a".toCharArray(), false, null ); //$NON-NLS-1$ assertEquals( results.size(), 1 ); assertTrue( results.contains( aF ) ); - results = f.prefixLookup( new TypeFilter( LookupKind.LOCAL_VARIABLES ), "a", false, null ); //$NON-NLS-1$ + results = f.prefixLookup( new TypeFilter( LookupKind.LOCAL_VARIABLES ), "a".toCharArray(), false, null ); //$NON-NLS-1$ assertEquals( results.size(), 1 ); assertTrue( results.contains( aLocal ) ); - results = f.prefixLookup( new TypeFilter( LookupKind.VARIABLES ), "a", false, null ); //$NON-NLS-1$ + results = f.prefixLookup( new TypeFilter( LookupKind.VARIABLES ), "a".toCharArray(), false, null ); //$NON-NLS-1$ assertEquals( results.size(), 1 ); assertTrue( results.contains( aa ) ); - results = f.prefixLookup( new TypeFilter( LookupKind.FIELDS), "a", false, null ); //$NON-NLS-1$ + results = f.prefixLookup( new TypeFilter( LookupKind.FIELDS), "a".toCharArray(), false, null ); //$NON-NLS-1$ assertEquals( results.size(), 1 ); assertTrue( results.contains( a3_int ) ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -3058,7 +3059,7 @@ public class ParserSymbolTableTest extends TestCase { public void testBug43110_Ellipses() throws Exception{ newTable(); - IParameterizedSymbol foo = table.newParameterizedSymbol( "foo", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol foo = table.newParameterizedSymbol( "foo".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ foo.setHasVariableArgs( true ); table.getCompilationUnit().addSymbol( foo ); @@ -3068,7 +3069,7 @@ public class ParserSymbolTableTest extends TestCase { ITypeInfo p1 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ); params.add( p1 ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "foo", params ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "foo".toCharArray(), params ); //$NON-NLS-1$ assertEquals( foo, look ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -3084,12 +3085,12 @@ public class ParserSymbolTableTest extends TestCase { public void testBug43110_EllipsesRanking() throws Exception{ newTable(); - IParameterizedSymbol foo1 = table.newParameterizedSymbol( "foo", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol foo1 = table.newParameterizedSymbol( "foo".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ foo1.setHasVariableArgs( true ); table.getCompilationUnit().addSymbol( foo1 ); - IParameterizedSymbol foo2 = table.newParameterizedSymbol( "foo", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol foo2 = table.newParameterizedSymbol( "foo".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ foo2.addParameter( ITypeInfo.t_int, 0, null, false ); table.getCompilationUnit().addSymbol( foo2 ); @@ -3098,7 +3099,7 @@ public class ParserSymbolTableTest extends TestCase { ITypeInfo p1 = TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ); params.add( p1 ); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "foo", params ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "foo".toCharArray(), params ); //$NON-NLS-1$ assertEquals( foo2, look ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -3114,17 +3115,17 @@ public class ParserSymbolTableTest extends TestCase { public void testBug43110_ElipsesRanking_2() throws Exception{ newTable(); - IParameterizedSymbol foo1 = table.newParameterizedSymbol( "foo", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol foo1 = table.newParameterizedSymbol( "foo".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ foo1.addParameter( ITypeInfo.t_int, 0, null, true ); table.getCompilationUnit().addSymbol( foo1 ); - IParameterizedSymbol foo2 = table.newParameterizedSymbol( "foo", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol foo2 = table.newParameterizedSymbol( "foo".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ foo2.setHasVariableArgs( true ); table.getCompilationUnit().addSymbol( foo2 ); List params = new ArrayList(); - ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "foo", params ); //$NON-NLS-1$ + ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "foo".toCharArray(), params ); //$NON-NLS-1$ assertEquals( foo1, look ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); @@ -3142,20 +3143,20 @@ public class ParserSymbolTableTest extends TestCase { public void testIterator_1() throws Exception{ newTable(); - ISymbol global = table.newSymbol( "global", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol global = table.newSymbol( "global".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( global ); - IDerivableContainerSymbol cls = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ + IDerivableContainerSymbol cls = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( cls ); - IParameterizedSymbol constructor = table.newParameterizedSymbol( "A", ITypeInfo.t_constructor ); //$NON-NLS-1$ + IParameterizedSymbol constructor = table.newParameterizedSymbol( "A".toCharArray(), ITypeInfo.t_constructor ); //$NON-NLS-1$ cls.addConstructor( constructor ); - ISymbol var = table.newSymbol( "var", ITypeInfo.t_int ); //$NON-NLS-1$ + ISymbol var = table.newSymbol( "var".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ cls.addSymbol( var ); - IParameterizedSymbol foo = table.newParameterizedSymbol( "foo", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol foo = table.newParameterizedSymbol( "foo".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ cls.addSymbol( foo ); @@ -3189,25 +3190,25 @@ public class ParserSymbolTableTest extends TestCase { public void testIterator_2() throws Exception{ newTable(); - IParameterizedSymbol foo = table.newParameterizedSymbol( "foo", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol foo = table.newParameterizedSymbol( "foo".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( foo ); - IContainerSymbol nsA = table.newContainerSymbol( "A", ITypeInfo.t_namespace ); //$NON-NLS-1$ + IContainerSymbol nsA = table.newContainerSymbol( "A".toCharArray(), ITypeInfo.t_namespace ); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( nsA ); - IParameterizedSymbol bar1 = table.newParameterizedSymbol( "bar", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol bar1 = table.newParameterizedSymbol( "bar".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ nsA.addSymbol( bar1 ); - IParameterizedSymbol bar2 = table.newParameterizedSymbol( "bar", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol bar2 = table.newParameterizedSymbol( "bar".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ bar2.addParameter( ITypeInfo.t_int, 0, null, false ); nsA.addSymbol( bar2 ); - IDerivableContainerSymbol B = table.newDerivableContainerSymbol("B", ITypeInfo.t_class); //$NON-NLS-1$ + IDerivableContainerSymbol B = table.newDerivableContainerSymbol("B".toCharArray(), ITypeInfo.t_class); //$NON-NLS-1$ table.getCompilationUnit().addSymbol( B ); B.addCopyConstructor(); - IParameterizedSymbol func = table.newParameterizedSymbol( "func", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol func = table.newParameterizedSymbol( "func".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ B.addSymbol( func ); IUsingDirectiveSymbol using = func.addUsingDirective( nsA ); @@ -3234,7 +3235,7 @@ public class ParserSymbolTableTest extends TestCase { //Copy constructor!! ISymbol copy = (ISymbol) iter.next(); assertTrue( copy instanceof IParameterizedSymbol ); - assertEquals( copy.getName(), "B" ); //$NON-NLS-1$ + assertTrue( CharArrayUtils.equals(copy.getName(), "B".toCharArray() ) ); //$NON-NLS-1$ assertEquals( copy.getType(), ITypeInfo.t_constructor ); assertEquals( iter.next(), func ); @@ -3243,7 +3244,7 @@ public class ParserSymbolTableTest extends TestCase { iter = func.getContentsIterator(); //this pointer!! ISymbol th = (ISymbol) iter.next(); - assertEquals( th.getName(), "this" ); //$NON-NLS-1$ + assertTrue( CharArrayUtils.equals(th.getName(), "this".toCharArray() ) ); //$NON-NLS-1$ assertEquals( th.getTypeSymbol(), B ); assertEquals( iter.next(), using ); @@ -3263,23 +3264,23 @@ public class ParserSymbolTableTest extends TestCase { */ public void testLongLong() throws Exception{ newTable(); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.addParameter( ITypeInfo.t_int, ITypeInfo.isLongLong, null, false ); table.getCompilationUnit().addSymbol( f1 ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.addParameter( ITypeInfo.t_int, ITypeInfo.isLong, null, false ); table.getCompilationUnit().addSymbol( f2 ); List params = new ArrayList(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, ITypeInfo.isLong, null ) ); - IParameterizedSymbol lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + IParameterizedSymbol lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( lookup, f2 ); params.clear(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, ITypeInfo.isLongLong, null ) ); - lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( lookup, f1 ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -3301,38 +3302,38 @@ public class ParserSymbolTableTest extends TestCase { public void testComplex() throws Exception{ newTable(); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f.addParameter( ITypeInfo.t_float, ITypeInfo.isComplex, null, false ); table.getCompilationUnit().addSymbol( f ); - IParameterizedSymbol g = table.newParameterizedSymbol( "g", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol g = table.newParameterizedSymbol( "g".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ g.addParameter( ITypeInfo.t_float, 0, null, false ); table.getCompilationUnit().addSymbol( g ); List params = new ArrayList(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_float, ITypeInfo.isComplex, null ) ); - IParameterizedSymbol lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + IParameterizedSymbol lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( lookup, f ); params.clear(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_float, 0, null ) ); - lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( lookup, f ); params.clear(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_float, ITypeInfo.isComplex, null ) ); - lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "g", params ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "g".toCharArray(), params ); //$NON-NLS-1$ assertEquals( lookup, g ); params.clear(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_float, ITypeInfo.isImaginary, null ) ); - lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "g", params ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "g".toCharArray(), params ); //$NON-NLS-1$ assertEquals( lookup, g ); - lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( lookup, f ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -3340,12 +3341,12 @@ public class ParserSymbolTableTest extends TestCase { public void test_Bool() throws Exception{ newTable(); - IParameterizedSymbol f = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f.addParameter( ITypeInfo.t__Bool, 0, null, false ); table.getCompilationUnit().addSymbol( f ); - IParameterizedSymbol g = table.newParameterizedSymbol( "g", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol g = table.newParameterizedSymbol( "g".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ g.addParameter( ITypeInfo.t_int, 0, null, false ); table.getCompilationUnit().addSymbol( g ); @@ -3353,15 +3354,15 @@ public class ParserSymbolTableTest extends TestCase { List params = new ArrayList(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t__Bool, 0, null ) ); - IParameterizedSymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + IParameterizedSymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( look, f ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "g", params ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "g".toCharArray(), params ); //$NON-NLS-1$ assertEquals( look, g ); params.clear(); params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); - look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ + look = table.getCompilationUnit().unqualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ assertEquals( look, f ); assertEquals( table.getTypeInfoProvider().numAllocated(), 0 ); } @@ -3377,14 +3378,14 @@ public class ParserSymbolTableTest extends TestCase { public void testBug47636FunctionParameterComparisons_1() throws Exception{ newTable(); - ISymbol Int = table.newSymbol( "Int", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol Int = table.newSymbol( "Int".toCharArray(), ITypeInfo.t_type ); //$NON-NLS-1$ Int.getTypeInfo().setBit( true, ITypeInfo.isTypedef ); - Int.setTypeSymbol( table.newSymbol( ParserSymbolTable.EMPTY_NAME, ITypeInfo.t_int ) ); + Int.setTypeSymbol( table.newSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY, ITypeInfo.t_int ) ); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.addParameter( ITypeInfo.t_int, 0, null, false ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.addParameter( Int, 0, null, false ); assertTrue( f1.hasSameParameters( f2 ) ); @@ -3398,10 +3399,10 @@ public class ParserSymbolTableTest extends TestCase { public void testBug47636FunctionParameterComparisons_2() throws Exception{ newTable(); - IParameterizedSymbol g1 = table.newParameterizedSymbol( "g", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol g1 = table.newParameterizedSymbol( "g".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ g1.addParameter( ITypeInfo.t_char, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); - IParameterizedSymbol g2 = table.newParameterizedSymbol( "g", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol g2 = table.newParameterizedSymbol( "g".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ g2.addParameter( ITypeInfo.t_char, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_array ), false ); assertTrue( g1.hasSameParameters( g2 ) ); @@ -3415,13 +3416,13 @@ public class ParserSymbolTableTest extends TestCase { public void testBug47636FunctionParameterComparisons_3() throws Exception{ newTable(); - IParameterizedSymbol f = table.newParameterizedSymbol( ParserSymbolTable.EMPTY_NAME, ITypeInfo.t_function ); - f.setReturnType( table.newSymbol( ParserSymbolTable.EMPTY_NAME, ITypeInfo.t_int ) ); + IParameterizedSymbol f = table.newParameterizedSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY, ITypeInfo.t_function ); + f.setReturnType( table.newSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY, ITypeInfo.t_int ) ); - IParameterizedSymbol h1 = table.newParameterizedSymbol( "h", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol h1 = table.newParameterizedSymbol( "h".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ h1.addParameter( f, 0, null, false ); - IParameterizedSymbol h2 = table.newParameterizedSymbol( "h", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol h2 = table.newParameterizedSymbol( "h".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ h2.addParameter( f, 0, new ITypeInfo.PtrOp( ITypeInfo.PtrOp.t_pointer ), false ); assertTrue( h1.hasSameParameters( h2 ) ); @@ -3435,10 +3436,10 @@ public class ParserSymbolTableTest extends TestCase { public void testBug47636FunctionParameterComparisons_4() throws Exception{ newTable(); - IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f1.addParameter( ITypeInfo.t_int, 0, null, false ); - IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ + IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ f2.addParameter( ITypeInfo.t_int, ITypeInfo.isConst, null, false ); assertTrue( f1.hasSameParameters( f2 ) ); @@ -3448,26 +3449,26 @@ public class ParserSymbolTableTest extends TestCase { // public void testBug52111RemoveSymbol() throws Exception{ // newTable(); // -// IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", ITypeInfo.t_class ); //$NON-NLS-1$ +// IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ // table.getCompilationUnit().addSymbol( A ); // -// ISymbol i = table.newSymbol( "i", ITypeInfo.t_int ); //$NON-NLS-1$ +// ISymbol i = table.newSymbol( "i".toCharArray(), ITypeInfo.t_int ); //$NON-NLS-1$ // A.addSymbol( i ); // -// IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ +// IParameterizedSymbol f1 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ // A.addSymbol( f1 ); // -// IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", ITypeInfo.t_function ); //$NON-NLS-1$ +// IParameterizedSymbol f2 = table.newParameterizedSymbol( "f".toCharArray(), ITypeInfo.t_function ); //$NON-NLS-1$ // f2.addParameter( ITypeInfo.t_int, 0, null, false ); // // A.addSymbol( f2 ); // -// IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", ITypeInfo.t_class ); //$NON-NLS-1$ +// IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B".toCharArray(), ITypeInfo.t_class ); //$NON-NLS-1$ // B.addParent( A ); // // table.getCompilationUnit().addSymbol( B ); // -// ISymbol look = B.qualifiedLookup( "i" ); //$NON-NLS-1$ +// ISymbol look = B.qualifiedLookup( "i".toCharArray() ); //$NON-NLS-1$ // assertEquals( look, i ); // // Iterator iter = A.getContentsIterator(); @@ -3483,12 +3484,12 @@ public class ParserSymbolTableTest extends TestCase { // assertEquals( iter.next(), f2 ); // assertFalse( iter.hasNext() ); // -// look = B.qualifiedLookup( "i" ); //$NON-NLS-1$ +// look = B.qualifiedLookup( "i".toCharArray() ); //$NON-NLS-1$ // assertNull( look ); // // List params = new ArrayList(); // -// look = B.qualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ +// look = B.qualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ // assertEquals( look, f1 ); // // assertTrue( A.removeSymbol( f1 ) ); @@ -3496,11 +3497,11 @@ public class ParserSymbolTableTest extends TestCase { // assertEquals( iter.next(), f2 ); // assertFalse( iter.hasNext() ); // -// look = B.qualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ +// look = B.qualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ // assertNull( look ); // // params.add( TypeInfoProvider.newTypeInfo( ITypeInfo.t_int, 0, null ) ); -// look = B.qualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ +// look = B.qualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ // // assertEquals( look, f2 ); // assertTrue( A.removeSymbol( f2 ) ); @@ -3508,7 +3509,7 @@ public class ParserSymbolTableTest extends TestCase { // iter = A.getContentsIterator(); // assertFalse( iter.hasNext() ); // -// look = B.qualifiedFunctionLookup( "f", params ); //$NON-NLS-1$ +// look = B.qualifiedFunctionLookup( "f".toCharArray(), params ); //$NON-NLS-1$ // assertNull( look ); // // assertEquals( A.getContainedSymbols().size(), 0 ); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/ObjectMapTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/ObjectMapTest.java index 4147d34aebd..0f894746144 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/ObjectMapTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner2/ObjectMapTest.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.core.parser.tests.scanner2; import junit.framework.TestCase; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayUtils; import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; /** @@ -146,5 +147,16 @@ public class ObjectMapTest extends TestCase { insertContents( map, con ); assertContents( map, con ); } + + public void testCharArrayUtils() throws Exception{ + char [] buffer = "A::B::C".toCharArray(); //$NON-NLS-1$ + + assertEquals( CharArrayUtils.lastIndexOf( "::".toCharArray(), buffer ), 4 ); //$NON-NLS-1$ + assertTrue( CharArrayUtils.equals( CharArrayUtils.lastSegment( buffer, "::".toCharArray()), "C".toCharArray() ) ); //$NON-NLS-1$ //$NON-NLS-2$ + + buffer = "A::B::C:foo".toCharArray(); //$NON-NLS-1$ + assertEquals( CharArrayUtils.lastIndexOf( "::".toCharArray(), buffer ), 4 ); //$NON-NLS-1$ + assertTrue( CharArrayUtils.equals( CharArrayUtils.lastSegment( buffer, "::".toCharArray()), "C:foo".toCharArray() ) ); //$NON-NLS-1$ //$NON-NLS-2$ + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTDesignator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTDesignator.java index 659b5a7d2c4..a07a0166463 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTDesignator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTDesignator.java @@ -26,7 +26,7 @@ public class ASTDesignator implements IASTDesignator * @param constantExpression * @param string */ - public ASTDesignator(DesignatorKind kind, IASTExpression constantExpression, String fieldName, int fieldOffset ) + public ASTDesignator(DesignatorKind kind, IASTExpression constantExpression, char[] fieldName, int fieldOffset ) { this.fieldName = fieldName; this.constantExpression = constantExpression; @@ -35,7 +35,7 @@ public class ASTDesignator implements IASTDesignator } private int fieldOffset; - private final String fieldName; + private final char[] fieldName; private final IASTExpression constantExpression; private final DesignatorKind kind; /* (non-Javadoc) @@ -57,6 +57,9 @@ public class ASTDesignator implements IASTDesignator */ public String fieldName() { + return String.valueOf(fieldName); + } + public char[] fieldNameArray(){ return fieldName; } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java index 4a8691d02d7..8df0efaffa0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java @@ -29,7 +29,7 @@ public class ASTQualifiedNamedElement implements IASTQualifiedNameElement /** * @param scope */ - public ASTQualifiedNamedElement(IASTScope scope, String name ) + public ASTQualifiedNamedElement(IASTScope scope, char[] name ) { Stack names = new Stack(); IASTScope parent = scope; @@ -40,7 +40,7 @@ public class ASTQualifiedNamedElement implements IASTQualifiedNameElement if (parent instanceof IASTNamespaceDefinition || parent instanceof IASTClassSpecifier ) { - names.push(((IASTOffsetableNamedElement)parent).getName()); + names.push(((IASTOffsetableNamedElement)parent).getName().toCharArray()); if( parent instanceof IASTScopedElement ) parent = ((IASTScopedElement)parent).getOwnerScope(); } @@ -55,10 +55,10 @@ public class ASTQualifiedNamedElement implements IASTQualifiedNameElement } if (names.size() != 0) { - qualifiedNames = new String[names.size()]; + qualifiedNames = new char[names.size()][]; int counter = 0; while (!names.empty()) - qualifiedNames[counter++] = (String)names.pop(); + qualifiedNames[counter++] = (char[])names.pop(); } else qualifiedNames = null; @@ -67,9 +67,13 @@ public class ASTQualifiedNamedElement implements IASTQualifiedNameElement public String[] getFullyQualifiedName() { - return qualifiedNames; + String[] result = new String[qualifiedNames.length ]; + for( int i = 0; i < qualifiedNames.length; i++ ){ + result[i] = String.valueOf(qualifiedNames[i]); + } + return result; } - private final String[] qualifiedNames; + private final char[][] qualifiedNames; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java index 55effec4bb3..a4dc2c8b075 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java @@ -72,7 +72,7 @@ public class BaseASTFactory { if( extension.overrideCreateDesignatorMethod( kind )) return extension.createDesignator( kind, constantExpression, fieldIdentifier, extensionParms ); return new ASTDesignator( kind, constantExpression, - fieldIdentifier == null ? "" : fieldIdentifier.getImage(), //$NON-NLS-1$ + fieldIdentifier == null ? new char[0] : fieldIdentifier.getCharImage(), //$NON-NLS-1$ fieldIdentifier == null ? -1 : fieldIdentifier.getOffset() ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/GCCASTExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/GCCASTExtension.java index 68893827b2b..f791b4f7d7a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/GCCASTExtension.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/GCCASTExtension.java @@ -45,7 +45,7 @@ import org.eclipse.cdt.internal.core.parser.pst.TypeInfoProvider; */ public abstract class GCCASTExtension implements IASTFactoryExtension { protected final ParserMode mode; - protected static final String EMPTY_STRING = ""; //$NON-NLS-1$ + protected static final char[] EMPTY_STRING = new char[0]; //$NON-NLS-1$ /** * @param mode */ @@ -116,7 +116,7 @@ public abstract class GCCASTExtension implements IASTFactoryExtension { ASTExpression typeOfExpression = (ASTExpression) extensionParms.get( IASTGCCSimpleTypeSpecifier.TYPEOF_EXRESSION ); ISymbol s = pst.newSymbol( EMPTY_STRING ); s.setTypeInfo( typeOfExpression.getResultType().getResult() ); - return new ASTGCCSimpleTypeSpecifier( s, isTypename, ( typeName == null ? EMPTY_STRING : typeName.toString()), Collections.EMPTY_LIST, typeOfExpression ); + return new ASTGCCSimpleTypeSpecifier( s, isTypename, ( typeName == null ? EMPTY_STRING : typeName.toCharArray()), Collections.EMPTY_LIST, typeOfExpression ); } return null; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTASMDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTASMDefinition.java index 57a8bd30657..0561cbe27e8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTASMDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTASMDefinition.java @@ -21,12 +21,12 @@ import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol; */ public class ASTASMDefinition extends ASTAnonymousDeclaration implements IASTASMDefinition { - private final String assembly; + private final char[] assembly; /** * @param filename * */ - public ASTASMDefinition( IContainerSymbol scope, String assembly, int first, int firstLine, int last , int lastLine, char[] filename ) + public ASTASMDefinition( IContainerSymbol scope, char[] assembly, int first, int firstLine, int last , int lastLine, char[] filename ) { super( scope ); this.assembly = assembly; @@ -39,7 +39,7 @@ public class ASTASMDefinition extends ASTAnonymousDeclaration implements IASTASM */ public String getBody() { - return assembly; + return String.valueOf( assembly ); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTBaseSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTBaseSpecifier.java index 5d884af5001..cd00a720ed7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTBaseSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTBaseSpecifier.java @@ -63,7 +63,7 @@ public class ASTBaseSpecifier implements IASTBaseSpecifier */ public String getParentClassName() { - return symbol.getName(); + return String.valueOf(symbol.getName()); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getParentClassSpecifier() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java index 32efa1182a9..bdc724024c6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java @@ -146,9 +146,11 @@ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier */ public String getName() { + return String.valueOf(symbol.getName()); + } + public char[] getNameArray(){ return symbol.getName(); } - /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java index 2c657db8053..ca1d46659ba 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java @@ -26,13 +26,13 @@ public class ASTConstructorMemberInitializer { private final int nameOffset; private final boolean requireNameResolution; - private final String name; + private final char[] name; private final IASTExpression expression; private List references; /** * */ - public ASTConstructorMemberInitializer( IASTExpression expression, String name, int nameOffset, List references, boolean requireNameResolution ) + public ASTConstructorMemberInitializer( IASTExpression expression, char[] name, int nameOffset, List references, boolean requireNameResolution ) { this.expression = expression; this.name = name; @@ -52,6 +52,9 @@ public class ASTConstructorMemberInitializer */ public String getName() { + return String.valueOf( name ); + } + public char[] getNameArray(){ return name; } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java index 950e66fe002..84e9be17f1d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java @@ -55,6 +55,9 @@ public class ASTElaboratedTypeSpecifier extends ASTSymbol implements IASTElabora */ public String getName() { + return String.valueOf(getSymbol().getName()); + } + public char[] getNameArray(){ return getSymbol().getName(); } /* (non-Javadoc) @@ -116,11 +119,12 @@ public class ASTElaboratedTypeSpecifier extends ASTSymbol implements IASTElabora * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { + if( obj == this ) return true; if( obj == null ) return false; if( ! (obj instanceof IASTElaboratedTypeSpecifier )) return false; IASTElaboratedTypeSpecifier elab = (IASTElaboratedTypeSpecifier) obj; if( elab.getClassKind() != getClassKind() ) return false; - if( elab.getName() != getName() ) return false; + if( !elab.getName().equals( getName() ) ) return false; return true; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java index c2c5703c41a..7b59ac8ac54 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java @@ -109,7 +109,7 @@ public class ASTEnumerationSpecifier */ public String getName() { - return getSymbol().getName(); + return String.valueOf(getSymbol().getName()); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java index 10a89d0ec9c..e673738b59a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java @@ -71,7 +71,7 @@ public class ASTEnumerator extends ASTSymbol implements IASTEnumerator */ public String getName() { - return symbol.getName(); + return String.valueOf(symbol.getName()); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java index 692f9e61b7e..0d279799d2d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java @@ -108,7 +108,7 @@ public class ASTFunction extends ASTScope implements IASTFunction */ public String getName() { - return symbol.getName(); + return String.valueOf(symbol.getName()); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFunction#getReturnType() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTIdExpression.java index 279688c35ef..54adc5bf016 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTIdExpression.java @@ -22,7 +22,7 @@ import org.eclipse.cdt.core.parser.ast.ASTUtil; public class ASTIdExpression extends ASTExpression { private ITokenDuple idExpression; - private String idExpressionValue; + private char[] idExpressionValue; /** * @param kind * @param references @@ -30,14 +30,14 @@ public class ASTIdExpression extends ASTExpression { public ASTIdExpression(Kind kind, List references, ITokenDuple idExpression) { super(kind, references); this.idExpression = idExpression; - idExpressionValue = idExpression.toString(); + idExpressionValue = idExpression.toCharArray(); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getIdExpression() */ public String getIdExpression() { - return idExpressionValue; + return String.valueOf( idExpressionValue ); } public ITokenDuple getIdExpressionTokenDuple() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLinkageSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLinkageSpecification.java index 224cd6c51ca..6b16ef6d462 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLinkageSpecification.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLinkageSpecification.java @@ -28,7 +28,7 @@ import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol; public class ASTLinkageSpecification extends ASTAnonymousDeclaration implements IASTLinkageSpecification { private List declarations = new ArrayList(); - private final String linkageString; + private final char[] linkageString; private final char [] fn; /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() @@ -41,7 +41,7 @@ public class ASTLinkageSpecification extends ASTAnonymousDeclaration implements * @param filename * */ - public ASTLinkageSpecification( IContainerSymbol scope, String linkageString, int startingOffset, int startingLine, char[] filename ) + public ASTLinkageSpecification( IContainerSymbol scope, char[] linkageString, int startingOffset, int startingLine, char[] filename ) { super( scope ); this.linkageString = linkageString; @@ -53,7 +53,7 @@ public class ASTLinkageSpecification extends ASTAnonymousDeclaration implements */ public String getLinkageString() { - return linkageString; + return String.valueOf(linkageString); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLiteralExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLiteralExpression.java index bbfacfd27d7..5d469a2a15b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLiteralExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLiteralExpression.java @@ -20,13 +20,13 @@ import org.eclipse.cdt.core.parser.ast.ASTUtil; */ public class ASTLiteralExpression extends ASTExpression { - private final String literal; + private final char[] literal; /** * @param kind * @param references */ - public ASTLiteralExpression(Kind kind, List references, String literal) { + public ASTLiteralExpression(Kind kind, List references, char[] literal) { super(kind, references); this.literal = literal; } @@ -35,7 +35,7 @@ public class ASTLiteralExpression extends ASTExpression { * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getLiteralString() */ public String getLiteralString() { - return literal; + return String.valueOf( literal ); } public String toString(){ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java index ed54347593d..365b6828d4f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java @@ -231,7 +231,7 @@ public class ASTMethod extends ASTFunction implements IASTMethod ISymbol thisPointer = thisContainer.lookup( ParserSymbolTable.THIS ); ISymbol thisClass = ( thisPointer != null ) ? thisPointer.getTypeSymbol() : null; if( thisClass != null && thisClass instanceof IContainerSymbol ){ - return ((IContainerSymbol) thisClass).prefixLookup( filter, prefix, true, paramList ); + return ((IContainerSymbol) thisClass).prefixLookup( filter, prefix.toCharArray(), true, paramList ); } } catch (ParserSymbolTableException e) { throw new LookupError(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java index db305f23c4e..d0928a982ac 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java @@ -25,7 +25,7 @@ import org.eclipse.cdt.internal.core.parser.pst.ISymbol; public class ASTNamespaceAlias extends ASTSymbol implements IASTNamespaceAlias { - private final String alias; + private final char[] alias; private final IASTNamespaceDefinition namespace; private List references; private final char [] fn; @@ -44,7 +44,7 @@ public class ASTNamespaceAlias extends ASTSymbol implements IASTNamespaceAlias * @param endOffset * @param filename */ - public ASTNamespaceAlias(ISymbol s, String alias, IASTNamespaceDefinition namespaceDefinition, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endingLine, List references, char[] filename) + public ASTNamespaceAlias(ISymbol s, char[] alias, IASTNamespaceDefinition namespaceDefinition, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endingLine, List references, char[] filename) { super( s ); this.alias = alias; @@ -61,7 +61,7 @@ public class ASTNamespaceAlias extends ASTSymbol implements IASTNamespaceAlias */ public String getAlias() { - return alias; + return String.valueOf(alias); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias#getNamespace() @@ -97,7 +97,7 @@ public class ASTNamespaceAlias extends ASTSymbol implements IASTNamespaceAlias */ public String getName() { - return getSymbol().getName(); + return String.valueOf(getSymbol().getName()); } private int startingLineNumber, startingOffset, endingLineNumber, endingOffset, nameStartOffset, nameEndOffset, nameLineNumber; /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java index 33a75860fc2..58ecde9af96 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java @@ -60,7 +60,7 @@ public class ASTNamespaceDefinition */ public String getName() { - return symbol.getName(); + return String.valueOf(symbol.getName()); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNode.java index 9938d2df835..66635063d03 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNode.java @@ -115,9 +115,9 @@ public class ASTNode implements IASTNode { List results = null; try { if( qualification != null ){ - results = qualification.prefixLookup( filter, prefix, true, paramList ); + results = qualification.prefixLookup( filter, prefix.toCharArray(), true, paramList ); } else { - results = thisContainer.prefixLookup( filter, prefix, false, paramList ); + results = thisContainer.prefixLookup( filter, prefix.toCharArray(), false, paramList ); } } catch (ParserSymbolTableException e) { throw new LookupError(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java index 6280d95af68..136aaae16ce 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java @@ -32,7 +32,7 @@ import org.eclipse.cdt.internal.core.parser.pst.ISymbol; public class ASTParameterDeclaration extends ASTSymbol implements IASTParameterDeclaration { private final ASTAbstractDeclaration abstractDeclaration; - private final String parameterName; + private final char[] parameterName; private final IASTInitializerClause initializerClause; private final char [] fn; /* (non-Javadoc) @@ -51,7 +51,7 @@ public class ASTParameterDeclaration extends ASTSymbol implements IASTParameterD * @param initializerClause * @param filename */ - public ASTParameterDeclaration(ISymbol symbol, boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] filename ) + public ASTParameterDeclaration(ISymbol symbol, boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, char[] parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] filename ) { super( symbol ); abstractDeclaration = new ASTAbstractDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp ); @@ -68,6 +68,9 @@ public class ASTParameterDeclaration extends ASTSymbol implements IASTParameterD */ public String getName() { + return String.valueOf(parameterName); + } + public char[] getNameArray(){ return parameterName; } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSimpleTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSimpleTypeSpecifier.java index 3a523498930..7d7c09fb26b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSimpleTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSimpleTypeSpecifier.java @@ -29,14 +29,14 @@ public class ASTSimpleTypeSpecifier extends ASTNode implements IASTSimpleTypeSpe private final List refs; private ISymbol symbol; private final boolean isTypename; - private final String name; + private final char[] name; /** * @param s * @param b * @param string */ - public ASTSimpleTypeSpecifier(ISymbol s, boolean b, String string, List references ) + public ASTSimpleTypeSpecifier(ISymbol s, boolean b, char[] string, List references ) { this.symbol = s; this.isTypename = b; @@ -76,7 +76,7 @@ public class ASTSimpleTypeSpecifier extends ASTNode implements IASTSimpleTypeSpe */ public String getTypename() { - return name; + return String.valueOf(name); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isLong() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateParameter.java index 95662490266..c52bf4de5ca 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateParameter.java @@ -85,7 +85,7 @@ public class ASTTemplateParameter extends ASTSymbol implements IASTTemplateParam * @see org.eclipse.cdt.core.parser.ast.IASTTemplateParameter#getIdentifier() */ public String getIdentifier() { - return symbol.getName(); + return String.valueOf(symbol.getName()); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTTemplateParameter#getDefaultValueIdExpression() @@ -134,8 +134,12 @@ public class ASTTemplateParameter extends ASTSymbol implements IASTTemplateParam * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName() */ public String getName() { - return symbol.getName(); + return String.valueOf(symbol.getName()); } + public char[] getNameArray(){ + return symbol.getName(); + } + private int startingLineNumber, startingOffset, endingLineNumber, endingOffset, nameStartOffset, nameEndOffset, nameLineNumber; /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeId.java index e640c1dd908..6d2fa0cb3c7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeId.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeId.java @@ -37,10 +37,10 @@ public class ASTTypeId implements IASTTypeId private final boolean isLong; private final boolean isVolatile; private final boolean isConst; - private final String signature; + private final char[] signature; private ITokenDuple tokenDuple; private final List arrayModifiers; - private final String typeName; + private final char[] typeName; private final List pointerOps; private final Type kind; private List references = null; @@ -49,10 +49,10 @@ public class ASTTypeId implements IASTTypeId /** * */ - public ASTTypeId( Type kind, ITokenDuple duple, List pointerOps, List arrayMods, String signature, + public ASTTypeId( Type kind, ITokenDuple duple, List pointerOps, List arrayMods, char[] signature, boolean isConst, boolean isVolatile, boolean isUnsigned, boolean isSigned, boolean isShort, boolean isLong, boolean isTypeName ) { - typeName = ( duple == null ) ? "" : duple.toString() ; //$NON-NLS-1$ + typeName = ( duple == null ) ? "".toCharArray() : duple.toCharArray() ; //$NON-NLS-1$ this.tokenDuple = duple; this.kind = kind; this.pointerOps = pointerOps; @@ -79,7 +79,7 @@ public class ASTTypeId implements IASTTypeId */ public String getTypeOrClassName() { - return typeName; + return String.valueOf(typeName); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getPointerOperators() @@ -111,7 +111,7 @@ public class ASTTypeId implements IASTTypeId */ public String getFullSignature() { - return signature; + return String.valueOf(signature); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java index 8c29bbe9275..17e2971c395 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java @@ -65,7 +65,7 @@ public class ASTTypedef extends ASTSymbol implements IASTTypedefDeclaration */ public String getName() { - return getSymbol().getName(); + return String.valueOf(getSymbol().getName()); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java index e7d4a5bbb26..e869193f0fc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java @@ -114,7 +114,7 @@ public class ASTVariable extends ASTSymbol implements IASTVariable */ public String getName() { - return getSymbol().getName(); + return String.valueOf(getSymbol().getName()); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getInitializerClause() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java index bbdff213f6b..5dbe9bac519 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java @@ -76,6 +76,7 @@ import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type; import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter.ParamKind; import org.eclipse.cdt.core.parser.extension.IASTFactoryExtension; import org.eclipse.cdt.internal.core.parser.ast.ASTAbstractDeclaration; +import org.eclipse.cdt.internal.core.parser.ast.ASTDesignator; import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory; import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory; import org.eclipse.cdt.internal.core.parser.pst.ExtensibleSymbolExtension; @@ -101,6 +102,7 @@ import org.eclipse.cdt.internal.core.parser.pst.StandardSymbolExtension; import org.eclipse.cdt.internal.core.parser.pst.TemplateSymbolExtension; import org.eclipse.cdt.internal.core.parser.pst.TypeInfoProvider; import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension.ExtensionException; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayUtils; import org.eclipse.cdt.internal.core.parser.token.TokenFactory; import org.eclipse.cdt.internal.core.parser.util.TraceUtil; @@ -114,7 +116,8 @@ import org.eclipse.cdt.internal.core.parser.util.TraceUtil; */ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFactory { - protected static final String EMPTY_STRING = ""; //$NON-NLS-1$ + protected static final char[] EMPTY_STRING = new char[0]; //$NON-NLS-1$ + protected static final char[] THIS = new char[] { 't', 'h', 'i', 's' }; private final static ITypeInfo.OperatorExpression SUBSCRIPT; private final static IProblemFactory problemFactory = new ASTProblemFactory(); private final ParserMode mode; @@ -148,7 +151,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto super(extension); pst = new ParserSymbolTable( language, mode ); this.mode = mode; - filename = EMPTY_STRING.toCharArray(); + filename = EMPTY_STRING; } /* @@ -215,11 +218,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto return true; } - private ISymbol lookupElement (IContainerSymbol startingScope, String name, ITypeInfo.eType type, List parameters, LookupType lookupType ) throws ASTSemanticException { + private ISymbol lookupElement (IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, LookupType lookupType ) throws ASTSemanticException { return lookupElement( startingScope, name, type, parameters, null, lookupType ); } - private ISymbol lookupElement (IContainerSymbol startingScope, String name, ITypeInfo.eType type, List parameters, List arguments, LookupType lookupType ) throws ASTSemanticException { + private ISymbol lookupElement (IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, List arguments, LookupType lookupType ) throws ASTSemanticException { ISymbol result = null; if( startingScope == null ) return null; try { @@ -267,11 +270,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto return result; } - protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, String name, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException{ + protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, char[] name, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException{ return lookupQualifiedName(startingScope, name, ITypeInfo.t_any, null, 0, references, throwOnError, lookup ); } - protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, String name, ITypeInfo.eType type, List parameters, int offset, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException + protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, int offset, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException { ISymbol result = null; if( name == null && throwOnError ) @@ -316,7 +319,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto List [] templateArgLists = name.getTemplateIdArgLists(); List args = null; int idx = 0; - String image = null; + char[] image = null; switch( name.getSegmentCount() ) { case 0: @@ -325,7 +328,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto else return null; case 1: - image = name.extractNameFromTemplateId(); + image = name.extractNameFromTemplateId().toCharArray(); args = ( templateArgLists != null ) ? getTemplateArgList( templateArgLists[ 0 ] ) : null; result = lookupElement(startingScope, image, type, parameters, args, lookup ); @@ -380,7 +383,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } if( t.isPointer() ) break; - image = t.getImage(); + image = t.getCharImage(); int offset = t.getOffset(); if( templateArgLists != null && templateArgLists[ idx ] != null ){ @@ -502,7 +505,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto try { usingDirective = ((ASTScope)scope).getContainerSymbol().addUsingDirective( (IContainerSymbol)symbol ); } catch (ParserSymbolTableException pste) { - handleProblem( pste.createProblemID(), duple.toString(), startingOffset, endingOffset, startingLine, true ); + handleProblem( pste.createProblemID(), duple.toCharArray(), startingOffset, endingOffset, startingLine, true ); } ASTUsingDirective using = new ASTUsingDirective( scopeToSymbol(scope), usingDirective, startingOffset, startingLine, endingOffset, endingLine, references, filename ); @@ -516,7 +519,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto * @param duple */ private void setFilename(ITokenDuple duple) { - filename = ( duple == null ) ? EMPTY_STRING.toCharArray() : duple.getFilename(); + filename = ( duple == null ) ? EMPTY_STRING : duple.getFilename(); } protected IContainerSymbol getScopeToSearchUpon( @@ -573,24 +576,24 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } try { - endResult = scopeToSymbol(scope).addUsingDeclaration( name.getLastToken().getImage(), containerSymbol ); + endResult = scopeToSymbol(scope).addUsingDeclaration( name.getLastToken().getImage().toCharArray(), containerSymbol ); } catch (ParserSymbolTableException e) { - handleProblem(e.createProblemID(), name.getLastToken().getImage(), startingOffset, endingOffset, startingLine, true ); + handleProblem(e.createProblemID(), name.getLastToken().getCharImage(), startingOffset, endingOffset, startingLine, true ); } } else try { - endResult = scopeToSymbol(scope).addUsingDeclaration(name.getLastToken().getImage()); + endResult = scopeToSymbol(scope).addUsingDeclaration(name.getLastToken().getImage().toCharArray()); } catch (ParserSymbolTableException e) { - handleProblem(e.createProblemID(), name.getLastToken().getImage(), startingOffset, endingOffset, startingLine, true ); + handleProblem(e.createProblemID(), name.getLastToken().getCharImage(), startingOffset, endingOffset, startingLine, true ); } if( endResult != null ) { Iterator i = endResult.getReferencedSymbols().iterator(); while( i.hasNext() ) - addReference( references, createReference( (ISymbol) i.next(), name.getLastToken().getImage(), name.getLastToken().getOffset() ) ); + addReference( references, createReference( (ISymbol) i.next(), name.getLastToken().getCharImage(), name.getLastToken().getOffset() ) ); } ASTUsingDeclaration using = new ASTUsingDeclaration( scope, name.getLastToken().getImage(), @@ -608,7 +611,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto int startingOffset, int startingLine, int endingOffset, int endingLine, char[] fn) { - return new ASTASMDefinition( scopeToSymbol(scope), assembly, startingOffset, startingLine, endingOffset, endingLine, fn); + return new ASTASMDefinition( scopeToSymbol(scope), assembly.toCharArray(), startingOffset, startingLine, endingOffset, endingLine, fn); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int, int) @@ -627,22 +630,22 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto { try { - namespaceSymbol = pstScope.qualifiedLookup( identifier ); + namespaceSymbol = pstScope.qualifiedLookup( identifier.toCharArray() ); } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), identifier, nameOffset, nameEndOffset, nameLineNumber, true ); + handleProblem( e.createProblemID(), identifier.toCharArray(), nameOffset, nameEndOffset, nameLineNumber, true ); } } if( namespaceSymbol != null ) { if( namespaceSymbol.getType() != ITypeInfo.t_namespace ) - handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, identifier, nameOffset, nameEndOffset, nameLineNumber, true ); + handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, identifier.toCharArray(), nameOffset, nameEndOffset, nameLineNumber, true ); } else { - namespaceSymbol = pst.newContainerSymbol( identifier, ITypeInfo.t_namespace ); + namespaceSymbol = pst.newContainerSymbol( identifier.toCharArray(), ITypeInfo.t_namespace ); if( identifier.equals( EMPTY_STRING ) ) namespaceSymbol.setContainingSymbol( pstScope ); else @@ -724,7 +727,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto String spec, int startingOffset, int startingLine, char[] fn) { - return new ASTLinkageSpecification( scopeToSymbol( scope ), spec, startingOffset, startingLine, fn ); + return new ASTLinkageSpecification( scopeToSymbol( scope ), spec.toCharArray(), startingOffset, startingLine, fn ); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.ASTClassKind, org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, org.eclipse.cdt.core.parser.ast.IASTTemplate, int, int) @@ -743,7 +746,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto ITypeInfo.eType pstType = classKindToTypeInfo(kind); List references = new ArrayList(); - String newSymbolName = EMPTY_STRING; + char[] newSymbolName = EMPTY_STRING; List templateIdArgList = null; boolean isTemplateId = false; @@ -758,7 +761,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto else currentScopeSymbol = (IContainerSymbol) temp; if( currentScopeSymbol == null ) - handleProblem( IProblem.SEMANTIC_NAME_NOT_FOUND, containerSymbolName.toString(), containerSymbolName.getFirstToken().getOffset(), containerSymbolName.getLastToken().getEndOffset(), containerSymbolName.getLastToken().getLineNumber(), true ); + handleProblem( IProblem.SEMANTIC_NAME_NOT_FOUND, containerSymbolName.toCharArray(), containerSymbolName.getFirstToken().getOffset(), containerSymbolName.getLastToken().getEndOffset(), containerSymbolName.getLastToken().getLineNumber(), true ); nameToken = name.getLastSegment().getFirstToken(); } else { @@ -771,17 +774,17 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto isTemplateId = (templateIdArgList != null); } - newSymbolName = nameToken.getImage(); + newSymbolName = nameToken.getCharImage(); } ISymbol classSymbol = null; - if( !newSymbolName.equals(EMPTY_STRING) && !isTemplateId ){ + if( !CharArrayUtils.equals(newSymbolName, EMPTY_STRING) && !isTemplateId ){ try { classSymbol = currentScopeSymbol.lookupMemberForDefinition(newSymbolName); } catch (ParserSymbolTableException e) { - handleProblem(IProblem.SEMANTIC_UNIQUE_NAME_PREDEFINED, name.toString(), nameOffset, nameEndOffset, nameLine, true); + handleProblem(IProblem.SEMANTIC_UNIQUE_NAME_PREDEFINED, name.toCharArray(), nameOffset, nameEndOffset, nameLine, true); } if( classSymbol != null && ! classSymbol.isForwardDeclaration() ) @@ -854,17 +857,17 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto return list; } - protected void handleProblem( int id, String attribute ) throws ASTSemanticException + protected void handleProblem( int id, char[] attribute ) throws ASTSemanticException { handleProblem( null, id, attribute, -1, -1, -1, true ); //TODO make this right } - protected void handleProblem( IASTScope scope, int id, String attribute ) throws ASTSemanticException + protected void handleProblem( IASTScope scope, int id, char[] attribute ) throws ASTSemanticException { handleProblem( scope, id, attribute, -1, -1, -1, true); } - protected void handleProblem( int id, String attribute, int startOffset, int endOffset, int lineNumber, boolean isError ) throws ASTSemanticException { + protected void handleProblem( int id, char[] attribute, int startOffset, int endOffset, int lineNumber, boolean isError ) throws ASTSemanticException { handleProblem( null, id, attribute, startOffset, endOffset, lineNumber, isError ); } @@ -877,10 +880,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto * @param isError TODO * @param filename * @throws ASTSemanticException - */ - protected void handleProblem( IASTScope scope, int id, String attribute, int startOffset, int endOffset, int lineNumber, boolean isError ) throws ASTSemanticException { + */ + protected void handleProblem( IASTScope scope, int id, char[] attribute, int startOffset, int endOffset, int lineNumber, boolean isError ) throws ASTSemanticException { IProblem p = problemFactory.createProblem( id, - startOffset, endOffset, lineNumber, filename, attribute, !isError, isError ); + startOffset, endOffset, lineNumber, filename, attribute != null ? String.valueOf(attribute) : null, !isError, isError ); TraceUtil.outputTrace(logService, "CompleteParseASTFactory - IProblem : ", p, null, null, null ); //$NON-NLS-1$ @@ -947,7 +950,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto ISymbol symbol = lookupQualifiedName( classSymbol, parentClassName, references, true ); if( symbol instanceof ITemplateSymbol ) - handleProblem( IProblem.SEMANTIC_INVALID_TEMPLATE_ARGUMENT, parentClassName.toString(), parentClassName.getStartOffset(), parentClassName.getEndOffset(), parentClassName.getLineNumber(), true); + handleProblem( IProblem.SEMANTIC_INVALID_TEMPLATE_ARGUMENT, parentClassName.toCharArray(), parentClassName.getStartOffset(), parentClassName.getEndOffset(), parentClassName.getLineNumber(), true); List [] templateArgumentLists = parentClassName.getTemplateIdArgLists(); if( templateArgumentLists != null ) @@ -964,7 +967,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto * @param referenceElementName * @return */ - protected IASTReference createReference(ISymbol symbol, String referenceElementName, int offset ) throws ASTSemanticException + protected IASTReference createReference(ISymbol symbol, char[] referenceElementName, int offset ) throws ASTSemanticException { if( mode != ParserMode.COMPLETE_PARSE ) return null; @@ -1054,14 +1057,14 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IContainerSymbol containerSymbol = scopeToSymbol(scope); ITypeInfo.eType pstType = ITypeInfo.t_enumeration; - IDerivableContainerSymbol classSymbol = pst.newDerivableContainerSymbol( name, pstType ); + IDerivableContainerSymbol classSymbol = pst.newDerivableContainerSymbol( name.toCharArray(), pstType ); try { containerSymbol.addSymbol( classSymbol ); } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), name ); + handleProblem( e.createProblemID(), name.toCharArray() ); } ASTEnumerationSpecifier enumSpecifier = new ASTEnumerationSpecifier( classSymbol, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, fn ); @@ -1089,7 +1092,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto setFilename(fn); IContainerSymbol enumerationSymbol = (IContainerSymbol)((ISymbolOwner)enumeration).getSymbol(); - ISymbol enumeratorSymbol = pst.newSymbol( name, ITypeInfo.t_enumerator ); + ISymbol enumeratorSymbol = pst.newSymbol( name.toCharArray(), ITypeInfo.t_enumerator ); try { enumerationSymbol.addSymbol( enumeratorSymbol ); @@ -1097,7 +1100,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto catch (ParserSymbolTableException e1) { if( e1.reason == ParserSymbolTableException.r_InvalidOverload ) - handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, name, startingOffset, endingOffset, startingLine, true ); + handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, name.toCharArray(), startingOffset, endingOffset, startingLine, true ); // assert false : e1; } ASTEnumerator enumerator = new ASTEnumerator( enumeratorSymbol, enumeration, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endLine, initialValue, fn ); @@ -1129,7 +1132,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto idExpression.toString() ); } - else if( literal != null && !literal.equals( EMPTY_STRING )) + else if( literal != null && !literal.equals( String.valueOf(EMPTY_STRING) )) { TraceUtil.outputTrace( logService, @@ -1232,7 +1235,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto if( constructor != null ){ IASTReference reference = null; try { - reference = createReference( constructor, duple.toString(), duple.getStartOffset() ); + reference = createReference( constructor, duple.toCharArray(), duple.getStartOffset() ); } catch (ASTSemanticException e2) { return false; } @@ -1298,9 +1301,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto // go up the scope until you hit a class if (kind == IASTExpression.Kind.PRIMARY_THIS){ try{ - symbol = startingScope.lookup("this"); //$NON-NLS-1$ + symbol = startingScope.lookup( THIS ); //$NON-NLS-1$ }catch (ParserSymbolTableException e){ - handleProblem( e.createProblemID(), "this"); //$NON-NLS-1$ + handleProblem( e.createProblemID(), THIS ); //$NON-NLS-1$ } } // lookup symbol if it is a function call @@ -1968,7 +1971,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto getExpressionReferences( expressionList, references ); return new ASTConstructorMemberInitializer( expressionList, - duple == null ? EMPTY_STRING : duple.toString(), + duple == null ? EMPTY_STRING : duple.toCharArray(), duple == null ? 0 : duple.getFirstToken().getOffset(), references, requireReferenceResolution ); } @@ -1991,7 +1994,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto setFilename( typeName ); if( extension.overrideCreateSimpleTypeSpecifierMethod( kind )) return extension.createSimpleTypeSpecifier(pst, scope, kind, typeName, isShort, isLong, isSigned, isUnsigned, isTypename, isComplex, isImaginary, isGlobal, extensionParms ); - String typeNameAsString = typeName.toString(); + char[] typeNameAsString = typeName.toCharArray(); if( kind != Type.CLASS_OR_TYPENAME ) { IASTSimpleTypeSpecifier query = (IASTSimpleTypeSpecifier) simpleTypeSpecCache.get( typeNameAsString ); @@ -2043,7 +2046,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto continue; } - String image = current.getImage(); + char[] image = current.getCharImage(); int offset = current.getOffset(); if( argLists != null && argLists[ idx ] != null ){ @@ -2146,7 +2149,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto ){ if( parentScope.getASTExtension().getPrimaryDeclaration() instanceof IASTElaboratedTypeSpecifier ){ //we are trying to define a member of a class for which we only have a forward declaration - handleProblem( scope, IProblem.SEMANTICS_RELATED, name.toString(), startOffset, nameEndOffset, startLine, true ); + handleProblem( scope, IProblem.SEMANTICS_RELATED, name.toCharArray(), startOffset, nameEndOffset, startLine, true ); } IASTScope methodParentScope = (IASTScope)parentScope.getASTExtension().getPrimaryDeclaration(); ITokenDuple newName = name.getLastSegment(); @@ -2175,7 +2178,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } } - IParameterizedSymbol symbol = pst.newParameterizedSymbol( name.extractNameFromTemplateId(), ITypeInfo.t_function ); + IParameterizedSymbol symbol = pst.newParameterizedSymbol( name.extractNameFromTemplateId().toCharArray(), ITypeInfo.t_function ); setFunctionTypeInfoBits(isInline, isFriend, isStatic, symbol); symbol.setHasVariableArgs( hasVariableArguments ); @@ -2194,14 +2197,14 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto while (p.hasNext()){ ASTParameterDeclaration param = (ASTParameterDeclaration)p.next(); if( param.getSymbol() == null ) - handleProblem( IProblem.SEMANTICS_RELATED, param.getName(), param.getNameOffset(), param.getEndingOffset(), param.getStartingLine(), true ); + handleProblem( IProblem.SEMANTICS_RELATED, param.getNameArray(), param.getNameOffset(), param.getEndingOffset(), param.getStartingLine(), true ); functionParameters.add(param.getSymbol().getTypeInfo()); } IParameterizedSymbol functionDeclaration = null; functionDeclaration = - (IParameterizedSymbol) lookupQualifiedName(ownerScope, name.getFirstToken().getImage(), ITypeInfo.t_function, functionParameters, 0, null, false, LookupType.FORDEFINITION ); + (IParameterizedSymbol) lookupQualifiedName(ownerScope, name.getFirstToken().getCharImage(), ITypeInfo.t_function, functionParameters, 0, null, false, LookupType.FORDEFINITION ); if( functionDeclaration != null && symbol.isType( ITypeInfo.t_function )){ previouslyDeclared = true; @@ -2218,7 +2221,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), name.toString()); + handleProblem( e.createProblemID(), name.toCharArray()); } } else { symbol = functionDeclaration; @@ -2355,12 +2358,12 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto newReferences.add( cache.getReference(r.getOffset(), r.getReferencedElement())); } if( xrefSymbol != null ) - addReference( newReferences, createReference( xrefSymbol, elab.getName(), elab.getNameOffset()) ); + addReference( newReferences, createReference( xrefSymbol, elab.getNameArray(), elab.getNameOffset()) ); } - String paramName = EMPTY_STRING; + char[] paramName = EMPTY_STRING; if(absDecl instanceof IASTParameterDeclaration){ - paramName = ((IASTParameterDeclaration)absDecl).getName(); + paramName = ((ASTParameterDeclaration)absDecl).getNameArray(); } ISymbol paramSymbol = pst.newSymbol( paramName, type ); @@ -2494,14 +2497,14 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto nameDuple = nameDuple.getLastSegment(); } } - String methodName = null; + char[] methodName = null; List templateIdArgList = null; //template-id? if( nameDuple.getTemplateIdArgLists() != null ){ templateIdArgList = nameDuple.getTemplateIdArgLists()[ 0 ]; - methodName = nameDuple.extractNameFromTemplateId(); + methodName = nameDuple.extractNameFromTemplateId().toCharArray(); } else { - methodName = nameDuple.toString(); + methodName = nameDuple.toCharArray(); } symbol = pst.newParameterizedSymbol( methodName, ITypeInfo.t_function ); @@ -2520,16 +2523,16 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } else { classifier = (IASTClassSpecifier) scope; } - String parentName = classifier.getName(); + char[] parentName = ((ASTClassSpecifier)classifier).getNameArray(); // check constructor / destructor if no return type if ( returnType.getTypeSpecifier() == null ){ - if(parentName.indexOf(DOUBLE_COLON) != -1){ - parentName = parentName.substring(parentName.lastIndexOf(DOUBLE_COLON) + DOUBLE_COLON.length()); + if(CharArrayUtils.indexOf( DOUBLE_COLON.toCharArray(), parentName ) != -1){ + parentName = CharArrayUtils.lastSegment( parentName, DOUBLE_COLON.toCharArray() ); } - if( parentName.equals(methodName) ){ + if( CharArrayUtils.equals( parentName, methodName) ){ isConstructor = true; - } else if(methodName.equals( "~" + parentName )){ //$NON-NLS-1$ + } else if( methodName[0] == '~' && CharArrayUtils.equals( methodName, 1, methodName.length - 1, parentName )){ //$NON-NLS-1$ isDestructor = true; } } @@ -2548,7 +2551,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto while (p.hasNext()){ ASTParameterDeclaration param = (ASTParameterDeclaration)p.next(); if( param.getSymbol() == null ) - handleProblem( IProblem.SEMANTICS_RELATED, param.getName(), param.getNameOffset(), param.getEndingOffset(), param.getNameLineNumber(), true ); + handleProblem( IProblem.SEMANTICS_RELATED, param.getNameArray(), param.getNameOffset(), param.getEndingOffset(), param.getNameLineNumber(), true ); functionParameters.add(param.getSymbol().getTypeInfo()); } @@ -2571,7 +2574,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto ownerScope.getContainingSymbol().isType( ITypeInfo.t_block ) ) { //only needs to be previously declared if we are in a local class - handleProblem( IProblem.SEMANTIC_ILLFORMED_FRIEND, nameDuple.toString(), nameDuple.getStartOffset(), nameDuple.getEndOffset(), nameDuple.getLineNumber(), true ); + handleProblem( IProblem.SEMANTIC_ILLFORMED_FRIEND, nameDuple.toCharArray(), nameDuple.getStartOffset(), nameDuple.getEndOffset(), nameDuple.getLineNumber(), true ); } } else if( functionDeclaration != null && functionDeclaration.isType( isConstructor ? ITypeInfo.t_constructor : ITypeInfo.t_function ) ) @@ -2605,7 +2608,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } catch (ParserSymbolTableException e) { - handleProblem(e.createProblemID(), nameDuple.toString(), nameDuple.getStartOffset(), nameDuple.getEndOffset(), nameDuple.getLineNumber(), true ); + handleProblem(e.createProblemID(), nameDuple.toCharArray(), nameDuple.getStartOffset(), nameDuple.getEndOffset(), nameDuple.getLineNumber(), true ); } resolveLeftoverConstructorInitializerMembers( symbol, constructorChain ); @@ -2637,7 +2640,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto { ASTConstructorMemberInitializer realInitializer = ((ASTConstructorMemberInitializer)initializer); IDerivableContainerSymbol container = (IDerivableContainerSymbol) symbol.getContainingSymbol(); - lookupQualifiedName(container, initializer.getName(), ITypeInfo.t_any, null, realInitializer.getNameOffset(), realInitializer.getReferences(), false, LookupType.QUALIFIED); + lookupQualifiedName(container, realInitializer.getNameArray(), ITypeInfo.t_any, null, realInitializer.getNameOffset(), realInitializer.getReferences(), false, LookupType.QUALIFIED); // TODO try and resolve parameter references now in the expression list } } @@ -2715,9 +2718,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } } - ISymbol newSymbol = cloneSimpleTypeSymbol(name.getFirstToken().getImage(), abstractDeclaration, references); + ISymbol newSymbol = cloneSimpleTypeSymbol(name.getFirstToken().getCharImage(), abstractDeclaration, references); if( newSymbol == null ) - handleProblem( IProblem.SEMANTICS_RELATED, name.toString() ); + handleProblem( IProblem.SEMANTICS_RELATED, name.toCharArray() ); setVariableTypeInfoBits( isAuto, @@ -2736,7 +2739,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto newSymbol.setIsForwardDeclaration( isStatic || isExtern ); boolean previouslyDeclared = false; if(!isStatic){ - ISymbol variableDeclaration = lookupQualifiedName(ownerScope, name.toString(), null, false, LookupType.UNQUALIFIED); + ISymbol variableDeclaration = lookupQualifiedName(ownerScope, name.toCharArray(), null, false, LookupType.UNQUALIFIED); if( variableDeclaration != null && newSymbol.getType() == variableDeclaration.getType() ) { @@ -2760,7 +2763,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } catch (ParserSymbolTableException e) { - handleProblem(e.createProblemID(), name.getFirstToken().getImage() ); + handleProblem(e.createProblemID(), name.getFirstToken().getCharImage() ); } ASTVariable variable = new ASTVariable( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, references, constructorExpression, previouslyDeclared, filename ); @@ -2792,7 +2795,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto Iterator designators = clause.getDesignators(); while( designators.hasNext() ) { - IASTDesignator designator = (IASTDesignator)designators.next(); + ASTDesignator designator = (ASTDesignator)designators.next(); if( designator.getKind() == IASTDesignator.DesignatorKind.FIELD ) { ISymbol lookup = null; @@ -2801,7 +2804,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto try { - lookup = ((IContainerSymbol)currentSymbol).lookup( designator.fieldName() ); + lookup = ((IContainerSymbol)currentSymbol).lookup( designator.fieldName().toCharArray() ); } catch (ParserSymbolTableException e){ break; @@ -2813,7 +2816,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto try { if( lookup != null ) - addReference( clause.getReferences(), createReference( lookup, designator.fieldName(), designator.fieldOffset() )); + addReference( clause.getReferences(), createReference( lookup, designator.fieldNameArray(), designator.fieldOffset() )); } catch (ASTSemanticException e1) { @@ -2861,7 +2864,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } protected ISymbol cloneSimpleTypeSymbol( - String name, + char[] name, IASTAbstractDeclaration abstractDeclaration, List references) throws ASTSemanticException { @@ -2892,7 +2895,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto symbolToBeCloned = pst.newSymbol(name, ITypeInfo.t_type); symbolToBeCloned.setTypeSymbol(elab.getSymbol()); if( elab.getSymbol() != null && references != null ) - addReference( references, createReference( elab.getSymbol(), elab.getName(), elab.getNameOffset()) ); + addReference( references, createReference( elab.getSymbol(), elab.getNameArray(), elab.getNameOffset()) ); } else if ( abstractDeclaration.getTypeSpecifier() instanceof ASTEnumerationSpecifier ) { @@ -2949,7 +2952,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto setFilename( fn ); IContainerSymbol ownerScope = scopeToSymbol( scope ); - String image = ( name != null ) ? name.toString() : EMPTY_STRING; + char[] image = ( name != null ) ? name.toCharArray() : EMPTY_STRING; if(references == null) references = new ArrayList(); @@ -3019,7 +3022,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto int startingOffset, int startingLine, char[] fn) throws ASTSemanticException { setFilename(fn); - ITemplateSymbol template = pst.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME ); + ITemplateSymbol template = pst.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); // the lookup requires a list of type infos // instead of a list of IASTParameterDeclaration @@ -3029,7 +3032,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto try { template.addTemplateParameter( param.getSymbol() ); } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), param.getName(), startingOffset, -1, startingLine, true ); + handleProblem( e.createProblemID(), param.getNameArray(), startingOffset, -1, startingLine, true ); } } @@ -3064,7 +3067,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } } if( kind == ParamKind.TEMPLATE_LIST ){ - ITemplateSymbol template = pst.newTemplateSymbol( identifier ); + ITemplateSymbol template = pst.newTemplateSymbol( identifier.toCharArray() ); provider.setType( ITypeInfo.t_templateParameter ); provider.setTemplateParameterType( ITypeInfo.t_template ); template.setTypeInfo( provider.completeConstruction() ); @@ -3074,19 +3077,19 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto try { template.addTemplateParameter( param.getSymbol() ); } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), param.getName(), param.getStartingOffset(), param.getEndingOffset(), param.getStartingLine(), true ); //$NON-NLS-1$ + handleProblem( e.createProblemID(), param.getNameArray(), param.getStartingOffset(), param.getEndingOffset(), param.getStartingLine(), true ); //$NON-NLS-1$ } } symbol = template; } else { if( kind == ParamKind.CLASS || kind == ParamKind.TYPENAME ){ - symbol = pst.newSymbol( identifier ); + symbol = pst.newSymbol( identifier.toCharArray() ); provider.setType( ITypeInfo.t_templateParameter ); provider.setTemplateParameterType( ITypeInfo.t_typeName ); symbol.setTypeInfo( provider.completeConstruction() ); } else /*ParamKind.PARAMETER*/ { - symbol = cloneSimpleTypeSymbol( parameter.getName(), parameter, null ); + symbol = cloneSimpleTypeSymbol( ((ASTParameterDeclaration)parameter).getNameArray(), parameter, null ); provider.setTemplateParameterType( symbol.getType() ); provider.setType( ITypeInfo.t_templateParameter ); provider.setTypeSymbol( symbol.getTypeSymbol() ); @@ -3127,7 +3130,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IASTScope scope, int startingOffset, int startingLine, char[] fn) { - ITemplateSymbol template = pst.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME ); + ITemplateSymbol template = pst.newTemplateSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); ASTTemplateSpecialization ast = new ASTTemplateSpecialization( template, scope, fn ); ast.setStartingOffsetAndLineNumber( startingOffset, startingLine ); @@ -3145,17 +3148,17 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn) throws ASTSemanticException { - setFilename( fn ); + char[] nameArray = name.toCharArray(); IContainerSymbol containerSymbol = scopeToSymbol(scope); - ISymbol typeSymbol = cloneSimpleTypeSymbol( name, mapping, null ); + ISymbol typeSymbol = cloneSimpleTypeSymbol( nameArray, mapping, null ); if( typeSymbol == null ) - handleProblem( scope, IProblem.SEMANTICS_RELATED, name, nameOffset, nameEndOffset, nameLine, true ); + handleProblem( scope, IProblem.SEMANTICS_RELATED, nameArray, nameOffset, nameEndOffset, nameLine, true ); setPointerOperators( typeSymbol, mapping.getPointerOperators(), mapping.getArrayModifiers() ); if( typeSymbol.getType() != ITypeInfo.t_type ){ - ISymbol newSymbol = pst.newSymbol( name, ITypeInfo.t_type); + ISymbol newSymbol = pst.newSymbol( nameArray, ITypeInfo.t_type); newSymbol.getTypeInfo().setBit( true,ITypeInfo.isTypedef ); newSymbol.setTypeSymbol( typeSymbol ); typeSymbol = newSymbol; @@ -3183,7 +3186,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } catch (ParserSymbolTableException e) { - handleProblem(e.createProblemID(), name ); + handleProblem(e.createProblemID(), nameArray ); } ASTTypedef d = new ASTTypedef( typeSymbol, mapping, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, references, filename ); attachSymbolExtension(typeSymbol, d, true ); @@ -3212,7 +3215,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto ITypeInfo.eType pstType = classKindToTypeInfo(kind); List references = new ArrayList(); IToken nameToken = name.getFirstToken(); - String newSymbolName = EMPTY_STRING; + char[] newSymbolName = EMPTY_STRING; List templateIdArgList = null; boolean isTemplateId = false; if (name.getSegmentCount() != 1) // qualified name @@ -3227,7 +3230,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } if (currentScopeSymbol == null) handleProblem(IProblem.SEMANTIC_NAME_NOT_FOUND, - containerSymbolName.toString(), containerSymbolName + containerSymbolName.toCharArray(), containerSymbolName .getFirstToken().getOffset(), containerSymbolName.getLastToken().getEndOffset(), containerSymbolName.getLastToken().getLineNumber(), true); @@ -3239,7 +3242,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto isTemplateId = true; templateIdArgList = array[array.length - 1]; } - newSymbolName = nameToken.getImage(); + newSymbolName = nameToken.getCharImage(); ISymbol checkSymbol = null; if (!isTemplateId) { try { @@ -3251,7 +3254,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto newSymbolName); } } catch (ParserSymbolTableException e) { - handleProblem(e.createProblemID(), nameToken.getImage(), + handleProblem(e.createProblemID(), nameToken.getCharImage(), nameToken.getOffset(), nameToken.getEndOffset(), nameToken.getLineNumber(), true); } @@ -3267,13 +3270,13 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto try { currentScopeSymbol.addTemplateId(checkSymbol, args); } catch (ParserSymbolTableException e) { - handleProblem(e.createProblemID(), nameToken.getImage(), + handleProblem(e.createProblemID(), nameToken.getCharImage(), nameToken.getOffset(), nameToken.getEndOffset(), nameToken.getLineNumber(), true); } } else { handleProblem(IProblem.SEMANTIC_INVALID_TEMPLATE, nameToken - .getImage()); + .getCharImage()); } checkSymbol = ((ASTTemplateInstantiation) scope) .getInstanceSymbol(); @@ -3291,7 +3294,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto currentScopeSymbol.addTemplateId(checkSymbol, args); } } catch (ParserSymbolTableException e1) { - handleProblem(e1.createProblemID(), nameToken.getImage(), + handleProblem(e1.createProblemID(), nameToken.getCharImage(), nameToken.getOffset(), nameToken.getEndOffset(), nameToken.getLineNumber(), true); } @@ -3302,6 +3305,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto .getLineNumber(), endOffset, endingLine, references, isForewardDecl, filename); attachSymbolExtension(checkSymbol, elab, !isForewardDecl); + return elab; } else if (isFriend) { ((IDerivableContainerSymbol) originalScope).addFriend(checkSymbol); } @@ -3355,9 +3359,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto ISymbol namespaceSymbol = lookupQualifiedName( startingSymbol, alias, references, true ); if( namespaceSymbol.getType() != ITypeInfo.t_namespace ) - handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, alias.toString(), startingOffset, endOffset, startingLine, true ); + handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, alias.toCharArray(), startingOffset, endOffset, startingLine, true ); - ISymbol newSymbol = pst.newContainerSymbol( identifier, ITypeInfo.t_namespace ); + ISymbol newSymbol = pst.newContainerSymbol( identifier.toCharArray(), ITypeInfo.t_namespace ); newSymbol.setForwardSymbol( namespaceSymbol ); try @@ -3366,11 +3370,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), identifier, startingOffset, endOffset, startingLine, true ); + handleProblem( e.createProblemID(), identifier.toCharArray(), startingOffset, endOffset, startingLine, true ); } ASTNamespaceAlias astAlias = new ASTNamespaceAlias( - newSymbol, alias.toString(), (IASTNamespaceDefinition)namespaceSymbol.getASTExtension().getPrimaryDeclaration(), + newSymbol, alias.toCharArray(), (IASTNamespaceDefinition)namespaceSymbol.getASTExtension().getPrimaryDeclaration(), startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endOffset, endingLine, references, filename ); attachSymbolExtension( newSymbol, astAlias, true ); return astAlias; @@ -3452,7 +3456,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn) { setFilename(fn); - return new ASTParameterDeclaration( null, isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endingLine, filename ); + return new ASTParameterDeclaration( null, isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName.toCharArray(), initializerClause, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endingLine, filename ); } /* (non-Javadoc) @@ -3468,7 +3472,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto return check; } ASTTypeId result = - new ASTTypeId( kind, name, pointerOps, arrayMods, completeSignature, + new ASTTypeId( kind, name, pointerOps, arrayMods, completeSignature.toCharArray(), isConst, isVolatile, isUnsigned, isSigned, isShort, isLong, isTypename ); result.setTypeSymbol( createSymbolForTypeId( scope, result ) ); if( kind != Type.CLASS_OR_TYPENAME ) @@ -3527,7 +3531,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto if( typeSymbol == null /*|| typeSymbol.getType() == TypeInfo.t_type*/ ) { freeReferences( refs ); - handleProblem( scope, IProblem.SEMANTIC_INVALID_TYPE, id.getTypeOrClassName() ); + handleProblem( scope, IProblem.SEMANTIC_INVALID_TYPE, id.getTypeOrClassName().toCharArray() ); } result.setTypeSymbol( typeSymbol ); typeId.addReferences( refs, cache ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionFactory.java index 90edea9921a..9fa7e7420d6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionFactory.java @@ -27,7 +27,7 @@ public class ExpressionFactory { public static ASTExpression createExpression(Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor, List references ) { if( !literal.equals( "") && idExpression == null ) //$NON-NLS-1$ - return new ASTLiteralExpression( kind, references, literal ); + return new ASTLiteralExpression( kind, references, literal.toCharArray() ); if( idExpression != null && lhs == null ) return new ASTIdExpression( kind, references, idExpression ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/gcc/ASTGCCSimpleTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/gcc/ASTGCCSimpleTypeSpecifier.java index 54e483252bd..5e7ab28d3ff 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/gcc/ASTGCCSimpleTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/gcc/ASTGCCSimpleTypeSpecifier.java @@ -32,7 +32,7 @@ public class ASTGCCSimpleTypeSpecifier extends ASTSimpleTypeSpecifier implements * @param string * @param references */ - public ASTGCCSimpleTypeSpecifier(ISymbol s, boolean b, String string, List references, IASTExpression typeOfExpression ) { + public ASTGCCSimpleTypeSpecifier(ISymbol s, boolean b, char[] string, List references, IASTExpression typeOfExpression ) { super(s, b, string, references); expression = typeOfExpression; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/GCCASTExpressionExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/GCCASTExpressionExtension.java index 6934ea77444..bd5c56420d2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/GCCASTExpressionExtension.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/GCCASTExpressionExtension.java @@ -60,7 +60,7 @@ public class GCCASTExpressionExtension extends GCCASTExtension { * @return */ private static IASTExpression createExpression(IASTExpression.Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, String idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) { - if( !idExpression.equals( EMPTY_STRING ) && literal.equals( EMPTY_STRING )) + if( !idExpression.equals( String.valueOf(EMPTY_STRING) ) && literal.equals( String.valueOf(EMPTY_STRING) )) return new ASTIdExpression( kind, idExpression ) { public long evaluateExpression() throws ASTExpressionEvaluationException { @@ -132,6 +132,6 @@ public class GCCASTExpressionExtension extends GCCASTExtension { * @see org.eclipse.cdt.core.parser.extension.IASTFactoryExtension#createExpression(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.core.parser.ast.IASTExpression.Kind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTTypeId, org.eclipse.cdt.core.parser.ITokenDuple, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor, java.util.List) */ public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor, List references) { - return createExpression( kind, lhs, rhs, thirdExpression, typeId, (idExpression == null ) ? EMPTY_STRING : idExpression.toString(), literal, newDescriptor ); + return createExpression( kind, lhs, rhs, thirdExpression, typeId, (idExpression == null ) ? String.valueOf(EMPTY_STRING) : idExpression.toString(), literal, newDescriptor ); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/gcc/ASTGCCDesignator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/gcc/ASTGCCDesignator.java index e4f3633312d..128f39d1fdb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/gcc/ASTGCCDesignator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/gcc/ASTGCCDesignator.java @@ -32,7 +32,7 @@ public class ASTGCCDesignator extends ASTDesignator * @param fieldName * @param fieldOffset */ - public ASTGCCDesignator(IASTDesignator.DesignatorKind kind, IASTExpression constantExpression, String fieldName, int fieldOffset, IASTExpression secondSubscriptExpression) { + public ASTGCCDesignator(IASTDesignator.DesignatorKind kind, IASTExpression constantExpression, char[] fieldName, int fieldOffset, IASTExpression secondSubscriptExpression) { super(kind, constantExpression, fieldName, fieldOffset); secondExpression = secondSubscriptExpression; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java index dc295d8408d..4f6d96b1592 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java @@ -50,7 +50,7 @@ public class ASTElaboratedTypeSpecifier extends ASTNode implements IASTElaborate setNameOffset( nameOffset ); setNameEndOffsetAndLineNumber( nameEndOffset, nameLine ); setEndingOffsetAndLineNumber( endOffset, endingLine ); - qualifiedName = new ASTQualifiedNamedElement( scope, typeName ); + qualifiedName = new ASTQualifiedNamedElement( scope, typeName.toCharArray() ); fn = filename; } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java index a375adc1760..f0a9368482c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java @@ -51,7 +51,7 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction ownerTemplate.setOwnedDeclaration( this ); setStartingOffsetAndLineNumber( startOffset, startLine ); setNameOffset( nameOffset ); - qualifiedName = new ASTQualifiedNamedElement( scope, name ); + qualifiedName = new ASTQualifiedNamedElement( scope, name.toCharArray() ); setNameEndOffsetAndLineNumber(nameEndOffset, nameLine); this.hasFunctionTryBlock = hasFunctionTryBlock; this.varArgs = hasVarArgs; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java index 71fc87f924e..f945f11893f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java @@ -98,7 +98,7 @@ public class ASTMethod extends ASTFunction implements IASTMethod this.isVolatile = isVolatile; this.visibility = visibility; this.constructorChainElements = constructorChainElements; - qualifiedName = new ASTQualifiedNamedElement( scope, name ); + qualifiedName = new ASTQualifiedNamedElement( scope, name.toCharArray() ); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isVirtual() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java index 0c0999587ff..53670992d62 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java @@ -40,7 +40,7 @@ public class ASTNamespaceDefinition extends ASTDeclaration implements IASTNamesp public ASTNamespaceDefinition( IASTScope scope, String name, int startOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] filename ) { super( scope ); - qualifiedNameElement = new ASTQualifiedNamedElement( scope, name ); + qualifiedNameElement = new ASTQualifiedNamedElement( scope, name.toCharArray() ); this.name = name; setStartingOffsetAndLineNumber(startOffset, startingLine); setNameOffset(nameOffset); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java index a41aff0863e..80a98be42fa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java @@ -26,7 +26,7 @@ public class ASTScopedTypeSpecifier extends ASTQualifiedNamedElement implements public ASTScopedTypeSpecifier( IASTScope scope, String name ) { - super( scope, name ); + super( scope, name.toCharArray() ); this.scope = scope; } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java index bb10ffb5add..27a00a30945 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java @@ -51,7 +51,7 @@ public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedef setStartingOffsetAndLineNumber(startingOffset, startingLine); setNameOffset(nameOffset); setNameEndOffsetAndLineNumber(nameEndOffset, nameLine); - qualifiedName = new ASTQualifiedNamedElement( scope, name ); + qualifiedName = new ASTQualifiedNamedElement( scope, name.toCharArray() ); fn = filename; } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java index 7b96a142215..f6cdb1b922e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java @@ -62,7 +62,7 @@ public class ASTVariable extends ASTDeclaration implements IASTVariable this.isStatic = isStatic; this.name = name; this.constructorExpression = constructorExpression; - qualifiedName = new ASTQualifiedNamedElement( scope, name ); + qualifiedName = new ASTQualifiedNamedElement( scope, name.toCharArray() ); setStartingOffsetAndLineNumber(startingOffset, startLine); setNameOffset(nameOffset); setNameEndOffsetAndLineNumber( nameEndOffset, nameLine ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicSymbol.java index c0e2f4ae6ed..8c252750d72 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicSymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicSymbol.java @@ -19,12 +19,12 @@ import java.util.Map; public class BasicSymbol extends ExtensibleSymbol implements ISymbol { - public BasicSymbol( ParserSymbolTable table, String name ){ + public BasicSymbol( ParserSymbolTable table, char[] name ){ super( table ); _name = name; } - public BasicSymbol( ParserSymbolTable table, String name, ITypeInfo.eType typeInfo ) + public BasicSymbol( ParserSymbolTable table, char[] name, ITypeInfo.eType typeInfo ) { super( table ); _name = name; @@ -42,8 +42,8 @@ public class BasicSymbol extends ExtensibleSymbol implements ISymbol return newSymbol; } - public String getName() { return _name; } - public void setName(String name) { _name = name; } + public char[] getName() { return _name; } + public void setName(char[] name) { _name = name; } public void setContainingSymbol( IContainerSymbol scope ){ @@ -167,7 +167,7 @@ public class BasicSymbol extends ExtensibleSymbol implements ISymbol _isInvisible = invisible ; } - private String _name; //our name + private char[] _name; //our name private ITypeInfo _typeInfo; //our type info private int _depth; //how far down the scope stack we are diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicTypeInfo.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicTypeInfo.java index be73e9be07e..505d4266bbc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicTypeInfo.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicTypeInfo.java @@ -237,33 +237,33 @@ public class BasicTypeInfo implements ITypeInfo { return result; } - private static final String _image[] = { "", //$NON-NLS-1$ t_undef - "", //$NON-NLS-1$ t_type - "namespace", //$NON-NLS-1$ t_namespace - "class", //$NON-NLS-1$ t_class - "struct", //$NON-NLS-1$ t_struct - "union", //$NON-NLS-1$ t_union - "enum", //$NON-NLS-1$ t_enumeration - "", //$NON-NLS-1$ t_constructor - "", //$NON-NLS-1$ t_function - "_Bool", //$NON-NLS-1$ t__Bool - "bool", //$NON-NLS-1$ t_bool - "char", //$NON-NLS-1$ t_char - "wchar_t", //$NON-NLS-1$ t_wchar_t - "int", //$NON-NLS-1$ t_int - "float", //$NON-NLS-1$ t_float - "double", //$NON-NLS-1$ t_double - "void", //$NON-NLS-1$ t_void - "", //$NON-NLS-1$ t_enumerator - "", //$NON-NLS-1$ t_block - "template", //$NON-NLS-1$ t_template - "", //$NON-NLS-1$ t_asm - "", //$NON-NLS-1$ t_linkage - "", //$NON-NLS-1$ t_templateParameter - "typename" //$NON-NLS-1$ t_typeName + private static final char _image[][] = { "".toCharArray(), //$NON-NLS-1$ t_undef + "".toCharArray(), //$NON-NLS-1$ t_type + "namespace".toCharArray(), //$NON-NLS-1$ t_namespace + "class".toCharArray(), //$NON-NLS-1$ t_class + "struct".toCharArray(), //$NON-NLS-1$ t_struct + "union".toCharArray(), //$NON-NLS-1$ t_union + "enum".toCharArray(), //$NON-NLS-1$ t_enumeration + "".toCharArray(), //$NON-NLS-1$ t_constructor + "".toCharArray(), //$NON-NLS-1$ t_function + "_Bool".toCharArray(), //$NON-NLS-1$ t__Bool + "bool".toCharArray(), //$NON-NLS-1$ t_bool + "char".toCharArray(), //$NON-NLS-1$ t_char + "wchar_t".toCharArray(), //$NON-NLS-1$ t_wchar_t + "int".toCharArray(), //$NON-NLS-1$ t_int + "float".toCharArray(), //$NON-NLS-1$ t_float + "double".toCharArray(), //$NON-NLS-1$ t_double + "void".toCharArray(), //$NON-NLS-1$ t_void + "".toCharArray(), //$NON-NLS-1$ t_enumerator + "".toCharArray(), //$NON-NLS-1$ t_block + "template".toCharArray(), //$NON-NLS-1$ t_template + "".toCharArray(), //$NON-NLS-1$ t_asm + "".toCharArray(), //$NON-NLS-1$ t_linkage + "".toCharArray(), //$NON-NLS-1$ t_templateParameter + "typename".toCharArray() //$NON-NLS-1$ t_typeName }; - public String toString() { + public char[] toCharArray() { if( isType( t_type ) && getTypeSymbol() != null ){ return getTypeSymbol().getName(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ContainerSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ContainerSymbol.java index 5b095570828..ca2939b5645 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ContainerSymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ContainerSymbol.java @@ -29,8 +29,10 @@ import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import org.eclipse.cdt.core.parser.ast.IASTMember; import org.eclipse.cdt.core.parser.ast.IASTNode; import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.LookupData; -import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArraySet; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayUtils; import org.eclipse.cdt.internal.core.parser.scanner2.ObjectSet; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayObjectMap; /** * @author aniefer @@ -40,11 +42,11 @@ import org.eclipse.cdt.internal.core.parser.scanner2.ObjectSet; */ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { - protected ContainerSymbol( ParserSymbolTable table, String name ){ + protected ContainerSymbol( ParserSymbolTable table, char[] name ){ super( table, name ); } - protected ContainerSymbol( ParserSymbolTable table, String name, ITypeInfo.eType typeInfo ){ + protected ContainerSymbol( ParserSymbolTable table, char[] name, ITypeInfo.eType typeInfo ){ super( table, name, typeInfo ); } @@ -52,7 +54,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { ContainerSymbol copy = (ContainerSymbol)super.clone(); copy._usingDirectives = (_usingDirectives != Collections.EMPTY_LIST) ? (List) ((ArrayList)_usingDirectives).clone() : _usingDirectives; - copy._containedSymbols = (ObjectMap) ( ( _containedSymbols != ObjectMap.EMPTY_MAP )? _containedSymbols.clone() : _containedSymbols ); + copy._containedSymbols = (CharArrayObjectMap) ( ( _containedSymbols != CharArrayObjectMap.EMPTY_MAP )? _containedSymbols.clone() : _containedSymbols ); copy._contents = (_contents != Collections.EMPTY_LIST) ? (List) ((ArrayList)_contents).clone() : _contents; return copy; @@ -188,7 +190,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { } } - boolean unnamed = obj.getName().equals( ParserSymbolTable.EMPTY_NAME ); + boolean unnamed = CharArrayUtils.equals( obj.getName(), ParserSymbolTable.EMPTY_NAME_ARRAY ); Object origObj = null; @@ -344,15 +346,15 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { * class being defined, or shall refer to an enumerator for an enumeration * type that is a member of a base class of the class being defined. */ - public IUsingDeclarationSymbol addUsingDeclaration( String name ) throws ParserSymbolTableException { + public IUsingDeclarationSymbol addUsingDeclaration( char[] name ) throws ParserSymbolTableException { return addUsingDeclaration( name, null ); } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#addUsingDeclaration(java.lang.String, org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol) */ - public IUsingDeclarationSymbol addUsingDeclaration( String name, IContainerSymbol declContext ) throws ParserSymbolTableException{ - LookupData data = new LookupData( name ); + public IUsingDeclarationSymbol addUsingDeclaration( char[] name, IContainerSymbol declContext ) throws ParserSymbolTableException{ + LookupData data = new LookupData( name ); if( declContext != null ){ data.qualified = true; @@ -421,20 +423,20 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#getContainedSymbols() */ - public ObjectMap getContainedSymbols(){ + public CharArrayObjectMap getContainedSymbols(){ return _containedSymbols; } - protected void putInContainedSymbols( String key, Object obj ){ - if( _containedSymbols == ObjectMap.EMPTY_MAP ){ - _containedSymbols = new ObjectMap( 4 ); + protected void putInContainedSymbols( char[] key, Object obj ){ + if( _containedSymbols == CharArrayObjectMap.EMPTY_MAP ){ + _containedSymbols = new CharArrayObjectMap( 4 ); } _containedSymbols.put( key, obj ); } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#elaboratedLookup(org.eclipse.cdt.internal.core.parser.pst.TypeInfo.eType, java.lang.String) */ - public ISymbol elaboratedLookup( final ITypeInfo.eType type, String name ) throws ParserSymbolTableException{ + public ISymbol elaboratedLookup( final ITypeInfo.eType type, char[] name ) throws ParserSymbolTableException{ LookupData data = new LookupData( name ){ public TypeFilter getFilter() { if( t == ITypeInfo.t_any ) return ANY_FILTER; @@ -469,7 +471,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookup(java.lang.String) */ - public ISymbol lookup( String name ) throws ParserSymbolTableException { + public ISymbol lookup( char[] name ) throws ParserSymbolTableException { LookupData data = new LookupData( name ); ParserSymbolTable.lookup( data, this ); @@ -514,7 +516,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { * ie, We need a seperate lookup function for looking up the member names * for a definition. */ - public ISymbol lookupMemberForDefinition( String name ) throws ParserSymbolTableException{ + public ISymbol lookupMemberForDefinition( char[] name ) throws ParserSymbolTableException{ LookupData data = new LookupData( name ); data.qualified = true; @@ -534,7 +536,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { return null; } - public IParameterizedSymbol lookupMethodForDefinition( String name, final List parameters ) throws ParserSymbolTableException{ + public IParameterizedSymbol lookupMethodForDefinition( char[] name, final List parameters ) throws ParserSymbolTableException{ LookupData data = new LookupData( name ){ public List getParameters() { return params; } final private List params = ( parameters == null ) ? Collections.EMPTY_LIST : parameters; @@ -574,10 +576,10 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { * the ::, object, function and enumerator names are ignored. If the name * is not a class-name or namespace-name, the program is ill-formed */ - public IContainerSymbol lookupNestedNameSpecifier( String name ) throws ParserSymbolTableException { + public IContainerSymbol lookupNestedNameSpecifier( char[] name ) throws ParserSymbolTableException { return lookupNestedNameSpecifier( name, this ); } - private IContainerSymbol lookupNestedNameSpecifier(String name, IContainerSymbol inSymbol ) throws ParserSymbolTableException{ + private IContainerSymbol lookupNestedNameSpecifier(char[] name, IContainerSymbol inSymbol ) throws ParserSymbolTableException{ ISymbol foundSymbol = null; final TypeFilter filter = new TypeFilter( ITypeInfo.t_namespace ); @@ -609,7 +611,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#qualifiedLookup(java.lang.String) */ - public ISymbol qualifiedLookup( String name ) throws ParserSymbolTableException{ + public ISymbol qualifiedLookup( char[] name ) throws ParserSymbolTableException{ LookupData data = new LookupData( name ); data.qualified = true; ParserSymbolTable.lookup( data, this ); @@ -620,7 +622,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#qualifiedLookup(java.lang.String, org.eclipse.cdt.internal.core.parser.pst.TypeInfo.eType) */ - public ISymbol qualifiedLookup( String name, final ITypeInfo.eType t ) throws ParserSymbolTableException{ + public ISymbol qualifiedLookup( char[] name, final ITypeInfo.eType t ) throws ParserSymbolTableException{ LookupData data = new LookupData( name ){ public TypeFilter getFilter() { if( t == ITypeInfo.t_any ) return ANY_FILTER; @@ -663,7 +665,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { * ordinary unqualified lookup and the set of declarations found in the * namespaces and classes associated with the argument types. */ - public IParameterizedSymbol unqualifiedFunctionLookup( String name, final List parameters ) throws ParserSymbolTableException{ + public IParameterizedSymbol unqualifiedFunctionLookup( char[] name, final List parameters ) throws ParserSymbolTableException{ //figure out the set of associated scopes first, so we can remove those that are searched //during the normal lookup to avoid doing them twice final ObjectSet associated = new ObjectSet(0); @@ -756,7 +758,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { * Member lookup really proceeds as an unqualified lookup, but doesn't * include argument dependant scopes */ - public IParameterizedSymbol memberFunctionLookup( String name, final List parameters ) throws ParserSymbolTableException{ + public IParameterizedSymbol memberFunctionLookup( char[] name, final List parameters ) throws ParserSymbolTableException{ LookupData data = new LookupData( name ){ public List getParameters() { return params; } final private List params = ( parameters == null ) ? Collections.EMPTY_LIST : parameters; @@ -769,7 +771,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#qualifiedFunctionLookup(java.lang.String, java.util.List) */ - public IParameterizedSymbol qualifiedFunctionLookup( String name, final List parameters ) throws ParserSymbolTableException{ + public IParameterizedSymbol qualifiedFunctionLookup( char[] name, final List parameters ) throws ParserSymbolTableException{ LookupData data = new LookupData( name ){ public List getParameters() { return params; } final private List params = ( parameters == null ) ? Collections.EMPTY_LIST : parameters; @@ -785,7 +787,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#templateLookup(java.lang.String, java.util.List) */ - public ISymbol lookupTemplateId( String name, List arguments ) throws ParserSymbolTableException + public ISymbol lookupTemplateId( char[] name, List arguments ) throws ParserSymbolTableException { LookupData data = new LookupData( name ); @@ -807,7 +809,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookupFunctionTemplateId(java.lang.String, java.util.List, java.util.List) */ - public ISymbol lookupFunctionTemplateId(String name, final List parameters, final List arguments, boolean forDefinition) throws ParserSymbolTableException { + public ISymbol lookupFunctionTemplateId(char[] name, final List parameters, final List arguments, boolean forDefinition) throws ParserSymbolTableException { LookupData data = new LookupData( name ){ public List getParameters() { return params; } public List getTemplateParameters() { return templateParams; } @@ -827,27 +829,27 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookupTemplateIdForDefinition(java.lang.String, java.util.List) */ - public IContainerSymbol lookupTemplateIdForDefinition(String name, List arguments){ + public IContainerSymbol lookupTemplateIdForDefinition(char[] name, List arguments){ // TODO Auto-generated method stub return null; } - public List prefixLookup( final TypeFilter filter, String prefix, boolean qualified, final List paramList ) throws ParserSymbolTableException{ + public List prefixLookup( final TypeFilter filter, char[] prefix, boolean qualified, final List paramList ) throws ParserSymbolTableException{ LookupData data = new LookupData( prefix ){ public List getParameters() { return params; } public boolean isPrefixLookup(){ return true; } - public ObjectSet getAmbiguities(){ return ambiguities; } + public CharArraySet getAmbiguities(){ return ambiguities; } public TypeFilter getFilter() { return typeFilter; } - public void addAmbiguity( String n ){ - if( ambiguities == ObjectSet.EMPTY_SET ){ - ambiguities = new ObjectSet(2); + public void addAmbiguity( char[] n ){ + if( ambiguities == CharArraySet.EMPTY_SET ){ + ambiguities = new CharArraySet(2); } ambiguities.put( n ); } final private List params = paramList; - private ObjectSet ambiguities = ObjectSet.EMPTY_SET; + private CharArraySet ambiguities = CharArraySet.EMPTY_SET; final private TypeFilter typeFilter = filter; }; @@ -857,7 +859,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { List constructors = null; if( filter != null && filter.willAccept( ITypeInfo.t_constructor ) && (this instanceof IDerivableContainerSymbol) ){ - if( getName().startsWith( prefix ) ){ + if( CharArrayUtils.equals( getName(), 0, prefix.length, prefix, true ) ){ List temp = ((IDerivableContainerSymbol)this).getConstructors(); int size = temp.size(); constructors = new ArrayList( size ); @@ -880,7 +882,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { List list = new ArrayList(); Object obj = null; - Object key = null; + char[] key = null; List tempList = null; int size = data.foundItems.size(); for( int i = 0; i < size; i++ ){ @@ -1175,10 +1177,12 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { static final private Collator collator = Collator.getInstance(); static { collator.setStrength( Collator.PRIMARY ); } public int compare( Object o1, Object o2 ){ - int result = collator.compare( o1, o2 ); + String s1 = String.valueOf( (char[])o1 ); + String s2 = String.valueOf( (char[])o2 ); + int result = collator.compare( s1, s2 ); if( result == 0 ){ collator.setStrength( Collator.IDENTICAL ); - result = collator.compare( o1, o2 ); + result = collator.compare( s1, s2 ); collator.setStrength( Collator.PRIMARY ); } return result; @@ -1191,7 +1195,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol { private List _contents = Collections.EMPTY_LIST; //ordered list of all contents of this symbol private List _usingDirectives = Collections.EMPTY_LIST; //collection of nominated namespaces - private ObjectMap _containedSymbols = ObjectMap.EMPTY_MAP; //declarations contained by us. + private CharArrayObjectMap _containedSymbols = CharArrayObjectMap.EMPTY_MAP; //declarations contained by us. /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#addTemplateId(org.eclipse.cdt.internal.core.parser.pst.ISymbol, java.util.List) */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DeferredTemplateInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DeferredTemplateInstance.java index e766fcb6343..875785e57b2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DeferredTemplateInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DeferredTemplateInstance.java @@ -23,7 +23,7 @@ import java.util.Map; public class DeferredTemplateInstance extends BasicSymbol implements IDeferredTemplateInstance { public DeferredTemplateInstance( ParserSymbolTable table, ITemplateSymbol template, List args ){ - super(table, ParserSymbolTable.EMPTY_NAME ); + super(table, ParserSymbolTable.EMPTY_NAME_ARRAY ); _template = template; _arguments = new ArrayList( args ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DerivableContainerSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DerivableContainerSymbol.java index c3424162e00..9e1fa012c06 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DerivableContainerSymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DerivableContainerSymbol.java @@ -22,7 +22,7 @@ import java.util.Map; import org.eclipse.cdt.core.parser.ParserLanguage; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.LookupData; -import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayObjectMap; /** * @author aniefer @@ -32,11 +32,11 @@ import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; */ public class DerivableContainerSymbol extends ContainerSymbol implements IDerivableContainerSymbol { - protected DerivableContainerSymbol( ParserSymbolTable table, String name ){ + protected DerivableContainerSymbol( ParserSymbolTable table, char[] name ){ super( table, name ); } - protected DerivableContainerSymbol( ParserSymbolTable table, String name, ITypeInfo.eType typeInfo ){ + protected DerivableContainerSymbol( ParserSymbolTable table, char[] name, ITypeInfo.eType typeInfo ){ super( table, name, typeInfo ); } @@ -231,7 +231,7 @@ public class DerivableContainerSymbol extends ContainerSymbol implements IDeriva */ public IParameterizedSymbol lookupConstructor( final List parameters ) throws ParserSymbolTableException { - LookupData data = new LookupData( ParserSymbolTable.EMPTY_NAME ){ + LookupData data = new LookupData( ParserSymbolTable.EMPTY_NAME_ARRAY ){ public List getParameters() { return params; } public TypeFilter getFilter() { return CONSTRUCTOR_FILTER; } final private List params = parameters; @@ -285,7 +285,7 @@ public class DerivableContainerSymbol extends ContainerSymbol implements IDeriva LookupData data = new LookupData( ParserSymbolTable.THIS ); try { - ObjectMap map = ParserSymbolTable.lookupInContained( data, obj ); + CharArrayObjectMap map = ParserSymbolTable.lookupInContained( data, obj ); foundThis = ( map != null ) ? map.containsKey( data.name ) : false; } catch (ParserSymbolTableException e) { return false; @@ -366,7 +366,7 @@ public class DerivableContainerSymbol extends ContainerSymbol implements IDeriva * without considering scopes that are outside the innermost enclosing non- * class scope. */ - public ISymbol lookupForFriendship( String name ) throws ParserSymbolTableException{ + public ISymbol lookupForFriendship( char[] name ) throws ParserSymbolTableException{ IContainerSymbol enclosing = getContainingSymbol(); if( enclosing != null && enclosing.isType( ITypeInfo.t_namespace, ITypeInfo.t_union ) ){ while( enclosing != null && ( enclosing.getType() != ITypeInfo.t_namespace) ) @@ -386,7 +386,7 @@ public class DerivableContainerSymbol extends ContainerSymbol implements IDeriva return getSymbolTable().resolveAmbiguities( data ); } - public IParameterizedSymbol lookupFunctionForFriendship( String name, final List parameters ) throws ParserSymbolTableException{ + public IParameterizedSymbol lookupFunctionForFriendship( char[] name, final List parameters ) throws ParserSymbolTableException{ IContainerSymbol enclosing = getContainingSymbol(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java index 5c0b8830618..eaaa5dc7569 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java @@ -16,7 +16,7 @@ package org.eclipse.cdt.internal.core.parser.pst; import java.util.Iterator; import java.util.List; -import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayObjectMap; /** * @author aniefer @@ -70,10 +70,10 @@ public interface IContainerSymbol extends ISymbol { * IDerivableContainerSymbol * r_CircularInheritance if during lookup of the name, we come across a class with a circular inheritance tree */ - public IUsingDeclarationSymbol addUsingDeclaration( String name ) throws ParserSymbolTableException; - public IUsingDeclarationSymbol addUsingDeclaration( String name, IContainerSymbol declContext ) throws ParserSymbolTableException; + public IUsingDeclarationSymbol addUsingDeclaration( char[] name ) throws ParserSymbolTableException; + public IUsingDeclarationSymbol addUsingDeclaration( char[] name, IContainerSymbol declContext ) throws ParserSymbolTableException; - public ObjectMap getContainedSymbols(); + public CharArrayObjectMap getContainedSymbols(); /** * Lookup symbols matching the given prefix @@ -87,7 +87,7 @@ public interface IContainerSymbol extends ISymbol { * IDerivableContainerSymbol * r_CircularInheritance if during lookup, we come across a class with a circular inheritance tree */ - public List prefixLookup( TypeFilter filter, String prefix, boolean qualified, List paramList ) throws ParserSymbolTableException; + public List prefixLookup( TypeFilter filter, char[] prefix, boolean qualified, List paramList ) throws ParserSymbolTableException; /** * Lookups @@ -98,16 +98,16 @@ public interface IContainerSymbol extends ISymbol { * IDerivableContainerSymbol * r_CircularInheritance if during lookup of the name, we come across a class with a circular inheritance tree */ - public ISymbol elaboratedLookup( ITypeInfo.eType type, String name ) throws ParserSymbolTableException; - public ISymbol lookup( String name ) throws ParserSymbolTableException; - public ISymbol lookupMemberForDefinition( String name ) throws ParserSymbolTableException; - public IParameterizedSymbol lookupMethodForDefinition( String name, List parameters ) throws ParserSymbolTableException; - public IContainerSymbol lookupNestedNameSpecifier( String name ) throws ParserSymbolTableException; - public ISymbol qualifiedLookup( String name ) throws ParserSymbolTableException; - public ISymbol qualifiedLookup( String name, ITypeInfo.eType t ) throws ParserSymbolTableException; - public IParameterizedSymbol unqualifiedFunctionLookup( String name, List parameters ) throws ParserSymbolTableException; - public IParameterizedSymbol memberFunctionLookup( String name, List parameters ) throws ParserSymbolTableException; - public IParameterizedSymbol qualifiedFunctionLookup( String name, List parameters ) throws ParserSymbolTableException; + public ISymbol elaboratedLookup( ITypeInfo.eType type, char[] name ) throws ParserSymbolTableException; + public ISymbol lookup( char[] name ) throws ParserSymbolTableException; + public ISymbol lookupMemberForDefinition( char[] name ) throws ParserSymbolTableException; + public IParameterizedSymbol lookupMethodForDefinition( char[] name, List parameters ) throws ParserSymbolTableException; + public IContainerSymbol lookupNestedNameSpecifier( char[] name ) throws ParserSymbolTableException; + public ISymbol qualifiedLookup( char[] name ) throws ParserSymbolTableException; + public ISymbol qualifiedLookup( char[] name, ITypeInfo.eType t ) throws ParserSymbolTableException; + public IParameterizedSymbol unqualifiedFunctionLookup( char[] name, List parameters ) throws ParserSymbolTableException; + public IParameterizedSymbol memberFunctionLookup( char[] name, List parameters ) throws ParserSymbolTableException; + public IParameterizedSymbol qualifiedFunctionLookup( char[] name, List parameters ) throws ParserSymbolTableException; /** * @@ -119,10 +119,10 @@ public interface IContainerSymbol extends ISymbol { * r_Ambiguous if (14.5.4.1) more than one specialization can be used and none is more specializaed than all the others * r_BadTemplateArgument if (14.3.1, 14.3.2) a template argument is invalid */ - public ISymbol lookupTemplateId( String name, List arguments ) throws ParserSymbolTableException; - public ISymbol lookupFunctionTemplateId( String name, List parameters, List arguments, boolean forDefinition ) throws ParserSymbolTableException; + public ISymbol lookupTemplateId( char[] name, List arguments ) throws ParserSymbolTableException; + public ISymbol lookupFunctionTemplateId( char[] name, List parameters, List arguments, boolean forDefinition ) throws ParserSymbolTableException; - public IContainerSymbol lookupTemplateIdForDefinition( String name, List arguments ) throws ParserSymbolTableException; + public IContainerSymbol lookupTemplateIdForDefinition( char[] name, List arguments ) throws ParserSymbolTableException; /** * diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IDerivableContainerSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IDerivableContainerSymbol.java index 6de849c23d3..3375013efd1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IDerivableContainerSymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IDerivableContainerSymbol.java @@ -67,8 +67,8 @@ public interface IDerivableContainerSymbol extends IContainerSymbol { * IDerivableContainerSymbol * r_CircularInheritance if during lookup of the name, we come across a class with a circular inheritance tree */ - public ISymbol lookupForFriendship( String name ) throws ParserSymbolTableException; - public IParameterizedSymbol lookupFunctionForFriendship( String name, List parameters ) throws ParserSymbolTableException; + public ISymbol lookupForFriendship( char[] name ) throws ParserSymbolTableException; + public IParameterizedSymbol lookupFunctionForFriendship( char[] name, List parameters ) throws ParserSymbolTableException; public List getFriends(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IParameterizedSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IParameterizedSymbol.java index 444f534d797..813b90617f9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IParameterizedSymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IParameterizedSymbol.java @@ -18,7 +18,7 @@ package org.eclipse.cdt.internal.core.parser.pst; import java.util.List; -import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayObjectMap; /** * @author aniefer @@ -32,7 +32,7 @@ public interface IParameterizedSymbol extends IContainerSymbol { public void addParameter( ITypeInfo.eType type, int info, ITypeInfo.PtrOp ptrOp, boolean hasDefault ); public void addParameter( ISymbol typeSymbol, int info, ITypeInfo.PtrOp ptrOp, boolean hasDefault ); - public ObjectMap getParameterMap(); + public CharArrayObjectMap getParameterMap(); public List getParameterList(); //public void setParameterList( List list ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java index a2667d5a2eb..3c9d3e3a374 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java @@ -33,8 +33,8 @@ public interface ISymbol extends Cloneable, IExtensibleSymbol { */ public ISymbol instantiate( ITemplateSymbol template, Map argMap ) throws ParserSymbolTableException; - public void setName(String name); - public String getName(); + public void setName(char[] name); + public char[] getName(); public IContainerSymbol getContainingSymbol(); public void setContainingSymbol( IContainerSymbol containing ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ITypeInfo.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ITypeInfo.java index e146e3ecff0..15174f4c919 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ITypeInfo.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ITypeInfo.java @@ -246,7 +246,7 @@ public interface ITypeInfo { public abstract boolean equals( Object t ); - public abstract String toString(); + public abstract char[] toCharArray(); public abstract void clear(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParameterizedSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParameterizedSymbol.java index 44835c1171f..005b506d828 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParameterizedSymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParameterizedSymbol.java @@ -19,7 +19,7 @@ import java.util.List; import java.util.ListIterator; import java.util.Map; -import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayObjectMap; /** * @author aniefer @@ -27,13 +27,13 @@ import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ -public class ParameterizedSymbol extends ContainerSymbol implements IParameterizedSymbol { +public class ParameterizedSymbol extends ContainerSymbol implements IParameterizedSymbol { - protected ParameterizedSymbol( ParserSymbolTable table, String name ){ + protected ParameterizedSymbol( ParserSymbolTable table, char[] name ){ super( table, name ); } - protected ParameterizedSymbol( ParserSymbolTable table, String name, ITypeInfo.eType typeInfo ){ + protected ParameterizedSymbol( ParserSymbolTable table, char[] name, ITypeInfo.eType typeInfo ){ super( table, name, typeInfo ); } @@ -41,7 +41,7 @@ public class ParameterizedSymbol extends ContainerSymbol implements IParameteriz ParameterizedSymbol copy = (ParameterizedSymbol)super.clone(); copy._parameterList = ( _parameterList != Collections.EMPTY_LIST ) ? (List) ((ArrayList)_parameterList).clone() : _parameterList; - copy._parameterMap = ( _parameterMap != ObjectMap.EMPTY_MAP ) ? (ObjectMap) _parameterMap.clone() : _parameterMap; + copy._parameterMap = ( _parameterMap != CharArrayObjectMap.EMPTY_MAP ) ? (CharArrayObjectMap) _parameterMap.clone() : _parameterMap; return copy; } @@ -56,7 +56,7 @@ public class ParameterizedSymbol extends ContainerSymbol implements IParameteriz if( _returnType != null ){ if( _returnType.isType( ITypeInfo.t_templateParameter ) ){ if( argMap.containsKey( _returnType ) ){ - newParameterized.setReturnType( getSymbolTable().newSymbol( ParserSymbolTable.EMPTY_NAME ) ); + newParameterized.setReturnType( getSymbolTable().newSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ) ); newParameterized.getReturnType().setTypeInfo( (ITypeInfo) argMap.get( _returnType ) ); newParameterized.getReturnType().setInstantiatedSymbol( _returnType ); } @@ -121,11 +121,11 @@ public class ParameterizedSymbol extends ContainerSymbol implements IParameteriz _parameterList.add( param ); - String name = param.getName(); - if( name != null && !name.equals(ParserSymbolTable.EMPTY_NAME) ) + char[] name = param.getName(); + if( name != null && !name.equals(ParserSymbolTable.EMPTY_NAME_ARRAY) ) { - if( _parameterMap == ObjectMap.EMPTY_MAP ){ - _parameterMap = new ObjectMap( 2 ); + if( _parameterMap == CharArrayObjectMap.EMPTY_MAP ){ + _parameterMap = new CharArrayObjectMap( 2 ); } if( !_parameterMap.containsKey( name ) ) @@ -143,7 +143,7 @@ public class ParameterizedSymbol extends ContainerSymbol implements IParameteriz * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#addParameter(org.eclipse.cdt.internal.core.parser.pst.TypeInfo.eType, int, org.eclipse.cdt.internal.core.parser.pst.TypeInfo.PtrOp, boolean) */ public void addParameter( ITypeInfo.eType type, int info, ITypeInfo.PtrOp ptrOp, boolean hasDefault ){ - BasicSymbol param = new BasicSymbol(getSymbolTable(), ParserSymbolTable.EMPTY_NAME); + BasicSymbol param = new BasicSymbol(getSymbolTable(), ParserSymbolTable.EMPTY_NAME_ARRAY); ITypeInfo t = TypeInfoProvider.newTypeInfo( type, info, ptrOp, hasDefault ); param.setTypeInfo( t ); @@ -155,7 +155,7 @@ public class ParameterizedSymbol extends ContainerSymbol implements IParameteriz * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#addParameter(org.eclipse.cdt.internal.core.parser.pst.ISymbol, org.eclipse.cdt.internal.core.parser.pst.TypeInfo.PtrOp, boolean) */ public void addParameter( ISymbol typeSymbol, int info, ITypeInfo.PtrOp ptrOp, boolean hasDefault ){ - BasicSymbol param = new BasicSymbol(getSymbolTable(), ParserSymbolTable.EMPTY_NAME); + BasicSymbol param = new BasicSymbol(getSymbolTable(), ParserSymbolTable.EMPTY_NAME_ARRAY); ITypeInfo nfo = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, info, typeSymbol, ptrOp, hasDefault ); param.setTypeInfo( nfo ); @@ -166,7 +166,7 @@ public class ParameterizedSymbol extends ContainerSymbol implements IParameteriz /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#getParameterMap() */ - public ObjectMap getParameterMap(){ + public CharArrayObjectMap getParameterMap(){ return _parameterMap; } @@ -313,7 +313,7 @@ public class ParameterizedSymbol extends ContainerSymbol implements IParameteriz private List _parameterList = Collections.EMPTY_LIST; //have my cake - private ObjectMap _parameterMap = ObjectMap.EMPTY_MAP; //and eat it too + private CharArrayObjectMap _parameterMap = CharArrayObjectMap.EMPTY_MAP; //and eat it too private ISymbol _returnType; private boolean _hasVarArgs = false; //whether or not this function has variable arguments } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java index 4e9df0bcd72..d103639a3a4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java @@ -26,8 +26,11 @@ import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import org.eclipse.cdt.core.parser.ast.IASTMember; import org.eclipse.cdt.core.parser.ast.IASTNode; import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol.IParentSymbol; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArraySet; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayUtils; import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; import org.eclipse.cdt.internal.core.parser.scanner2.ObjectSet; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayObjectMap; /** * @author aniefer @@ -37,15 +40,16 @@ public class ParserSymbolTable { public static final int TYPE_LOOP_THRESHOLD = 50; public static final int TEMPLATE_LOOP_THRESHOLD = 10; - public static final String EMPTY_NAME = ""; //$NON-NLS-1$ - public static final String THIS = "this"; //$NON-NLS-1$ + public static final char[] EMPTY_NAME_ARRAY = new char[0]; //$NON-NLS-1$ + public static final char[] THIS = new char[] {'t','h','i','s'}; //$NON-NLS-1$ + public static final char[] OPERATOR_ = new char[] {'o','p','e','r','a','t','o','r',' '}; //$NON-NLS-1$ /** * Constructor for ParserSymbolTable. */ public ParserSymbolTable( ParserLanguage language, ParserMode mode ) { super(); - _compilationUnit = newContainerSymbol( EMPTY_NAME, ITypeInfo.t_namespace ); + _compilationUnit = newContainerSymbol( EMPTY_NAME_ARRAY, ITypeInfo.t_namespace ); _language = language; _mode = mode; _typeInfoProvider = new TypeInfoProvider(); @@ -55,47 +59,44 @@ public class ParserSymbolTable { return _compilationUnit; } - public IContainerSymbol newContainerSymbol( String name ){ - if( name == null ) name = EMPTY_NAME; + public IContainerSymbol newContainerSymbol( char[] name ){ + if( name == null ) name = EMPTY_NAME_ARRAY; return new ContainerSymbol( this, name ); } - public IContainerSymbol newContainerSymbol( String name, ITypeInfo.eType type ){ - if( name == null ) name = EMPTY_NAME; + public IContainerSymbol newContainerSymbol( char[] name, ITypeInfo.eType type ){ + if( name == null ) name = EMPTY_NAME_ARRAY; return new ContainerSymbol( this, name, type ); } - public ISymbol newSymbol( String name ){ - if( name == null ) name = EMPTY_NAME; + public ISymbol newSymbol( char[] name ){ + if( name == null ) name = EMPTY_NAME_ARRAY; return new BasicSymbol( this, name ); } - public ISymbol newSymbol( String name, ITypeInfo.eType type ){ - if( name == null ) name = EMPTY_NAME; + public ISymbol newSymbol( char[] name, ITypeInfo.eType type ){ + if( name == null ) name = EMPTY_NAME_ARRAY; return new BasicSymbol( this, name, type ); } - - public IDerivableContainerSymbol newDerivableContainerSymbol( String name ){ - if( name == null ) name = EMPTY_NAME; - return new DerivableContainerSymbol( this, name ); + public IDerivableContainerSymbol newDerivableContainerSymbol( char[] name ){ + return new DerivableContainerSymbol( this, name != null ? name : EMPTY_NAME_ARRAY ); } - public IDerivableContainerSymbol newDerivableContainerSymbol( String name, ITypeInfo.eType type ){ - if( name == null ) name = EMPTY_NAME; - return new DerivableContainerSymbol( this, name, type ); + public IDerivableContainerSymbol newDerivableContainerSymbol( char[] name, ITypeInfo.eType type ){ + return new DerivableContainerSymbol( this, name != null ? name : EMPTY_NAME_ARRAY, type ); } - public IParameterizedSymbol newParameterizedSymbol( String name ){ - if( name == null ) name = EMPTY_NAME; + public IParameterizedSymbol newParameterizedSymbol( char[] name ){ + if( name == null ) name = EMPTY_NAME_ARRAY; return new ParameterizedSymbol( this, name ); } - public IParameterizedSymbol newParameterizedSymbol( String name, ITypeInfo.eType type ){ - if( name == null ) name = EMPTY_NAME; + public IParameterizedSymbol newParameterizedSymbol( char[] name, ITypeInfo.eType type ){ + if( name == null ) name = EMPTY_NAME_ARRAY; return new ParameterizedSymbol( this, name, type ); } - public ITemplateSymbol newTemplateSymbol( String name ){ - if( name == null ) name = EMPTY_NAME; + public ITemplateSymbol newTemplateSymbol( char[] name ){ + if( name == null ) name = EMPTY_NAME_ARRAY; return new TemplateSymbol( this, name ); } - public ISpecializedSymbol newSpecializedSymbol( String name ){ - if( name == null ) name = EMPTY_NAME; + public ISpecializedSymbol newSpecializedSymbol( char[] name ){ + if( name == null ) name = EMPTY_NAME_ARRAY; return new SpecializedSymbol( this, name ); } @@ -123,7 +124,7 @@ public class ParserSymbolTable { ArrayList transitives = null; //list of transitive using directives //if this name define in this scope? - ObjectMap map = null; + CharArrayObjectMap map = null; if( !data.usingDirectivesOnly ){ map = lookupInContained( data, inSymbol ); if( data.foundItems == null || data.foundItems.isEmpty() ){ @@ -247,7 +248,7 @@ public class ParserSymbolTable { if( !data.visited.containsKey( temp ) ){ data.visited.put( temp ); - ObjectMap map = lookupInContained( data, temp ); + CharArrayObjectMap map = lookupInContained( data, temp ); foundSomething = ( map != null && !map.isEmpty() ); if( foundSomething ){ if( data.foundItems == null ) @@ -274,12 +275,12 @@ public class ParserSymbolTable { * @param map * @param map2 */ - private static void mergeResults( LookupData data, ObjectMap resultMap, ObjectMap map ) throws ParserSymbolTableException { + private static void mergeResults( LookupData data, CharArrayObjectMap resultMap, CharArrayObjectMap map ) throws ParserSymbolTableException { if( resultMap == null || map == null || map.isEmpty() ){ return; } - Object key = null; + char[] key = null; int size = map.size(); for( int i = 0; i < size; i++ ){ key = map.keyAt( i ); @@ -309,8 +310,8 @@ public class ParserSymbolTable { * * Look for data.name in our collection _containedDeclarations */ - protected static ObjectMap lookupInContained( LookupData data, IContainerSymbol lookIn ) throws ParserSymbolTableException{ - ObjectMap found = null; + protected static CharArrayObjectMap lookupInContained( LookupData data, IContainerSymbol lookIn ) throws ParserSymbolTableException{ + CharArrayObjectMap found = null; Object obj = null; @@ -319,15 +320,15 @@ public class ParserSymbolTable { data.getAssociated().remove( lookIn ); } - ObjectMap declarations = lookIn.getContainedSymbols(); + CharArrayObjectMap declarations = lookIn.getContainedSymbols(); int numKeys = -1; int idx = 0; - if( data.isPrefixLookup() && declarations != ObjectMap.EMPTY_MAP ){ + if( data.isPrefixLookup() && declarations != CharArrayObjectMap.EMPTY_MAP ){ numKeys = declarations.size(); } - String name = ( numKeys > 0 ) ? (String) declarations.keyAt( idx++ ) : data.name; + char[] name = ( numKeys > 0 ) ? (char[]) declarations.keyAt( idx++ ) : data.name; while( name != null ) { if( nameMatches( data, name ) ){ @@ -337,14 +338,14 @@ public class ParserSymbolTable { if( obj != null ){ if( found == null ){ - found = new ObjectMap( 2 ); + found = new CharArrayObjectMap( 2 ); } found.put( name, obj ); } } } if( idx < numKeys ) - name = (String) declarations.keyAt( idx++ ); + name = declarations.keyAt( idx++ ); else name = null; } @@ -379,10 +380,10 @@ public class ParserSymbolTable { * @param found * @throws ParserSymbolTableException */ - private static ObjectMap lookupInParameters(LookupData data, IContainerSymbol lookIn, ObjectMap found) throws ParserSymbolTableException { + private static CharArrayObjectMap lookupInParameters(LookupData data, IContainerSymbol lookIn, CharArrayObjectMap found) throws ParserSymbolTableException { Object obj; Iterator iterator; - String name; + char[] name; if( lookIn instanceof ITemplateSymbol && !((ITemplateSymbol)lookIn).getDefinitionParameterMap().isEmpty() ){ ITemplateSymbol template = (ITemplateSymbol) lookIn; @@ -395,7 +396,7 @@ public class ParserSymbolTable { obj = collectSymbol( data, symbol ); if( obj != null ){ if( found == null ){ - found = new ObjectMap(2); + found = new CharArrayObjectMap(2); } found.put( symbol.getName(), obj ); } @@ -408,29 +409,29 @@ public class ParserSymbolTable { } } - ObjectMap parameters = ((IParameterizedSymbol)lookIn).getParameterMap(); - if( parameters != ObjectMap.EMPTY_MAP ){ + CharArrayObjectMap parameters = ((IParameterizedSymbol)lookIn).getParameterMap(); + if( parameters != CharArrayObjectMap.EMPTY_MAP ){ int numKeys = -1; int idx = 0; - if( data.isPrefixLookup() && parameters != ObjectMap.EMPTY_MAP ){ + if( data.isPrefixLookup() && parameters != CharArrayObjectMap.EMPTY_MAP ){ numKeys = parameters.size(); } - name = ( numKeys > 0 ) ? (String) parameters.keyAt( idx++ ) : data.name; + name = ( numKeys > 0 ) ? (char[]) parameters.keyAt( idx++ ) : data.name; while( name != null ){ if( nameMatches( data, name ) ){ obj = parameters.get( name ); obj = collectSymbol( data, obj ); if( obj != null ){ if( found == null ){ - found = new ObjectMap( 2 ); + found = new CharArrayObjectMap( 2 ); } found.put( name, obj ); } } if( idx < numKeys ) - name = (String) parameters.keyAt( idx++ ); + name = parameters.keyAt( idx++ ); else name = null; } @@ -441,11 +442,11 @@ public class ParserSymbolTable { return found; } - private static boolean nameMatches( LookupData data, String name ){ + private static boolean nameMatches( LookupData data, char[] name ){ if( data.isPrefixLookup() ){ - return name.regionMatches( true, 0, data.name, 0, data.name.length() ); + return CharArrayUtils.equals( name, 0, data.name.length, data.name, true); } - return name.equals( data.name ); + return CharArrayUtils.equals( name, data.name ); } private static boolean checkType( LookupData data, ISymbol symbol ) { if( data.getFilter() == null ){ @@ -623,7 +624,7 @@ public class ParserSymbolTable { * @return Declaration * @throws ParserSymbolTableException */ - private static ObjectMap lookupInParents( LookupData data, ISymbol lookIn ) throws ParserSymbolTableException{ + private static CharArrayObjectMap lookupInParents( LookupData data, ISymbol lookIn ) throws ParserSymbolTableException{ IDerivableContainerSymbol container = null; if( lookIn instanceof IDerivableContainerSymbol ){ @@ -634,9 +635,9 @@ public class ParserSymbolTable { List scopes = container.getParents(); - ObjectMap temp = null; - ObjectMap symbol = null; - ObjectMap inherited = null; + CharArrayObjectMap temp = null; + CharArrayObjectMap symbol = null; + CharArrayObjectMap inherited = null; IDerivableContainerSymbol.IParentSymbol wrapper = null; @@ -694,7 +695,7 @@ public class ParserSymbolTable { if( symbol == null || symbol.isEmpty() ){ symbol = temp; } else if ( temp != null && !temp.isEmpty() ) { - Object key = null; + char[] key = null; int tempSize = temp.size(); for( int ii = 0; ii < tempSize; ii++ ){ key = temp.keyAt( ii ); @@ -764,12 +765,12 @@ public class ParserSymbolTable { * @param map * @throws ParserSymbolTableException */ - private static void mergeInheritedResults( ObjectMap resultMap, ObjectMap map ){ + private static void mergeInheritedResults( CharArrayObjectMap resultMap, CharArrayObjectMap map ){ if( resultMap == null || map == null || map.isEmpty() ){ return; } - Object key = null; + char[] key = null; int size = map.size(); for( int i = 0; i < size; i++ ){ key = map.keyAt( i ); @@ -1073,7 +1074,7 @@ public class ParserSymbolTable { //the only way we get here and have no parameters, is if we are looking //for a function that takes void parameters ie f( void ) targetParameters = new ArrayList(1); - targetParameters.add( currFn.getSymbolTable().newSymbol( "", ITypeInfo.t_void ) ); //$NON-NLS-1$ + targetParameters.add( currFn.getSymbolTable().newSymbol( EMPTY_NAME_ARRAY, ITypeInfo.t_void ) ); //$NON-NLS-1$ } else { targetParameters = currFn.getParameterList(); } @@ -1262,11 +1263,11 @@ public class ParserSymbolTable { return function.getParameterList().isEmpty(); } //create a new function that has params as its parameters, then use IParameterizedSymbol.hasSameParameters - IParameterizedSymbol tempFn = function.getSymbolTable().newParameterizedSymbol( EMPTY_NAME, ITypeInfo.t_function ); + IParameterizedSymbol tempFn = function.getSymbolTable().newParameterizedSymbol( EMPTY_NAME_ARRAY, ITypeInfo.t_function ); int size = params.size(); for( int i = 0; i < size; i++ ){ - ISymbol param = function.getSymbolTable().newSymbol( EMPTY_NAME ); + ISymbol param = function.getSymbolTable().newSymbol( EMPTY_NAME_ARRAY ); param.setTypeInfo( (ITypeInfo) params.get(i) ); tempFn.addParameter( param ); } @@ -1925,7 +1926,7 @@ public class ParserSymbolTable { throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTypeInfo ); } if( targetDecl.isType( ITypeInfo.t_class, ITypeInfo.t_union ) ){ - LookupData data = new LookupData( EMPTY_NAME){ + LookupData data = new LookupData( EMPTY_NAME_ARRAY ){ public List getParameters() { return parameters; } public TypeFilter getFilter() { return CONSTRUCTOR_FILTER; } private List parameters = new ArrayList( 1 ); @@ -1957,10 +1958,11 @@ public class ParserSymbolTable { provider.returnTypeInfo( source ); if( sourceDecl != null && (sourceDecl instanceof IContainerSymbol) ){ - String name = target.toString(); + char[] name = target.toCharArray(); - if( !name.equals(EMPTY_NAME) ){ - LookupData data = new LookupData( "operator " + name ){ //$NON-NLS-1$ + if( !CharArrayUtils.equals( name, EMPTY_NAME_ARRAY) ){ + + LookupData data = new LookupData( CharArrayUtils.concat( OPERATOR_, name )){ //$NON-NLS-1$ public List getParameters() { return Collections.EMPTY_LIST; } public TypeFilter getFilter() { return FUNCTION_FILTER; } }; @@ -2217,7 +2219,7 @@ public class ParserSymbolTable { protected static final TypeFilter CONSTRUCTOR_FILTER = new TypeFilter( ITypeInfo.t_constructor ); protected static final TypeFilter FUNCTION_FILTER = new TypeFilter( ITypeInfo.t_function ); - public String name; + public char[] name; public ObjectMap usingDirectives; public ObjectSet visited = new ObjectSet(0); //used to ensure we don't visit things more than once public ObjectSet inheritanceChain; //used to detect circular inheritance @@ -2230,17 +2232,17 @@ public class ParserSymbolTable { public boolean exactFunctionsOnly = false; public boolean returnInvisibleSymbols = false; - public ObjectMap foundItems = null; + public CharArrayObjectMap foundItems = null; - public LookupData( String n ){ + public LookupData( char[] n ){ name = n; } //the following function are optionally overloaded by anonymous classes deriving from //this LookupData public boolean isPrefixLookup(){ return false;} //prefix lookup - public ObjectSet getAmbiguities() { return null; } - public void addAmbiguity(String n ) { /*nothing*/ } + public CharArraySet getAmbiguities() { return null; } + public void addAmbiguity(char[] n ) { /*nothing*/ } public List getParameters() { return null; } //parameter info for resolving functions public ObjectSet getAssociated() { return null; } //associated namespaces for argument dependant lookup public ISymbol getStopAt() { return null; } //stop looking along the stack once we hit this declaration diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/SpecializedSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/SpecializedSymbol.java index fc0f7a832e6..5dd8c4cc03d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/SpecializedSymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/SpecializedSymbol.java @@ -24,7 +24,7 @@ import java.util.Map; */ public class SpecializedSymbol extends TemplateSymbol implements ISpecializedSymbol { - protected SpecializedSymbol( ParserSymbolTable table, String name ){ + protected SpecializedSymbol( ParserSymbolTable table, char[] name ){ super( table, name ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateEngine.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateEngine.java index 86bf63baf92..9b7dbf03224 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateEngine.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateEngine.java @@ -20,6 +20,7 @@ import java.util.Set; import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol.IParentSymbol; import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.Cost; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayUtils; import org.eclipse.cdt.internal.core.parser.scanner2.ObjectSet; /** @@ -112,7 +113,7 @@ public final class TemplateEngine { info1 = (ITypeInfo) specArgs.get(j); info2 = (ITypeInfo) args.get(j); - ISymbol sym1 = template.getSymbolTable().newSymbol( ParserSymbolTable.EMPTY_NAME ); + ISymbol sym1 = template.getSymbolTable().newSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); sym1.setTypeInfo( info1 ); if( !deduceTemplateArgument( map, sym1, info2 ) ){ @@ -208,7 +209,7 @@ public final class TemplateEngine { //14.3.1, local type, type with no name if( arg.isType( ITypeInfo.t_type ) && arg.getTypeSymbol() != null ){ ISymbol symbol = arg.getTypeSymbol(); - if( symbol.getName().equals( ParserSymbolTable.EMPTY_NAME ) ){ + if( CharArrayUtils.equals( symbol.getName(), ParserSymbolTable.EMPTY_NAME_ARRAY ) ){ return false; } else if( hasNoLinkage( arg ) ){ return false; @@ -223,7 +224,7 @@ public final class TemplateEngine { //if the parameter has reference type if( op != null && op.getType() == ITypeInfo.PtrOp.t_reference ){ if( arg.isType( ITypeInfo.t_type ) && arg.getTypeSymbol() != null ){ - if( arg.getTypeSymbol().getName().equals( ParserSymbolTable.EMPTY_NAME ) ){ + if( CharArrayUtils.equals( arg.getTypeSymbol().getName(), ParserSymbolTable.EMPTY_NAME_ARRAY )){ return false; } } @@ -571,7 +572,9 @@ public final class TemplateEngine { } if( p.getType() == a.getType() ){ if( p.getDefault() != null ){ - return ( p.getDefault().equals( a.getDefault() ) ); + if( p.getDefault() instanceof char[] && a.getDefault() instanceof char[] ) + return CharArrayUtils.equals( (char[])p.getDefault(), (char[])a.getDefault() ); + return ( p.getDefault().equals( a.getDefault() ) ); } return true; } @@ -628,7 +631,7 @@ public final class TemplateEngine { if( obj instanceof ISymbol ){ sym = (ISymbol) obj; } else { - sym = pSymbol.getSymbolTable().newSymbol( ParserSymbolTable.EMPTY_NAME ); + sym = pSymbol.getSymbolTable().newSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY ); sym.setTypeInfo( (ITypeInfo) obj ); } @@ -820,7 +823,7 @@ public final class TemplateEngine { ISymbol param = (ISymbol) paramList.get( i ); //template type parameter if( param.getTypeInfo().getTemplateParameterType() == ITypeInfo.t_typeName ){ - val = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, template.getSymbolTable().newSymbol( "", ITypeInfo.t_class ) ); //$NON-NLS-1$ + val = TypeInfoProvider.newTypeInfo( ITypeInfo.t_type, 0, template.getSymbolTable().newSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY, ITypeInfo.t_class ) ); //$NON-NLS-1$ } //template parameter else if ( param.getTypeInfo().getTemplateParameterType() == ITypeInfo.t_template ) { @@ -858,7 +861,7 @@ public final class TemplateEngine { } catch ( ParserSymbolTableException e ){ //we shouldn't get this because there aren't any other symbols in the template } - ISymbol param = specialization.getSymbolTable().newSymbol( "", ITypeInfo.t_type ); //$NON-NLS-1$ + ISymbol param = specialization.getSymbolTable().newSymbol( ParserSymbolTable.EMPTY_NAME_ARRAY, ITypeInfo.t_type ); //$NON-NLS-1$ param.setTypeSymbol( specialization.instantiate( specialization.getArgumentList() ) ); @@ -1148,7 +1151,7 @@ public final class TemplateEngine { return ( instance != null ) ? instance : (ISymbol) symbol; } - static protected boolean alreadyHasTemplateParameter( IContainerSymbol container, String name ){ + static protected boolean alreadyHasTemplateParameter( IContainerSymbol container, char[] name ){ while( container != null ){ if( container instanceof ITemplateSymbol ){ ITemplateSymbol template = (ITemplateSymbol) container; @@ -1197,7 +1200,7 @@ public final class TemplateEngine { //14.7.3-11 a trailing template-argument can be left unspecified in the template-id naming an explicit //function template specialization provided it can be deduced from the function argument type if( template.getTemplatedSymbol() instanceof IParameterizedSymbol && - symbol instanceof IParameterizedSymbol && template.getTemplatedSymbol().getName().equals( symbol.getName() ) ) + symbol instanceof IParameterizedSymbol && CharArrayUtils.equals( template.getTemplatedSymbol().getName(), symbol.getName() ) ) { Map map = deduceTemplateArgumentsUsingParameterList( template, (IParameterizedSymbol) symbol ); if( map != null && map.containsKey( param ) ){ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateFactory.java index b01c2f733b2..fbf61f87926 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateFactory.java @@ -21,7 +21,7 @@ import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import org.eclipse.cdt.internal.core.parser.ast.complete.ASTTemplateDeclaration; import org.eclipse.cdt.internal.core.parser.ast.complete.ASTTemplateInstantiation; import org.eclipse.cdt.internal.core.parser.ast.complete.ASTTemplateSpecialization; -import org.eclipse.cdt.internal.core.parser.scanner2.ObjectMap; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayObjectMap; /** * @author aniefer @@ -345,7 +345,7 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.ITemplateFactory#lookupMemberForDefinition(java.lang.String) */ - public ISymbol lookupMemberForDefinition(String name) throws ParserSymbolTableException { + public ISymbol lookupMemberForDefinition(char[] name) throws ParserSymbolTableException { ISymbol look = null; IContainerSymbol last = getLastSymbol(); if( last != null ){ @@ -362,7 +362,7 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#elaboratedLookup(org.eclipse.cdt.internal.core.parser.pst.TypeInfo.eType, java.lang.String) */ - public ISymbol elaboratedLookup(ITypeInfo.eType type, String name) throws ParserSymbolTableException { + public ISymbol elaboratedLookup(ITypeInfo.eType type, char[] name) throws ParserSymbolTableException { ListIterator iter = templates.listIterator( templates.size() ); while( iter.hasPrevious() ){ ITemplateSymbol template = (ITemplateSymbol) iter.previous(); @@ -379,7 +379,7 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookup(java.lang.String) */ - public ISymbol lookup(String name) throws ParserSymbolTableException { + public ISymbol lookup(char[] name) throws ParserSymbolTableException { ListIterator iter = templates.listIterator( templates.size() ); while( iter.hasPrevious() ){ ITemplateSymbol template = (ITemplateSymbol) iter.previous(); @@ -396,7 +396,7 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookupMethodForDefinition(java.lang.String, java.util.List) */ - public IParameterizedSymbol lookupMethodForDefinition(String name, List parameters) throws ParserSymbolTableException { + public IParameterizedSymbol lookupMethodForDefinition(char[] name, List parameters) throws ParserSymbolTableException { IContainerSymbol last = getLastSymbol(); if( last != null ){ IParameterizedSymbol found = last.lookupMethodForDefinition( name, parameters ); @@ -410,49 +410,49 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookupNestedNameSpecifier(java.lang.String) */ - public IContainerSymbol lookupNestedNameSpecifier(String name) throws ParserSymbolTableException { + public IContainerSymbol lookupNestedNameSpecifier(char[] name) throws ParserSymbolTableException { return getContainingSymbol().lookupNestedNameSpecifier( name ); } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#qualifiedLookup(java.lang.String) */ - public ISymbol qualifiedLookup(String name) throws ParserSymbolTableException { + public ISymbol qualifiedLookup(char[] name) throws ParserSymbolTableException { return getContainingSymbol().qualifiedLookup( name ); } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#qualifiedLookup(java.lang.String, org.eclipse.cdt.internal.core.parser.pst.TypeInfo.eType) */ - public ISymbol qualifiedLookup(String name, ITypeInfo.eType t) throws ParserSymbolTableException { + public ISymbol qualifiedLookup(char[] name, ITypeInfo.eType t) throws ParserSymbolTableException { return getContainingSymbol().qualifiedLookup( name, t ); } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#unqualifiedFunctionLookup(java.lang.String, java.util.List) */ - public IParameterizedSymbol unqualifiedFunctionLookup(String name, List parameters) throws ParserSymbolTableException { + public IParameterizedSymbol unqualifiedFunctionLookup(char[] name, List parameters) throws ParserSymbolTableException { return getContainingSymbol().unqualifiedFunctionLookup( name, parameters ); } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#memberFunctionLookup(java.lang.String, java.util.List) */ - public IParameterizedSymbol memberFunctionLookup(String name, List parameters) throws ParserSymbolTableException { + public IParameterizedSymbol memberFunctionLookup(char[] name, List parameters) throws ParserSymbolTableException { return getContainingSymbol().memberFunctionLookup( name, parameters ); } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#qualifiedFunctionLookup(java.lang.String, java.util.List) */ - public IParameterizedSymbol qualifiedFunctionLookup(String name, List parameters) throws ParserSymbolTableException { + public IParameterizedSymbol qualifiedFunctionLookup(char[] name, List parameters) throws ParserSymbolTableException { return getContainingSymbol().qualifiedFunctionLookup( name, parameters ); } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookupTemplate(java.lang.String, java.util.List) */ - public ISymbol lookupTemplateId(String name, List arguments) throws ParserSymbolTableException { + public ISymbol lookupTemplateId(char[] name, List arguments) throws ParserSymbolTableException { ISymbol look = null; IContainerSymbol last = getLastSymbol(); if( last != null ){ @@ -463,7 +463,7 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor return look; } - public IContainerSymbol lookupTemplateIdForDefinition(String name, List arguments) throws ParserSymbolTableException { + public IContainerSymbol lookupTemplateIdForDefinition(char[] name, List arguments) throws ParserSymbolTableException { ISymbol look = null; IContainerSymbol last = getLastSymbol(); if( last != null ){ @@ -482,7 +482,7 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookupFunctionTemplateId(java.lang.String, java.util.List, java.util.List) */ - public ISymbol lookupFunctionTemplateId(String name, List parameters, List arguments, boolean forDefinition) throws ParserSymbolTableException { + public ISymbol lookupFunctionTemplateId(char[] name, List parameters, List arguments, boolean forDefinition) throws ParserSymbolTableException { IContainerSymbol last = getLastSymbol(); if( last != null ){ IParameterizedSymbol found = (IParameterizedSymbol) last.lookupFunctionTemplateId( name, parameters, arguments, forDefinition ); @@ -562,28 +562,28 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#addUsingDeclaration(java.lang.String) */ - public IUsingDeclarationSymbol addUsingDeclaration(String name) { + public IUsingDeclarationSymbol addUsingDeclaration(char[] name) { return null; } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#addUsingDeclaration(java.lang.String, org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol) */ - public IUsingDeclarationSymbol addUsingDeclaration(String name, IContainerSymbol declContext) { + public IUsingDeclarationSymbol addUsingDeclaration(char[] name, IContainerSymbol declContext) { return null; } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#getContainedSymbols() */ - public ObjectMap getContainedSymbols() { + public CharArrayObjectMap getContainedSymbols() { return null; } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#prefixLookup(org.eclipse.cdt.internal.core.parser.pst.TypeFilter, java.lang.String, boolean) */ - public List prefixLookup(TypeFilter filter, String prefix, boolean qualified, List paramList) { + public List prefixLookup(TypeFilter filter, char[] prefix, boolean qualified, List paramList) { return null; } /* (non-Javadoc) @@ -617,14 +617,14 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.ISymbol#setName(java.lang.String) */ - public void setName(String name) { + public void setName(char[] name) { /* nothing */ } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.ISymbol#getName() */ - public String getName() { + public char[] getName() { return null; } @@ -834,14 +834,14 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol#lookupForFriendship(java.lang.String) */ - public ISymbol lookupForFriendship(String name) { + public ISymbol lookupForFriendship(char[] name) { return null; } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol#lookupFunctionForFriendship(java.lang.String, java.util.List) */ - public IParameterizedSymbol lookupFunctionForFriendship(String name, List parameters) { + public IParameterizedSymbol lookupFunctionForFriendship(char[] name, List parameters) { return null; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateSymbol.java index 52f53d3bb93..89be826bc19 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateSymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateSymbol.java @@ -17,6 +17,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayUtils; + /** * @author aniefer * @@ -25,7 +27,7 @@ import java.util.Map; */ public class TemplateSymbol extends ParameterizedSymbol implements ITemplateSymbol { - protected TemplateSymbol ( ParserSymbolTable table, String name ){ + protected TemplateSymbol ( ParserSymbolTable table, char[] name ){ super( table, name, ITypeInfo.t_template ); } @@ -198,7 +200,9 @@ public class TemplateSymbol extends ParameterizedSymbol implements ITemplateSymb if( !param.isType( ITypeInfo.t_templateParameter ) ) return false; - if( !getName().equals( ParserSymbolTable.EMPTY_NAME ) && param.getName().equals( getName() ) ){ + if( !CharArrayUtils.equals( getName(), ParserSymbolTable.EMPTY_NAME_ARRAY ) && + CharArrayUtils.equals( param.getName(), getName() ) ) + { return false; } @@ -294,7 +298,7 @@ public class TemplateSymbol extends ParameterizedSymbol implements ITemplateSymb } catch (ParserSymbolTableException e) { /* nothing */ } - if( found == null && getTemplatedSymbol().getName().equals( symbol.getName() ) ){ + if( found == null && CharArrayUtils.equals( getTemplatedSymbol().getName(), symbol.getName() ) ){ found = getTemplatedSymbol(); IContainerSymbol instance = findInstantiation( actualArgs ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayObjectMap.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayObjectMap.java index 91dcb3fadd0..a68d6260f34 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayObjectMap.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayObjectMap.java @@ -10,23 +10,34 @@ ***********************************************************************/ package org.eclipse.cdt.internal.core.parser.scanner2; +import java.util.Comparator; + /** * @author Doug Schaefer */ -public class CharArrayObjectMap extends CharArrayMap { +public class CharArrayObjectMap {//extends CharArrayMap { + public static final CharArrayObjectMap EMPTY_MAP = new CharArrayObjectMap( 0 ){ + public Object clone() { return this; } + public Object put( char[] key, int start, int length, Object value ) + { throw new UnsupportedOperationException(); } + }; + private char[][] keyTable; + private int[] hashTable; + private int[] nextTable; private Object[] valueTable; + + private int currEntry = -1; public CharArrayObjectMap(int initialSize) { - super(initialSize); - valueTable = new Object[capacity()]; - } - - protected void resize(int size) { - super.resize(size); - Object[] oldValueTable = valueTable; + int size = 1; + while (size < initialSize) + size <<= 1; + + keyTable = new char[size][]; + hashTable = new int[size * 2]; + nextTable = new int[size]; valueTable = new Object[size]; - System.arraycopy(oldValueTable, 0, valueTable, 0, oldValueTable.length); } public Object put(char[] key, int start, int length, Object value) { @@ -36,22 +47,39 @@ public class CharArrayObjectMap extends CharArrayMap { return oldvalue; } - public Object put(char[] key, Object value) { + final public Object put(char[] key, Object value) { return put(key, 0, key.length, value); } - public Object get(char[] key, int start, int length) { + final public Object get(char[] key, int start, int length) { int i = lookup(key, start, length); if (i >= 0) return valueTable[i]; return null; } - public Object get(char[] key) { + final public Object get(char[] key) { return get(key, 0, key.length); } - public Object remove(char[] key, int start, int length) { + final public Object getAt( int i ){ + if( i < 0 || i > currEntry ) + return null; + + char [] key = keyAt( i ); + if( key == null ) return null; + + return get( key, 0, key.length ); + } + + final public char[] keyAt( int i ){ + if( i < 0 || i > currEntry ) + return null; + + return keyTable[ i ]; + } + + final public Object remove(char[] key, int start, int length) { int i = lookup(key, start, length); if (i < 0) return null; @@ -63,17 +91,249 @@ public class CharArrayObjectMap extends CharArrayMap { return value; } - public Object remove(char[] key) { + final public Object remove(char[] key) { return remove(key, 0, key.length); } - protected void removeEntry(int i) { - // Remove the entry from the valueTable, shifting everything over if necessary - if (i < currEntry) + public Object clone(){ + int size = capacity(); + + CharArrayObjectMap newTable = new CharArrayObjectMap( size ); + newTable.keyTable = new char[ size ][]; + newTable.hashTable = new int[ size*2 ]; + newTable.nextTable = new int[ size ]; + newTable.valueTable = new Object[ capacity() ]; + + System.arraycopy(valueTable, 0, newTable.valueTable, 0, valueTable.length); + System.arraycopy(keyTable, 0, newTable.keyTable, 0, keyTable.length); + System.arraycopy(hashTable, 0, newTable.hashTable, 0, hashTable.length); + System.arraycopy(nextTable, 0, newTable.nextTable, 0, nextTable.length); + + newTable.currEntry = currEntry; + return newTable; + } + + final public int size(){ + return currEntry + 1; + } + + final public void clear(){ + for( int i = 0; i < keyTable.length; i++ ){ + keyTable[i] = null; + hashTable[ 2*i ] = 0; + hashTable[ 2*i + 1 ] = 0; + nextTable[i] = 0; + valueTable[i] = null; + } + currEntry = -1; + } + + final public int capacity() { + return keyTable.length; + } + + final public boolean containsKey( char[] key ){ + return lookup( key, 0, key.length ) != -1; + } + + final public char [][] keyArray(){ + char [][] keys = new char[ size() ][]; + System.arraycopy( keyTable, 0, keys, 0, keys.length ); + return keys; + } + + final public boolean isEmpty(){ + return currEntry == -1; + } + + final public void sort( Comparator c ) { + if( size() > 1 ){ + quickSort( c, 0, size() - 1 ); + + rehash( size(), false ); + } + } + + private void resize() { + resize(keyTable.length << 1); + } + + private void resize(int size) { + Object[] oldValueTable = valueTable; + valueTable = new Object[size]; + System.arraycopy(oldValueTable, 0, valueTable, 0, oldValueTable.length); + + Object[] oldKeyTable = keyTable; + keyTable = new char[size][]; + System.arraycopy(oldKeyTable, 0, keyTable, 0, oldKeyTable.length); + + // Need to rehash everything + rehash( oldKeyTable.length, true ); + } + + private int hash(char[] buffer, int start, int len) { + return CharArrayUtils.hash(buffer, start, len) & (hashTable.length - 1); + } + + private void insert(int i) { + insert(i, hash(keyTable[i], 0, keyTable[i].length)); + } + private void insert(int i, int hash) { + + if (hashTable[hash] == 0) { + hashTable[hash] = i + 1; + } else { + // need to link + int j = hashTable[hash] - 1; + while (nextTable[j] != 0) + j = nextTable[j] - 1; + nextTable[j] = i + 1; + } + } + + private void rehash( int n, boolean reallocate ){ + if( reallocate ){ + hashTable = new int[ keyTable.length * 2 ]; + nextTable = new int[ keyTable.length ]; + } else { + for( int i = 0; i < keyTable.length; i++ ){ + hashTable[2*i] = 0; + hashTable[2*i+1] = 0; + nextTable[i] = 0; + } + } + for (int i = 0; i < n; ++i) { + insert(i); + } + } + + private int add(char[] buffer, int start, int len) { + int hash = hash(buffer, start, len); + + if (hashTable[hash] == 0) { + if( (currEntry + 1) >= keyTable.length){ + //need to recompute hash for this add, recurse. + resize(); + return add( buffer, start, len ); + } + currEntry++; + keyTable[currEntry] = CharArrayUtils.extract(buffer, start, len); + insert(currEntry, hash); + return currEntry; + } + // is the key already registered? + int i = hashTable[hash] - 1; + if (CharArrayUtils.equals(buffer, start, len, keyTable[i])) + // yup + return i; + + // follow the next chain + int last = i; + for (i = nextTable[i] - 1; i >= 0; i = nextTable[i] - 1) { + if (CharArrayUtils.equals(buffer, start, len, keyTable[i])) + // yup this time + return i; + last = i; + } + + // nope, add it in + if (currEntry + 1 >= keyTable.length){ + //need to recompute hash for this add, recurse + resize(); + return add( buffer, start, len ); + } + currEntry++; + keyTable[currEntry] = CharArrayUtils.extract(buffer, start, len); + nextTable[last] = currEntry + 1; + return currEntry; + } + + private void removeEntry(int i) { + if (i < currEntry) System.arraycopy(valueTable, i + 1, valueTable, i, currEntry - i); valueTable[currEntry] = null; + + // Remove the hash entry + int hash = hash(keyTable[i], 0, keyTable[i].length); + if (hashTable[hash] == i + 1) + hashTable[hash] = nextTable[i]; + else { + // find entry pointing to me + int j = hashTable[hash] - 1; + while (nextTable[j] != 0 && nextTable[j] != i + 1) + j = nextTable[j] - 1; + nextTable[j] = nextTable[i]; + } + + if (i < currEntry) { + // shift everything over + System.arraycopy(keyTable, i + 1, keyTable, i, currEntry - i); + System.arraycopy(nextTable, i + 1, nextTable, i, currEntry - i); + + // adjust hash and next entries for things that moved + for (int j = 0; j < hashTable.length; ++j) + if (hashTable[j] > i + 1) + --hashTable[j]; - // Make sure you remove the value before calling super where currEntry will change - super.removeEntry(i); + for (int j = 0; j < nextTable.length; ++j) + if (nextTable[j] > i + 1) + --nextTable[j]; + } + + // last entry is now free + keyTable[currEntry] = null; + nextTable[currEntry] = 0; + --currEntry; } + + private int lookup(char[] buffer, int start, int len) { + int hash = hash(buffer, start, len); + + if (hashTable[hash] == 0) + return -1; + + int i = hashTable[hash] - 1; + if (CharArrayUtils.equals(buffer, start, len, keyTable[i])) + return i; + + // Follow the next chain + for (i = nextTable[i] - 1; i >= 0; i = nextTable[i] - 1) + if (CharArrayUtils.equals(buffer, start, len, keyTable[i])) + return i; + + return -1; + } + + private void quickSort( Comparator c, int p, int r ){ + if( p < r ){ + int q = partition( c, p, r ); + if( p < q ) quickSort( c, p, q ); + if( ++q < r ) quickSort( c, q, r ); + } + } + private int partition( Comparator c, int p, int r ){ + char[] x = keyTable[ p ]; + Object temp = null; + int i = p; + int j = r; + + while( true ){ + while( c.compare( keyTable[ j ], x ) > 0 ){ j--; } + if( i < j ) + while( c.compare( keyTable[ i ], x ) < 0 ){ i++; } + + if( i < j ){ + temp = keyTable[j]; + keyTable[j] = keyTable[i]; + keyTable[i] = (char[]) temp; + + temp = valueTable[j]; + valueTable[j] = valueTable[i]; + valueTable[i] = temp; + } else { + return j; + } + } + } + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArraySet.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArraySet.java new file mode 100644 index 00000000000..1e38478d067 --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArraySet.java @@ -0,0 +1,295 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +/* + * Created on Jul 21, 2004 + */ +package org.eclipse.cdt.internal.core.parser.scanner2; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * @author aniefer + */ +public class CharArraySet { + private char[][] keyTable; + private int[] hashTable; + private int[] nextTable; + + private int currEntry = -1; + + public static final CharArraySet EMPTY_SET = new CharArraySet( 0 ){ + public Object clone() { return this; } + public List toList() { return Collections.EMPTY_LIST; } + public void put( char[] key ) { throw new UnsupportedOperationException(); } + public void addAll( List list ) { throw new UnsupportedOperationException(); } + public void addAll( CharArraySet set ) { throw new UnsupportedOperationException(); } + }; + + public CharArraySet(int initialSize) { + int size = 1; + while (size < initialSize) + size <<= 1; + + keyTable = new char[size][]; + hashTable = new int[size * 2]; + nextTable = new int[size]; + } + + public void put(char[] key ){ + add(key); + } + + public void addAll( List list ){ + if( list == null ) + return; + + int size = list.size(); + for( int i = 0; i < size; i++ ){ + add( (char[]) list.get( i ) ); + } + } + + public void addAll( CharArraySet set ){ + if( set == null ) + return; + int size = set.size(); + for( int i = 0; i < size; i++ ){ + add( set.keyAt( i ) ); + } + } + + public List toList(){ + List list = new ArrayList( size() ); + int size = size(); + for( int i = 0; i < size; i++ ){ + list.add( keyAt( i ) ); + } + return list; + } + + final public boolean remove( char[] key ) { + int i = lookup(key); + if (i < 0) + return false; + + removeEntry(i); + return true; + } + + /** + * @return + */ + final public boolean isEmpty() { + return currEntry == -1; + } + +// public Object clone(){ +// HashTable newTable = null; +// try { +// newTable = (HashTable) super.clone(); +// } catch ( CloneNotSupportedException e ) { +// //shouldn't happen because object supports clone. +// return null; +// } +// +// int size = capacity(); +// newTable.keyTable = new Object[ size ]; +// newTable.hashTable = new int[ size*2 ]; +// newTable.nextTable = new int[ size ]; +// +// System.arraycopy(keyTable, 0, newTable.keyTable, 0, keyTable.length); +// System.arraycopy(hashTable, 0, newTable.hashTable, 0, hashTable.length); +// System.arraycopy(nextTable, 0, newTable.nextTable, 0, nextTable.length); +// +// newTable.currEntry = currEntry; +// return newTable; +// } + + final public int size(){ + return currEntry + 1; + } + + final public char[] keyAt( int i ){ + if( i < 0 || i > currEntry ) + return null; + + return keyTable[ i ]; + } + + final public boolean containsKey( char[] key ){ + return lookup( key ) != -1; + } + +// public Object [] keyArray(){ +// Object [] keys = new Object[ size() ]; +// System.arraycopy( keyTable, 0, keys, 0, keys.length ); +// return keys; +// } + final public void clear(){ + for( int i = 0; i < keyTable.length; i++ ){ + keyTable[i] = null; + hashTable[ 2*i ] = 0; + hashTable[ 2*i + 1 ] = 0; + nextTable[i] = 0; + } + currEntry = -1; + } + + final public int capacity() { + return keyTable.length; + } + + private int hash( char[] obj ){ + return CharArrayUtils.hash( obj ) & (hashTable.length - 1); + } + + private void insert(int i) { + insert(i, hash(keyTable[i])); + } + + private void insert(int i, int hash) { + + if (hashTable[hash] == 0) { + hashTable[hash] = i + 1; + } else { + // need to link + int j = hashTable[hash] - 1; + while (nextTable[j] != 0) + j = nextTable[j] - 1; + nextTable[j] = i + 1; + } + } + + private void resize(int size) { + Object[] oldKeyTable = keyTable; + keyTable = new char[size][]; + System.arraycopy(oldKeyTable, 0, keyTable, 0, oldKeyTable.length); + + // Need to rehash everything + rehash( oldKeyTable.length, true ); + } + + private void rehash( int n, boolean reallocate ){ + if( reallocate ){ + hashTable = new int[ keyTable.length * 2 ]; + nextTable = new int[ keyTable.length ]; + } else { + for( int i = 0; i < keyTable.length; i++ ){ + hashTable[2*i] = 0; + hashTable[2*i+1] = 0; + nextTable[i] = 0; + } + } + for (int i = 0; i < n; ++i) { + insert(i); + } + } + + private void resize() { + resize(keyTable.length << 1); + } + + private int add(char[] obj) { + int hash = hash(obj); + + if (hashTable[hash] == 0) { + if ( (currEntry + 1) >= keyTable.length){ + resize(); + //hash code needs to be recomputed, just recurse. + return add( obj ); + } + currEntry++; + keyTable[currEntry] = obj; + insert(currEntry, hash); + return currEntry; + } + // is the key already registered? + int i = hashTable[hash] - 1; + if ( CharArrayUtils.equals( obj, keyTable[i] ) ) + // yup + return i; + + // follow the next chain + int last = i; + for (i = nextTable[i] - 1; i >= 0; i = nextTable[i] - 1) { + if ( CharArrayUtils.equals( obj, keyTable[i] ) ) + // yup this time + return i; + last = i; + } + + // nope, add it in + if ( (currEntry + 1) >= keyTable.length){ + resize(); + //hash code needs to be recomputed, just recurse. + return add( obj ); + } + currEntry++; + keyTable[currEntry] = obj; + nextTable[last] = currEntry + 1; + return currEntry; + } + + private void removeEntry(int i) { + // Remove the hash entry + int hash = hash(keyTable[i]); + if (hashTable[hash] == i + 1) + hashTable[hash] = nextTable[i]; + else { + // find entry pointing to me + int j = hashTable[hash] - 1; + while (nextTable[j] != 0 && nextTable[j] != i + 1) + j = nextTable[j] - 1; + nextTable[j] = nextTable[i]; + } + + if (i < currEntry) { + // shift everything over + System.arraycopy(keyTable, i + 1, keyTable, i, currEntry - i); + System.arraycopy(nextTable, i + 1, nextTable, i, currEntry - i); + + // adjust hash and next entries for things that moved + for (int j = 0; j < hashTable.length; ++j) + if (hashTable[j] > i + 1) + --hashTable[j]; + + for (int j = 0; j < nextTable.length; ++j) + if (nextTable[j] > i + 1) + --nextTable[j]; + } + + // last entry is now free + keyTable[currEntry] = null; + nextTable[currEntry] = 0; + --currEntry; + } + + private int lookup(char[] buffer ){ + int hash = hash(buffer); + + if (hashTable[hash] == 0) + return -1; + + int i = hashTable[hash] - 1; + if ( CharArrayUtils.equals( buffer, keyTable[i] ) ) + return i; + + // Follow the next chain + for (i = nextTable[i] - 1; i >= 0; i = nextTable[i] - 1) + if ( CharArrayUtils.equals( buffer, keyTable[i] ) ) + return i; + + return -1; + } +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayUtils.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayUtils.java index 356abd50605..73ad00aac5d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayUtils.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayUtils.java @@ -53,7 +53,7 @@ public class CharArrayUtils { } public static final boolean equals(char[] str1, int start1, int length1, char[] str2) { - if (length1 != str2.length) + if (length1 != str2.length || str1.length < length1 ) return false; for (int i = 0; i < length1; ++i) @@ -63,6 +63,20 @@ public class CharArrayUtils { return true; } + public static final boolean equals(char[] str1, int start1, int length1, char[] str2, boolean ignoreCase ) { + if( !ignoreCase ) + return equals( str1, start1, length1, str2 ); + + if (length1 != str2.length || str1.length < length1 ) + return false; + + for (int i = 0; i < length1; ++i) + if( Character.toLowerCase(str1[start1++]) != Character.toLowerCase( str2[i] ) ) + return false; + + return true; + } + public static final char[] extract(char[] str, int start, int length) { if (start == 0 && length == str.length) return str; @@ -179,6 +193,32 @@ public class CharArrayUtils { return i; return -1; } + public static final int indexOf( char[] toBeFound, char[] array ){ + if( toBeFound.length > array.length ) + return -1; + + int j = 0; + for( int i = 0; i < array.length; i++ ){ + if( toBeFound[j] == array[i] ){ + if( ++j == toBeFound.length ) + return i - j; + } + else j = 0; + } + return -1; + } + + public static final int lastIndexOf(char[] toBeFound, char[] array) { + int j = toBeFound.length - 1; + for (int i = array.length; --i >= 0;){ + if (toBeFound[j] == array[i]){ + if( --j == -1 ) + return i; + } else j = toBeFound.length - 1; + } + return -1; + } + final static public char[] trim(char[] chars) { if (chars == null) @@ -196,4 +236,12 @@ public class CharArrayUtils { } return chars; } + + + final static public char[] lastSegment(char[] array, char[] separator) { + int pos = lastIndexOf(separator, array); + if (pos < 0) + return array; + return subarray(array, pos + separator.length, array.length); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/ObjectMap.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/ObjectMap.java index d5938935e3a..3271b76de4e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/ObjectMap.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/ObjectMap.java @@ -43,7 +43,7 @@ public class ObjectMap extends HashTable{ return newMap; } - public void clear(){ + final public void clear(){ super.clear(); for( int i = 0; i < valueTable.length; i++ ){ valueTable[i] = null; @@ -65,25 +65,25 @@ public class ObjectMap extends HashTable{ return oldvalue; } - public Object get(Object key) { + final public Object get(Object key) { int i = lookup(key); if (i >= 0) return valueTable[i]; return null; } - public Object getAt( int i ){ + final public Object getAt( int i ){ if( i < 0 || i > currEntry ) return null; return get( keyAt( i ) ); } - public boolean isEmpty(){ + final public boolean isEmpty(){ return currEntry == -1; } - public Object remove( Object key ) { + final public Object remove( Object key ) { int i = lookup(key); if (i < 0) return null; @@ -94,7 +94,7 @@ public class ObjectMap extends HashTable{ return value; } - protected void removeEntry(int i) { + final protected void removeEntry(int i) { // Remove the entry from the valueTable, shifting everything over if necessary if (i < currEntry) System.arraycopy(valueTable, i + 1, valueTable, i, currEntry - i); @@ -104,7 +104,7 @@ public class ObjectMap extends HashTable{ super.removeEntry(i); } - public void sort( Comparator c ) { + final public void sort( Comparator c ) { if( size() > 1 ){ quickSort( c, 0, size() - 1 );