diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java index 56068949636..29487ad2464 100644 --- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java +++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Corporation - initial API and implementation + * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.model.tests; @@ -25,7 +25,6 @@ import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; /** * @author bnicolle - * */ public class IStructureTests extends IntegratedCModelTest { /** @@ -56,29 +55,29 @@ public class IStructureTests extends IntegratedCModelTest { * containing all its public members named "test*" */ public static Test suite() { - TestSuite suite= new TestSuite( IStructureTests.class.getName() ); + TestSuite suite= new TestSuite(IStructureTests.class.getName()); // TODO check C-only behaviour using C_NATURE vs CC_NATURE // Interface tests: - suite.addTest( new IStructureTests("testGetChildrenOfTypeStruct")); - suite.addTest( new IStructureTests("testGetChildrenOfTypeClass")); // C++ only - suite.addTest( new IStructureTests("testGetFields")); - //Bug# 38985: solved. suite.addTest( new IStructureTests("testGetFieldsHack")); - suite.addTest( new IStructureTests("testGetField")); - suite.addTest( new IStructureTests("testGetMethods")); // C++ only - //Bug# 38985: solved. suite.addTest( new IStructureTests("testGetMethodsHack")); // C++ only - suite.addTest( new IStructureTests("testGetMethod")); // C++ only - suite.addTest( new IStructureTests("testIsStruct")); - suite.addTest( new IStructureTests("testIsClass")); // C++ only - suite.addTest( new IStructureTests("testIsUnion")); - suite.addTest( new IStructureTests("testIsAbstract")); // C++ only - suite.addTest( new IStructureTests("testGetBaseTypes")); // C++ only - suite.addTest( new IStructureTests("testGetAccessControl")); // C++ only + suite.addTest(new IStructureTests("testGetChildrenOfTypeStruct")); + suite.addTest(new IStructureTests("testGetChildrenOfTypeClass")); // C++ only + suite.addTest(new IStructureTests("testGetFields")); + //Bug# 38985: solved. suite.addTest(new IStructureTests("testGetFieldsHack")); + suite.addTest(new IStructureTests("testGetField")); + suite.addTest(new IStructureTests("testGetMethods")); // C++ only + //Bug# 38985: solved. suite.addTest(new IStructureTests("testGetMethodsHack")); // C++ only + suite.addTest(new IStructureTests("testGetMethod")); // C++ only + suite.addTest(new IStructureTests("testIsStruct")); + suite.addTest(new IStructureTests("testIsClass")); // C++ only + suite.addTest(new IStructureTests("testIsUnion")); + suite.addTest(new IStructureTests("testIsAbstract")); // C++ only + suite.addTest(new IStructureTests("testGetBaseTypes")); // C++ only + suite.addTest(new IStructureTests("testGetAccessControl")); // C++ only // Language Specification tests: - suite.addTest( new IStructureTests("testAnonymousStructObject")); - suite.addTest( new IStructureTests("testInnerStruct")); + suite.addTest(new IStructureTests("testAnonymousStructObject")); + suite.addTest(new IStructureTests("testInnerStruct")); return suite; } @@ -92,9 +91,9 @@ public class IStructureTests extends IntegratedCModelTest { "testStruct8" }; assertEquals(myExpectedStructs.length,arrayStructs.size()); - for(int i=0; i c1", 8); IBinding b1= getBindingFromASTName("m1(\"aaa\")", 2); IBinding b2= getBindingFromASTName("m2(\"aaa\")", 2); - + assertEquals(1, getIndex().findNames(b1, IIndex.FIND_REFERENCES).length); assertEquals(1, getIndex().findNames(b2, IIndex.FIND_REFERENCES).length); } @@ -368,7 +368,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa public void testUnindexedConstructorInstanceImplicitReference() throws Exception { IBinding b0= getBindingFromASTName("m1(\"aaa\")", 2); IBinding b1= getBindingFromASTName("m2(\"aaa\")", 2); - + assertEquals(1, getIndex().findNames(b0, IIndex.FIND_REFERENCES).length); assertEquals(1, getIndex().findNames(b1, IIndex.FIND_REFERENCES).length); } @@ -397,29 +397,29 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa public void testCPPConstructorTemplateSpecialization() throws Exception { IBinding b0= getBindingFromASTName("D *var", 1); IBinding b1= getBindingFromASTName("D *var", 6); - + assertInstance(b0, ICPPClassTemplate.class); assertInstance(b0, ICPPClassType.class); assertInstance(b1, ICPPTemplateInstance.class); assertInstance(b1, ICPPClassType.class); - + // ICPPClassType _ct= (ICPPClassType) b1; // ICPPConstructor[] _ctcs= _ct.getConstructors(); // assertEquals(3, _ctcs.length); // two implicit plus the constructor template - + IBinding b2= getBindingFromASTName("D(", 1); IBinding b3= getBindingFromASTName("D(", 6); - + assertInstance(b2, ICPPClassTemplate.class); // *D*(5, 6) assertInstance(b2, ICPPClassType.class); // *D*(5, 6) assertInstance(b3, ICPPTemplateInstance.class); // *D*(5, 6) assertInstance(b3, ICPPConstructor.class); // *D*(5, 6) - + // // ICPPClassType ct= (ICPPClassType) b2; // ICPPConstructor[] ctcs= ct.getConstructors(); // assertEquals(3, ctcs.length); // two implicit plus the constructor template - + IBinding tidSpc= ((ICPPTemplateInstance)b3).getSpecializedBinding(); assertInstance(tidSpc, ICPPConstructor.class); assertInstance(tidSpc, ICPPSpecialization.class); @@ -470,22 +470,22 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa IBinding b2= getBindingFromASTName("f.s.foo", 1); IBinding b3= getBindingFromASTName("s.foo", 1); IBinding b4= getBindingFromASTName("foo(*", 3); - + assertInstance(b0, ICPPClassTemplate.class); assertInstance(b0, ICPPClassType.class); ICPPTemplateParameter[] ps= ((ICPPClassTemplate)b0).getTemplateParameters(); assertEquals(2, ps.length); assertInstance(ps[0], ICPPTemplateTypeParameter.class); assertInstance(ps[1], ICPPTemplateTemplateParameter.class); - + assertInstance(b1, ICPPTemplateInstance.class); assertInstance(b1, ICPPClassType.class); - + IType[] type= ((ICPPTemplateInstance)b1).getArguments(); assertInstance(type[0], ICPPClassType.class); assertInstance(type[1], ICPPClassTemplate.class); assertInstance(type[1], ICPPClassType.class); - + ObjectMap om= ((ICPPTemplateInstance)b1).getArgumentMap(); assertEquals(2, om.size()); assertInstance(om.keyAt(0), ICPPTemplateTypeParameter.class); @@ -493,7 +493,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertInstance(om.keyAt(1), ICPPTemplateTemplateParameter.class); assertInstance(om.getAt(1), ICPPClassType.class); assertInstance(om.getAt(1), ICPPClassTemplate.class); - + IBinding b1_spcd= ((ICPPTemplateInstance)b1).getSpecializedBinding(); assertInstance(b1_spcd, ICPPClassTemplate.class); assertInstance(b1_spcd, ICPPClassType.class); @@ -580,20 +580,20 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa IBinding b1= getBindingFromASTName("D", 8); IBinding b2= getBindingFromASTName("D", 8); IBinding b3= getBindingFromASTName("D ab; public void testClassSpecializationMethods() throws Exception { IBinding b0= getBindingFromASTName("A ab", 4); @@ -685,20 +685,20 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPMethod foo= dms[0].getName().equals("foo") ? dms[0] : dms[1]; ICPPMethod bar= dms[0].getName().equals("bar") ? dms[0] : dms[1]; - + assertEquals(foo.getName(), "foo"); assertEquals(bar.getName(), "bar"); - + assertInstance(foo.getType().getReturnType(), ICPPClassType.class); assertEquals(((ICPPClassType)foo.getType().getReturnType()).getName(), "B"); assertEquals(foo.getType().getParameterTypes().length, 1); assertInstance(foo.getType().getParameterTypes()[0], ICPPClassType.class); assertEquals(((ICPPClassType)foo.getType().getParameterTypes()[0]).getName(), "B"); - + assertInstance(bar.getType().getReturnType(), ICPPBasicType.class); assertEquals(((ICPPBasicType)bar.getType().getReturnType()).getType(), IBasicType.t_void); } - + // template class A { // public: // typedef T TD; @@ -807,25 +807,25 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertInstance(b0_ptypes[1], ICPPClassType.class); assertEquals("A", ((ICPPClassType)b0_ptypes[0]).getName()); assertEquals("B", ((ICPPClassType)b0_ptypes[1]).getName()); - + IParameter[] b0_pms= ((ICPPFunction)b0).getParameters(); assertEquals(2, b0_pms.length); assertInstance(b0_pms[0].getType(), ICPPClassType.class); assertInstance(b0_pms[1].getType(), ICPPClassType.class); assertEquals("A", ((ICPPClassType)b0_pms[0].getType()).getName()); assertEquals("B", ((ICPPClassType)b0_pms[1].getType()).getName()); - + IBinding b0_spcd= ((ICPPTemplateInstance)b0).getSpecializedBinding(); assertInstance(b0_spcd, ICPPFunction.class); assertInstance(b0_spcd, ICPPTemplateDefinition.class); - + IParameter[] b0_spcd_pms= ((ICPPFunction)b0_spcd).getParameters(); assertEquals(2, b0_spcd_pms.length); assertInstance(b0_spcd_pms[0].getType(), ICPPTemplateTypeParameter.class); assertInstance(b0_spcd_pms[1].getType(), ICPPTemplateTypeParameter.class); assertEquals("T1", ((ICPPTemplateTypeParameter)b0_spcd_pms[0].getType()).getName()); assertEquals("T2", ((ICPPTemplateTypeParameter)b0_spcd_pms[1].getType()).getName()); - + ObjectMap b0_am= ((ICPPSpecialization)b0).getArgumentMap(); assertEquals(2, b0_am.size()); assertInstance(b0_am.getAt(0), ICPPClassType.class); @@ -836,7 +836,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertEquals("T2", ((ICPPTemplateTypeParameter)b0_am.keyAt(1)).getName()); assertEquals("A", ((ICPPClassType)b0_am.getAt(0)).getName()); assertEquals("B", ((ICPPClassType)b0_am.getAt(1)).getName()); - + ICPPFunctionType b0_spcd_type= ((ICPPFunction)b0_spcd).getType(); assertInstance(b0_spcd_type.getReturnType(), ICPPBasicType.class); IType[] b0_spcd_ptypes= b0_spcd_type.getParameterTypes(); @@ -845,7 +845,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertInstance(b0_spcd_ptypes[1], ICPPTemplateTypeParameter.class); assertEquals("T1", ((ICPPTemplateTypeParameter)b0_spcd_ptypes[0]).getName()); assertEquals("T2", ((ICPPTemplateTypeParameter)b0_spcd_ptypes[1]).getName()); - + IBinding b1= getBindingFromASTName("foo(c,a)", 3); assertInstance(b1, ICPPFunction.class); ICPPFunctionType b1type= ((ICPPFunction)b1).getType(); @@ -856,20 +856,20 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertInstance(b1_ptypes[1], ICPPClassType.class); assertEquals("C", ((ICPPClassType)b1_ptypes[0]).getName()); assertEquals("A", ((ICPPClassType)b1_ptypes[1]).getName()); - + IParameter[] b1_pms= ((ICPPFunction)b1).getParameters(); assertEquals(2, b1_pms.length); assertInstance(b1_pms[0].getType(), ICPPClassType.class); assertInstance(b1_pms[1].getType(), ICPPClassType.class); assertEquals("C", ((ICPPClassType)b1_pms[0].getType()).getName()); assertEquals("A", ((ICPPClassType)b1_pms[1].getType()).getName()); - + assertInstance(b1, ICPPSpecialization.class); ICPPSpecialization b1s= (ICPPSpecialization) b1; IBinding b1_spcd= b1s.getSpecializedBinding(); assertInstance(b1_spcd, ICPPFunction.class); assertInstance(b1_spcd, ICPPTemplateDefinition.class); - + ICPPFunctionType b1_spcd_type= ((ICPPFunction)b1_spcd).getType(); assertInstance(b1_spcd_type.getReturnType(), ICPPBasicType.class); IType[] b1_spcd_ptypes= b1_spcd_type.getParameterTypes(); @@ -878,14 +878,14 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertInstance(b1_spcd_ptypes[1], ICPPTemplateTypeParameter.class); assertEquals("T1", ((ICPPTemplateTypeParameter)b1_spcd_ptypes[0]).getName()); assertEquals("T2", ((ICPPTemplateTypeParameter)b1_spcd_ptypes[1]).getName()); - + IParameter[] b1_spcd_pms= ((ICPPFunction)b1_spcd).getParameters(); assertEquals(2, b1_spcd_pms.length); assertInstance(b1_spcd_pms[0].getType(), ICPPTemplateTypeParameter.class); assertInstance(b1_spcd_pms[1].getType(), ICPPTemplateTypeParameter.class); assertEquals("T1", ((ICPPTemplateTypeParameter)b1_spcd_pms[0].getType()).getName()); assertEquals("T2", ((ICPPTemplateTypeParameter)b1_spcd_pms[1].getType()).getName()); - + ObjectMap b1_am= b1s.getArgumentMap(); assertEquals(2, b1_am.size()); assertInstance(b1_am.keyAt(0), ICPPTemplateTypeParameter.class); @@ -911,17 +911,17 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa IBinding b0= getBindingFromASTName("foo(a)", 3); assertInstance(b0, ICPPTemplateInstance.class); assertInstance(b0, ICPPFunction.class); - + ICPPFunction f= (ICPPFunction) b0; ICPPFunctionType type= f.getType(); IType rt= type.getReturnType(); IType[] pts= type.getParameterTypes(); - + IParameter[] ps= f.getParameters(); assertEquals(1, ps.length); ICPPParameter param= (ICPPParameter) ps[0]; assertInstance(param, ICPPSpecialization.class); - + IType paramType= param.getType(); assertInstance(paramType, ICPPClassType.class); ICPPParameter paramSpec= (ICPPParameter) ((ICPPSpecialization) param).getSpecializedBinding(); @@ -929,7 +929,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPTemplateTypeParameter ttp= (ICPPTemplateTypeParameter) paramSpec.getType(); assertEquals("T", ttp.getName()); assertNull(ttp.getDefault()); - + ICPPTemplateInstance inst= (ICPPTemplateInstance) b0; IBinding sp= inst.getSpecializedBinding(); assertInstance(sp, ICPPFunction.class); @@ -994,10 +994,10 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa public void testClassSpecializations_180738() { IBinding b1a = getBindingFromASTName("Foo b1;", 3); IBinding b1b = getBindingFromASTName("Foo b1;", 6); - + assertInstance(b1a, ICPPClassType.class); assertInstance(b1a, ICPPClassTemplate.class); - + assertInstance(b1b, ICPPClassType.class); assertInstance(b1b, ICPPSpecialization.class); ICPPSpecialization b1spc= (ICPPSpecialization) b1b; @@ -1006,13 +1006,13 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertInstance(b1om.getAt(0), ICPPClassType.class); ICPPClassType b1pct= (ICPPClassType) b1om.getAt(0); assertEquals("B", b1pct.getName()); - + IBinding b2a = getBindingFromASTName("Foo b2;", 3); IBinding b2b = getBindingFromASTName("Foo b2;", 6); - + assertInstance(b2a, ICPPClassType.class); assertInstance(b2a, ICPPClassTemplate.class); - + assertInstance(b2b, ICPPClassType.class); assertInstance(b2b, ICPPSpecialization.class); ICPPSpecialization b2spc= (ICPPSpecialization) b2b; @@ -1122,21 +1122,21 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa IBinding ca= getBindingFromASTName("C", 4); assertInstance(ca, ICPPClassType.class); assertInstance(ca, ICPPTemplateInstance.class); - + IBinding foo1= getBindingFromASTName("foo(c)", 3); - + IBinding da= getBindingFromASTName("D", 4); assertInstance(da, ICPPClassType.class); assertInstance(da, ICPPTemplateInstance.class); - + IBinding foo2= getBindingFromASTName("foo(d)", 3); IBinding foo3= getBindingFromASTName("foo(e)", 3); IBinding foo4= getBindingFromASTName("foo(cx)", 3); - + assertEquals(foo1, foo2); assertEquals(foo2, foo3); assertEquals(foo3, foo4); } - + // template // class A {}; // @@ -1144,7 +1144,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // // template<> // class A {}; - + // class C {}; // // A ab; @@ -1152,15 +1152,15 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa public void testEnclosingScopes_a() throws Exception { ICPPSpecialization b0= getBindingFromASTName("A", 4, ICPPSpecialization.class, ICPPClassType.class); ICPPTemplateInstance b1= getBindingFromASTName("A", 4, ICPPTemplateInstance.class, ICPPClassType.class); - + ICPPClassType sc0= assertInstance(b0.getSpecializedBinding(), ICPPClassType.class); ICPPClassType sc1= assertInstance(b1.getSpecializedBinding(), ICPPClassType.class); assertTrue(sc0.isSameType(sc1)); - + assertNull(sc0.getScope()); assertNull(b0.getScope()); } - + // template // class A { // public: @@ -1174,7 +1174,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // public: // class B {}; // }; - + // #include "header.h" // void refs() { // A::B acb; @@ -1184,7 +1184,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPClassType b0= getBindingFromASTName("B acb", 1, ICPPClassType.class); ICPPClassType b1= getBindingFromASTName("B adb", 1, ICPPClassType.class, ICPPSpecialization.class); ICPPClassType b2= getBindingFromASTName("A", 4, ICPPClassType.class, ICPPSpecialization.class); - + IIndexBinding[] sr = getIndex().findBindings("A".toCharArray(), new IndexFilter() { @Override public boolean acceptBinding(IBinding binding) throws CoreException { @@ -1193,7 +1193,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa }, npm()); assertTrue(sr.length == 1); ICPPClassType b3= (ICPPClassType) sr[0]; - + sr = getIndex().findBindings(new char[][] {"A".toCharArray(), "B".toCharArray()}, new IndexFilter() { @Override public boolean acceptBinding(IBinding binding) throws CoreException { @@ -1202,19 +1202,19 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa }, npm()); assertTrue(sr.length == 1); ICPPClassType b4= (ICPPClassType) sr[0]; - + assertFalse(b0 instanceof ICPPSpecialization); - + IIndexScope s0= (IIndexScope) b0.getScope(), s4= (IIndexScope) b4.getScope(); IScope s1= b1.getScope(); - + assertTrue(((IType)s0.getScopeBinding()).isSameType((IType)((IIndexScope)b2.getCompositeScope()).getScopeBinding())); ICPPClassScope cs1= assertInstance(s1, ICPPClassScope.class); assertInstance(cs1.getClassType(), ICPPClassType.class); assertInstance(cs1.getClassType(), ICPPTemplateInstance.class); assertTrue(((IType)((ICPPClassSpecialization) s4.getScopeBinding()).getSpecializedBinding()).isSameType( (IType) ((IIndexScope)b3.getCompositeScope()).getScopeBinding() )); } - + // class A {}; // // template @@ -1230,18 +1230,18 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa public void testEnclosingScopes_c() throws Exception { ICPPClassType b0= getBindingFromASTName("Y::Z x", 1, ICPPClassType.class); ICPPClassType b1= getBindingFromASTName("Z xayz", 1, ICPPClassType.class); - + IScope s0= b0.getScope(), s1= b1.getScope(); - + ICPPClassScope cs0= assertInstance(s0, ICPPClassScope.class); assertInstance(cs0.getClassType(), ICPPClassType.class); assertInstance(cs0.getClassType(), ICPPSpecialization.class); - + ICPPClassScope cs1= assertInstance(s1, ICPPClassScope.class); assertInstance(cs1.getClassType(), ICPPClassType.class); - assertInstance(cs1.getClassType(), ICPPSpecialization.class); + assertInstance(cs1.getClassType(), ICPPSpecialization.class); } - + // class A {}; class B {}; // // template @@ -1252,21 +1252,21 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // public: // class N {}; // }; - + // X::N n; public void testEnclosingScopes_d() throws Exception { ICPPClassType b0= getBindingFromASTName("N n", 1, ICPPClassType.class, ICPPSpecialization.class); ICPPClassType b1= assertInstance(((ICPPSpecialization) b0).getSpecializedBinding(), ICPPClassType.class); - + ICPPClassScope s0= assertInstance(b0.getScope(), ICPPClassScope.class); assertInstance(s0.getClassType(), ICPPTemplateInstance.class); - + ICPPClassScope s1= assertInstance(b1.getScope(), ICPPClassScope.class); assertInstance(s1.getClassType(), ICPPTemplateDefinition.class); - + assertNull(s1.getClassType().getScope()); } - + // typedef signed int SI; // // template @@ -1282,16 +1282,16 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertInstance(args.keyAt(0), ICPPTemplateNonTypeParameter.class); assertEquals(1, args.size()); } - - // template class A { - // class B { T t; }; - // B b; - // }; - - // void f() { - // A a; - // a.b.t; - // } + + // template class A { + // class B { T t; }; + // B b; + // }; + + // void f() { + // A a; + // a.b.t; + // } public void testNestedClassTypeSpecializations() throws Exception { ICPPField t2 = getBindingFromASTName("t;", 1, ICPPField.class); @@ -1312,7 +1312,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // template class normal_iterator { // protected: // _Iterator _M_current; - // + // // public: // typedef typename iterator_traits<_Iterator>::pointer pointer; // normal_iterator() : _M_current(_Iterator()) { } @@ -1349,7 +1349,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPField t2 = getBindingFromASTName("member; // it->member", 6, ICPPField.class); ICPPClassType ct= t2.getClassOwner(); assertEquals("MyStruct", ct.getName()); - + final IType type = t2.getType(); assertTrue(type instanceof IBasicType); assertEquals(((IBasicType)type).getType(), IBasicType.t_int); @@ -1382,7 +1382,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPTemplateArgument arg = paramMap.getArgument(0); assertEquals(Long.valueOf(256), arg.getNonTypeValue().numericalValue()); assertInstance(arg.getTypeOfNonTypeValue(), ICPPBasicType.class); - + ICPPFunction foo = getBindingFromASTName("foo(t)", 3, ICPPFunction.class); ICPPFunction bar = getBindingFromASTName("bar(t)", 3, ICPPFunction.class); } @@ -1400,15 +1400,15 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPClassType b2= getBindingFromASTName("A", 9, ICPPClassType.class, ICPPTemplateInstance.class); ICPPClassType b3= getBindingFromASTName("A", 9, ICPPClassType.class, ICPPTemplateInstance.class); ICPPClassType b4= getBindingFromASTName("A", 9, ICPPClassType.class, ICPPTemplateInstance.class); - + assertTrue(!b2.isSameType(b3)); assertTrue(!b3.isSameType(b4)); assertTrue(!b4.isSameType(b2)); - + ICPPClassType X= getBindingFromASTName("X x", 1, ICPPClassType.class); ICPPClassType Y= getBindingFromASTName("Y y", 1, ICPPClassType.class); ICPPClassType Z= getBindingFromASTName("Z z", 1, ICPPClassType.class); - + assertTrue(!X.isSameType(Y)); assertTrue(!Y.isSameType(Z)); assertTrue(!Z.isSameType(X)); @@ -1429,7 +1429,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPClassType Y= getBindingFromASTName("Y y; //2", 1, ICPPClassType.class); getProblemFromASTName("X x; //3", 1); getProblemFromASTName("Y y; //4", 1); - + assertTrue(!X.isSameType(Y)); } @@ -1453,12 +1453,12 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPClassType a5c= getBindingFromASTName("A", 7, ICPPClassType.class, ICPPSpecialization.class); ICPPClassType a5d= getBindingFromASTName("A<5>", 4, ICPPClassType.class, ICPPSpecialization.class); ICPPClassType a1= getBindingFromASTName("A<1>", 4, ICPPClassType.class, ICPPTemplateInstance.class); - + assertTrue(a5a.isSameType(a5b)); assertTrue(a5b.isSameType(a5c)); assertTrue(a5c.isSameType(a5d)); assertTrue(a5d.isSameType(a5a)); - + assertTrue(!a1.isSameType(a5a)); assertTrue(!a1.isSameType(a5b)); assertTrue(!a1.isSameType(a5c)); @@ -1489,7 +1489,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPConstructor th1sCtor= ba.assertNonProblem("This() :", 4, ICPPConstructor.class); assertFalse(th1sCtor instanceof ICPPSpecialization);ICPPTemplateNonTypeParameter np= ba.assertNonProblem("I)", 1, ICPPTemplateNonTypeParameter.class); */ - + ICPPTemplateNonTypeParameter np= getBindingFromASTName("I>(I)", 1, ICPPTemplateNonTypeParameter.class); ICPPConstructor clazz= getBindingFromASTName("That(I)", 4, ICPPConstructor.class); ICPPConstructor ctor= getBindingFromASTName("That(I)", 7, ICPPConstructor.class); @@ -1515,7 +1515,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertFalse(tid instanceof ICPPSpecialization); ICPPConstructor th1sCtor= getBindingFromASTName("This() :", 4, ICPPConstructor.class); assertFalse(th1sCtor instanceof ICPPSpecialization); - + ICPPTemplateTypeParameter np= getBindingFromASTName("I>()", 1, ICPPTemplateTypeParameter.class); ICPPConstructor clazz= getBindingFromASTName("That()", 4, ICPPConstructor.class); ICPPConstructor ctor= getBindingFromASTName("That()", 7, ICPPConstructor.class); @@ -1530,14 +1530,14 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa public void testUniqueSpecializations_Bug241641() throws Exception { ICPPVariable v1= getBindingFromASTName("v1", 2, ICPPVariable.class); ICPPVariable v2= getBindingFromASTName("v1", 2, ICPPVariable.class); - + IType t1= v1.getType(); assertInstance(t1, ICPPClassType.class); - + ICPPClassType ct= (ICPPClassType) t1; IBinding f1= ct.getCompositeScope().find("field")[0]; IBinding f2= ct.getCompositeScope().find("field")[0]; - + assertSame(f1, f2); } @@ -1549,15 +1549,15 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa public void testUniqueInstance_Bug241641() throws Exception { IASTName name= findName("v1", 2); ICPPVariable v1= getBindingFromASTName("v1", 2, ICPPVariable.class); - + IType t1= v1.getType(); assertInstance(t1, ICPPTemplateInstance.class); - + ICPPTemplateInstance inst= (ICPPTemplateInstance) t1; final ICPPClassTemplate tmplDef = (ICPPClassTemplate) inst.getTemplateDefinition(); IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments(), name); assertSame(inst, inst2); - + IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateTypeArgument(new CPPBasicType(Kind.eChar, 0))}, name); IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateTypeArgument(new CPPBasicType(Kind.eChar, 0))}, name); assertSame(charInst1, charInst2); @@ -1582,9 +1582,9 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa } // template class A {}; - // template class A { - // void foo(T t); - // }; + // template class A { + // void foo(T t); + // }; // template void A::foo(T t) {} public void testBug177418() throws Exception { @@ -1592,8 +1592,8 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPClassType owner= m.getClassOwner(); assertInstance(owner, ICPPClassTemplatePartialSpecialization.class); } - - + + // template class XT { // int f; // void m(); @@ -1610,13 +1610,13 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertFalse(m instanceof ICPPUnknownBinding); m= getBindingFromASTName("m(); // 2", 1, ICPPMethod.class); assertFalse(m instanceof ICPPUnknownBinding); - + ICPPField f= getBindingFromASTName("f; // 1", 1, ICPPField.class); assertFalse(f instanceof ICPPUnknownBinding); f= getBindingFromASTName("f; // 2", 1, ICPPField.class); assertFalse(f instanceof ICPPUnknownBinding); } - + // template class XT; // #include "header.h" @@ -1769,7 +1769,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertFalse(inst.isExplicitSpecialization()); inst = getBindingFromASTName("Y", 0); assertTrue(inst.isExplicitSpecialization()); - + inst = getBindingFromASTName("f(1)", 1); assertFalse(inst.isExplicitSpecialization()); inst = getBindingFromASTName("g(1)", 1); @@ -1819,7 +1819,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // }; // int main() { // A a; - // a.f(0); + // a.f(0); // return 0; // } public void testPartialSpecializationsOfClassTemplateSpecializations_332884() throws Exception { @@ -1844,16 +1844,16 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPClassType ct= getBindingFromASTName("TXT", 0, ICPPClassType.class); ICPPMethod[] methods = ct.getAllDeclaredMethods(); assertEquals(2, methods.length); - + methods= ct.getConstructors(); assertEquals(2, methods.length); methods= ct.getMethods(); assertEquals(14, methods.length); - + ICPPBase[] bases = ClassTypeHelper.getBases(ct, null); assertEquals(1, bases.length); - + IField field = ct.findField("bfield"); assertNotNull(field); @@ -2034,12 +2034,12 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa public void testSFINAE_b() throws Exception { checkBindings(); } - + // struct CString { // template class ListT, class UType, class Alloc, typename StringT> // void split(ListT& out, const StringT& sep, bool keepEmptyElements = false, bool trimElements = true, bool emptyBefore = true) const; // }; - + // template class ListT, class UType, class Alloc, class StringT> // void CString::split(ListT& out, const StringT& sep, bool keepEmptyElements, bool trimElements, bool emptyBefore) const { // } diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java index 6d23969e328..f2f45b1874c 100644 --- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java +++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java @@ -160,7 +160,7 @@ public class BaseTestCase extends TestCase { try { super.runBare(); } catch (Throwable e) { - testThrowable=e; + testThrowable= e; } if (statusLog.size() != fExpectedLoggedNonOK) { @@ -168,7 +168,7 @@ public class BaseTestCase extends TestCase { msg.append("non-OK status objects in log differs from actual (" + statusLog.size() + ").\n"); Throwable cause= null; if (!statusLog.isEmpty()) { - synchronized(statusLog) { + synchronized (statusLog) { for (IStatus status : statusLog) { IStatus[] ss= {status}; ss= status instanceof MultiStatus ? ((MultiStatus) status).getChildren() : ss; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryTypeIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryTypeIdExpression.java index 3d5cf6532b2..0d09b5f1d60 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryTypeIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryTypeIdExpression.java @@ -20,7 +20,7 @@ public interface IASTBinaryTypeIdExpression extends IASTExpression { public static final ASTNodeProperty OPERAND2 = new ASTNodeProperty("IASTBinaryTypeIdExpression.OPERAND2 [IASTTypeId]"); //$NON-NLS-1$ /** - * Built-in type trait of g++. + * Built-in type trait of g++. */ public static enum Operator {__is_base_of} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPFunction.java index 17248714040..b0b38f935a5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPFunction.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Andrew Niefer (IBM Corporation) - initial API and implementation * Markus Schorn (Wind River Systems) @@ -16,57 +16,57 @@ import org.eclipse.cdt.core.dom.ast.IType; /** * Binding for c++ functions. - * + * * @noimplement This interface is not intended to be implemented by clients. * @noextend This interface is not intended to be extended by clients. */ public interface ICPPFunction extends IFunction, ICPPBinding { /** - * Does this function have the mutable storage class specifier - */ - public boolean isMutable(); - - /** - * Is this an inline function - */ - @Override + * Does this function have the mutable storage class specifier + */ + public boolean isMutable(); + + /** + * Is this an inline function + */ + @Override public boolean isInline(); - - /** - * Returns whether this function is declared as extern "C". - * @since 5.0 - */ - public boolean isExternC(); - - /** - * Returns the exception specification for this function or null if there - * is no exception specification. - * @since 5.1 - */ - public IType[] getExceptionSpecification(); - - /** - * {@inheritDoc} + + /** + * Returns whether this function is declared as extern "C". + * @since 5.0 + */ + public boolean isExternC(); + + /** + * Returns the exception specification for this function or null if there + * is no exception specification. * @since 5.1 */ - @Override + public IType[] getExceptionSpecification(); + + /** + * {@inheritDoc} + * @since 5.1 + */ + @Override public ICPPFunctionType getType(); - - /** + + /** * @since 5.2 */ - @Override + @Override public ICPPParameter[] getParameters(); - - /** - * @since 5.2 - */ - public int getRequiredArgumentCount(); - - /** + + /** * @since 5.2 */ - public boolean hasParameterPack(); + public int getRequiredArgumentCount(); + + /** + * @since 5.2 + */ + public boolean hasParameterPack(); /** * Returns whether this is a function with a deleted function definition. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ObjectMap.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ObjectMap.java index bb456bed4ad..acfb2abef65 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ObjectMap.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ObjectMap.java @@ -6,10 +6,11 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Niefer (IBM Corporation) - Initial API and implementation + * Andrew Niefer (IBM Corporation) - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.parser.util; +import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -42,9 +43,7 @@ public class ObjectMap extends ObjectTable { @Override final public void clear() { super.clear(); - for(int i = 0; i < valueTable.length; i++) { - valueTable[i] = null; - } + Arrays.fill(valueTable, null); } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java index fe788c55505..17e83bb272a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java @@ -417,8 +417,9 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat copy.fForContentAssist = fForContentAssist; copy.fOriginatingTranslationUnit = fOriginatingTranslationUnit; - for (IASTDeclaration declaration : getDeclarations()) + for (IASTDeclaration declaration : getDeclarations()) { copy.addDeclaration(declaration == null ? null : declaration.copy(style)); + } copy.setOffsetAndLength(this); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java index 4f0937498d4..4aea884c140 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java @@ -227,7 +227,7 @@ public class Value implements IValue { } /** - * Creates a value object representing the given boolean value. + * Creates a value object representing the given boolean value. */ public static IValue create(boolean value) { return create(value ? 1 : 0); @@ -357,7 +357,7 @@ public class Value implements IValue { } /** * Tests whether the value is a template parameter (or a parameter pack). - * + * * @return the parameter id of the parameter, or -1 if it is not a template * parameter. */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java index a80ff8b6cf0..9a9391c2ff9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java @@ -263,7 +263,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx if (image.length > 1 && image[0] == 'L') return Value.create(ExpressionEvaluator.getChar(image, 2)); return Value.create(ExpressionEvaluator.getChar(image, 1)); - } catch (EvalException e1) { + } catch (EvalException e) { return Value.UNKNOWN; } } @@ -271,7 +271,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx private IValue createIntValue() { try { return Value.create(ExpressionEvaluator.getNumber(getValue())); - } catch (EvalException e1) { + } catch (EvalException e) { return Value.UNKNOWN; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructor.java index b8163c989b8..362ff13eb91 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructor.java @@ -19,5 +19,4 @@ public class CPPConstructor extends CPPMethod implements ICPPConstructor { public CPPConstructor(ICPPASTFunctionDeclarator declarator) { super(declarator); } - } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java index 552d57b7eb7..0b345c56ff5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Bryan Wilkinson (QNX) - Initial API and implementation - * Markus Schorn (Wind River Systems) + * Bryan Wilkinson (QNX) - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionInstance.java index d87f1996afe..877edcd63b3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionInstance.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Niefer (IBM) - Initial API and implementation - * Markus Schorn (Wind River Systems) + * Andrew Niefer (IBM) - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -28,7 +28,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates; public class CPPFunctionInstance extends CPPFunctionSpecialization implements ICPPTemplateInstance { private final ICPPTemplateArgument[] fArguments; - public CPPFunctionInstance(ICPPFunction orig, IBinding owner, CPPTemplateParameterMap argMap, ICPPTemplateArgument[] args, ICPPFunctionType type, IType[] exceptionSpecs) { + public CPPFunctionInstance(ICPPFunction orig, IBinding owner, CPPTemplateParameterMap argMap, + ICPPTemplateArgument[] args, ICPPFunctionType type, IType[] exceptionSpecs) { super(orig, owner, argMap, type, exceptionSpecs); fArguments = args; } @@ -73,11 +74,11 @@ public class CPPFunctionInstance extends CPPFunctionSpecialization implements IC @Override public boolean equals(Object obj) { - if( (obj instanceof ICPPTemplateInstance) && (obj instanceof ICPPFunction)){ - final ICPPTemplateInstance inst = (ICPPTemplateInstance)obj; - ICPPFunctionType ct1= ((ICPPFunction)getSpecializedBinding()).getType(); - ICPPFunctionType ct2= ((ICPPFunction)inst.getTemplateDefinition()).getType(); - if(!ct1.isSameType(ct2)) + if ((obj instanceof ICPPTemplateInstance) && (obj instanceof ICPPFunction)) { + final ICPPTemplateInstance inst = (ICPPTemplateInstance) obj; + ICPPFunctionType ct1= ((ICPPFunction) getSpecializedBinding()).getType(); + ICPPFunctionType ct2= ((ICPPFunction) inst.getTemplateDefinition()).getType(); + if (!ct1.isSameType(ct2)) return false; return CPPTemplates.haveSameArguments(this, inst); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java index c13981823cc..fee12ee72c3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java @@ -183,10 +183,10 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition protected ICPPASTDeclSpecifier getDeclSpecifier(IASTDeclaration decl) { if (decl instanceof IASTSimpleDeclaration) { - return (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration)decl).getDeclSpecifier(); + return (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration) decl).getDeclSpecifier(); } if (decl instanceof IASTFunctionDefinition) { - return (ICPPASTDeclSpecifier) ((IASTFunctionDefinition)decl).getDeclSpecifier(); + return (ICPPASTDeclSpecifier) ((IASTFunctionDefinition) decl).getDeclSpecifier(); } return null; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplateSpecialization.java index f69032f8028..9af4428ecae 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplateSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplateSpecialization.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Niefer (IBM) - Initial API and implementation - * Markus Schorn (Wind River Systems) + * Andrew Niefer (IBM) - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -29,8 +29,7 @@ import org.eclipse.cdt.core.parser.util.ObjectMap; */ public class CPPFunctionTemplateSpecialization extends CPPFunctionSpecialization implements ICPPFunctionTemplate, ICPPInternalTemplate { - - private ObjectMap instances = null; + private ObjectMap instances; public CPPFunctionTemplateSpecialization(ICPPFunction original, ICPPClassType owner, ICPPTemplateParameterMap argumentMap, ICPPFunctionType type, IType[] exceptionSpecs) { super(original, owner, argumentMap, type, exceptionSpecs); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java index 06f157e95f9..0da586a55e3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java @@ -23,16 +23,14 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument; */ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod { - public CPPMethodInstance(ICPPMethod orig, ICPPClassType owner, CPPTemplateParameterMap tpmap, ICPPTemplateArgument[] args, ICPPFunctionType type, IType[] exceptionSpecs) { + public CPPMethodInstance(ICPPMethod orig, ICPPClassType owner, CPPTemplateParameterMap tpmap, + ICPPTemplateArgument[] args, ICPPFunctionType type, IType[] exceptionSpecs) { super(orig, owner, tpmap, args, type, exceptionSpecs); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility() - */ @Override public int getVisibility() { - return ((ICPPMethod)getTemplateDefinition()).getVisibility(); + return ((ICPPMethod) getTemplateDefinition()).getVisibility(); } @Override @@ -40,20 +38,14 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod return (ICPPClassType) getOwner(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual() - */ @Override public boolean isVirtual() { - return ((ICPPMethod)getTemplateDefinition()).isVirtual(); + return ((ICPPMethod) getTemplateDefinition()).isVirtual(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual() - */ @Override public boolean isPureVirtual() { - return ((ICPPMethod)getTemplateDefinition()).isPureVirtual(); + return ((ICPPMethod) getTemplateDefinition()).isPureVirtual(); } @Override @@ -61,9 +53,6 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod return ((ICPPMethod) getTemplateDefinition()).isExplicit(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor() - */ @Override public boolean isDestructor() { char[] name = getNameCharArray(); @@ -80,11 +69,11 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod @Override public boolean isOverride() { - return ((ICPPMethod)getTemplateDefinition()).isOverride(); + return ((ICPPMethod) getTemplateDefinition()).isOverride(); } @Override public boolean isFinal() { - return ((ICPPMethod)getTemplateDefinition()).isFinal(); + return ((ICPPMethod) getTemplateDefinition()).isFinal(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameterMap.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameterMap.java index bb7d051db56..c1c7c5db9fa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameterMap.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameterMap.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java index bcfd998555d..1e04bd14966 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java @@ -3041,8 +3041,10 @@ public class CPPSemantics { if (type == null) return null; - ICPPEvaluation[] args = {new EvalFixed(type, LVALUE, Value.UNKNOWN), - ((ICPPASTExpression) expr.getOperand()).getEvaluation()}; + ICPPEvaluation[] args = { + new EvalFixed(type, LVALUE, Value.UNKNOWN), + ((ICPPASTExpression) expr.getOperand()).getEvaluation() + }; return findOverloadedOperator(expr, args, type, op, LookupMode.GLOBALS_IF_NO_MEMBERS); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionCall.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionCall.java index 37d30feef73..5ca58c483d2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionCall.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionCall.java @@ -96,7 +96,7 @@ public class EvalFunctionCall extends CPPEvaluation { if (isTypeDependent()) return null; - IType t= SemanticUtil.getNestedType(fArguments[0].getTypeOrFunctionSet(point), TDEF|REF|CVTYPE); + IType t= SemanticUtil.getNestedType(fArguments[0].getTypeOrFunctionSet(point), TDEF | REF | CVTYPE); if (t instanceof ICPPClassType) { return CPPSemantics.findOverloadedOperator(point, fArguments, t, OverloadableOperator.PAREN, LookupMode.NO_GLOBALS); } @@ -118,9 +118,8 @@ public class EvalFunctionCall extends CPPEvaluation { if (overload != null) return ExpressionTypes.typeFromFunctionCall(overload); - final ICPPEvaluation arg0 = fArguments[0]; - IType t= SemanticUtil.getNestedType(arg0.getTypeOrFunctionSet(point), TDEF|REF|CVTYPE); + IType t= SemanticUtil.getNestedType(arg0.getTypeOrFunctionSet(point), TDEF | REF | CVTYPE); if (t instanceof ICPPClassType) { return ProblemType.UNKNOWN_FOR_EXPRESSION; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java index 18d34c51d24..61652be2b55 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java @@ -175,8 +175,9 @@ public class EvalMemberAccess extends CPPEvaluation { * examine for type information. */ - ICPPEvaluation[] args= {new EvalFixed(type, LVALUE, Value.UNKNOWN)}; - ICPPFunction op= CPPSemantics.findOverloadedOperator(point, args, classType, OverloadableOperator.ARROW, LookupMode.NO_GLOBALS); + ICPPEvaluation[] args= { new EvalFixed(type, LVALUE, Value.UNKNOWN) }; + ICPPFunction op= CPPSemantics.findOverloadedOperator(point, args, classType, + OverloadableOperator.ARROW, LookupMode.NO_GLOBALS); if (op == null) break; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCEnumerator.java index f0844214e92..a7714d15f0b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCEnumerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCEnumerator.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Ferguson (Symbian) - Initial implementation + * Andrew Ferguson (Symbian) - Initial implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.index.composite.c; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCParameter.java index ff10cb11cd5..0fac49f065e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCParameter.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Ferguson (Symbian) - Initial implementation + * Andrew Ferguson (Symbian) - Initial implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.index.composite.c; @@ -24,28 +24,28 @@ class CompositeCParameter extends CompositeCBinding implements IParameter { @Override public IType getType() { - IType rtype = ((IParameter)rbinding).getType(); + IType rtype = ((IParameter) rbinding).getType(); return cf.getCompositeType(rtype); } @Override public boolean isAuto() { - return ((IParameter)rbinding).isAuto(); + return ((IParameter) rbinding).isAuto(); } @Override public boolean isExtern() { - return ((IParameter)rbinding).isExtern(); + return ((IParameter) rbinding).isExtern(); } @Override public boolean isRegister() { - return ((IParameter)rbinding).isRegister(); + return ((IParameter) rbinding).isRegister(); } @Override public boolean isStatic() { - return ((IParameter)rbinding).isStatic(); + return ((IParameter) rbinding).isStatic(); } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCVariable.java index 94bd4492641..bd7dd2d298a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/c/CompositeCVariable.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Ferguson (Symbian) - Initial implementation + * Andrew Ferguson (Symbian) - Initial implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.index.composite.c; @@ -24,18 +24,18 @@ class CompositeCVariable extends CompositeCBinding implements IVariable { @Override public IType getType() { - IType rtype = ((IVariable)rbinding).getType(); + IType rtype = ((IVariable) rbinding).getType(); return cf.getCompositeType(rtype); } @Override public boolean isAuto() { - return ((IVariable)rbinding).isAuto(); + return ((IVariable) rbinding).isAuto(); } @Override public boolean isExtern() { - return ((IVariable)rbinding).isExtern(); + return ((IVariable) rbinding).isExtern(); } @Override @@ -45,11 +45,11 @@ class CompositeCVariable extends CompositeCBinding implements IVariable { @Override public boolean isStatic() { - return ((IVariable)rbinding).isStatic(); + return ((IVariable) rbinding).isStatic(); } @Override public IValue getInitialValue() { - return ((IVariable)rbinding).getInitialValue(); + return ((IVariable) rbinding).getInitialValue(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPEnumerator.java index 27ebbe83184..e91a26ea793 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPEnumerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPEnumerator.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Ferguson (Symbian) - Initial implementation + * Andrew Ferguson (Symbian) - Initial implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.index.composite.cpp; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPVariable.java index 461fe8b317b..b0230b82e42 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPVariable.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Ferguson (Symbian) - Initial implementation - * Markus Schorn (Wind River Systems) + * Andrew Ferguson (Symbian) - Initial implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.index.composite.cpp; @@ -25,42 +25,42 @@ class CompositeCPPVariable extends CompositeCPPBinding implements ICPPVariable { @Override public boolean isMutable() { - return ((ICPPVariable)rbinding).isMutable(); + return ((ICPPVariable) rbinding).isMutable(); } @Override public boolean isExternC() { - return ((ICPPVariable)rbinding).isExternC(); + return ((ICPPVariable) rbinding).isExternC(); } @Override public IType getType() { - IType rtype = ((ICPPVariable)rbinding).getType(); + IType rtype = ((ICPPVariable) rbinding).getType(); return cf.getCompositeType(rtype); } @Override public boolean isAuto() { - return ((ICPPVariable)rbinding).isAuto(); + return ((ICPPVariable) rbinding).isAuto(); } @Override public boolean isExtern() { - return ((ICPPVariable)rbinding).isExtern(); + return ((ICPPVariable) rbinding).isExtern(); } @Override public boolean isRegister() { - return ((ICPPVariable)rbinding).isRegister(); + return ((ICPPVariable) rbinding).isRegister(); } @Override public boolean isStatic() { - return ((ICPPVariable)rbinding).isStatic(); + return ((ICPPVariable) rbinding).isStatic(); } @Override public IValue getInitialValue() { - return ((ICPPVariable)rbinding).getInitialValue(); + return ((ICPPVariable) rbinding).getInitialValue(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ExpressionEvaluator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ExpressionEvaluator.java index 09ccfce9787..ab5810c6058 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ExpressionEvaluator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ExpressionEvaluator.java @@ -1,11 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2004, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * IBM Corporation - initial implementation * Markus Schorn (Wind River Systems) * Bryan Wilkinson (QNX) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207 @@ -73,9 +73,9 @@ public class ExpressionEvaluator { if (LA() == IToken.tQUESTION) { consume(); long r2 = expression(); - if (LA() == IToken.tCOLON) + if (LA() == IToken.tCOLON) { consume(); - else { + } else { throw new EvalException(IProblem.SCANNER_BAD_CONDITIONAL_EXPRESSION, null); } long r3 = conditionalExpression(); @@ -139,11 +139,12 @@ public class ExpressionEvaluator { for (int t = LA(); t == IToken.tEQUAL || t == IToken.tNOTEQUAL; t = LA()) { consume(); long r2 = relationalExpression(); - if (t == IToken.tEQUAL) + if (t == IToken.tEQUAL) { r1 = (r1 == r2) ? 1 : 0; - else + } else { // t == tNOTEQUAL r1 = (r1 != r2) ? 1 : 0; + } } return r1; } @@ -179,11 +180,12 @@ public class ExpressionEvaluator { for (int t = LA(); t == IToken.tSHIFTL || t == IToken.tSHIFTR; t = LA()) { consume(); long r2 = additiveExpression(); - if (t == IToken.tSHIFTL) + if (t == IToken.tSHIFTL) { r1 = r1 << r2; - else + } else { // t == tSHIFTR r1 = r1 >> r2; + } } return r1; } @@ -193,11 +195,12 @@ public class ExpressionEvaluator { for (int t = LA(); t == IToken.tPLUS || t == IToken.tMINUS; t = LA()) { consume(); long r2 = multiplicativeExpression(); - if (t == IToken.tPLUS) + if (t == IToken.tPLUS) { r1 = r1 + r2; - else + } else { // t == tMINUS r1 = r1 - r2; + } } return r1; } @@ -207,13 +210,14 @@ public class ExpressionEvaluator { for (int t = LA(); t == IToken.tSTAR || t == IToken.tDIV || t == IToken.tMOD; t = LA()) { consume(); long r2 = unaryExpression(); - if (t == IToken.tSTAR) + if (t == IToken.tSTAR) { r1 = r1 * r2; - else if (r2 != 0) { - if (t == IToken.tDIV) + } else if (r2 != 0) { + if (t == IToken.tDIV) { r1 = r1 / r2; - else + } else { r1 = r1 % r2; //tMOD + } } else { throw new EvalException(IProblem.SCANNER_DIVIDE_BY_ZERO, null); } @@ -328,7 +332,7 @@ public class ExpressionEvaluator { } long getValue(Token t) throws EvalException { - switch(t.getType()) { + switch (t.getType()) { case IToken.tCHAR: return getChar(t.getCharImage(), 1); case IToken.tLCHAR: @@ -386,7 +390,7 @@ public class ExpressionEvaluator { } public static long getChar(char[] tokenImage, int i) throws EvalException { - if (i>=tokenImage.length) { + if (i >= tokenImage.length) { throw new EvalException(IProblem.SCANNER_BAD_CHARACTER, tokenImage); } final char c= tokenImage[i]; @@ -398,7 +402,7 @@ public class ExpressionEvaluator { throw new EvalException(IProblem.SCANNER_BAD_CHARACTER, tokenImage); } final char d= tokenImage[i]; - switch(d) { + switch (d) { case '\\': case '"': case '\'': return d; case 'a': return 7; @@ -433,7 +437,7 @@ public class ExpressionEvaluator { result= result*base + digit; } for (; i < to; i++) { - switch(tokenImage[i]) { + switch (tokenImage[i]) { case 'u' : case 'l': case 'U': case 'L': break; default: @@ -444,13 +448,13 @@ public class ExpressionEvaluator { } private static int getDigit(char c) { - switch(c) { + switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - return c-'0'; + return c - '0'; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - return c-'a' + 10; + return c - 'a' + 10; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - return c-'A'+10; + return c - 'A' + 10; } return Integer.MAX_VALUE; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/YieldableIndexLock.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/YieldableIndexLock.java index 03015c012c4..4420b6ad6ab 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/YieldableIndexLock.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/YieldableIndexLock.java @@ -14,7 +14,7 @@ import org.eclipse.cdt.internal.core.index.IWritableIndex; /** * Write lock on the index that can be yielded temporarily to unblock threads that need - * read access to the index. + * read access to the index. * @since 5.2 */ public class YieldableIndexLock { @@ -30,7 +30,7 @@ public class YieldableIndexLock { /** * Acquires the lock. - * + * * @throws InterruptedException */ public void acquire() throws InterruptedException { @@ -51,7 +51,7 @@ public class YieldableIndexLock { /** * Yields the lock temporarily if it was held for YIELD_INTERVAL or more, and somebody is waiting - * for a read lock. + * for a read lock. * @throws InterruptedException */ public void yield() throws InterruptedException { @@ -64,7 +64,7 @@ public class YieldableIndexLock { } /** - * @return Total time the lock was held in milliseconds. + * @return Total time the lock was held in milliseconds. */ public long getCumulativeLockTime() { return cumulativeLockTime; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java index d7a5ef03c2b..18169181436 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java @@ -6,9 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Doug Schaefer (QNX) - Initial API and implementation - * Andrew Ferguson (Symbian) - * Markus Schorn (Wind River Systems) + * Doug Schaefer (QNX) - Initial API and implementation + * Andrew Ferguson (Symbian) + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom.c; @@ -31,15 +31,14 @@ import org.eclipse.core.runtime.CoreException; * Binding for a function parameter in the index. */ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBinding { - private static final int NEXT_PARAM = PDOMNamedNode.RECORD_SIZE; - private static final int FLAG_OFFSET = NEXT_PARAM + Database.PTR_SIZE; + private static final int FLAG_OFFSET = NEXT_PARAM + Database.PTR_SIZE; @SuppressWarnings("hiding") public static final int RECORD_SIZE = FLAG_OFFSET + 1; static { assert RECORD_SIZE <= 22; // 23 would yield a 32-byte block } - + private final IType fType; public PDOMCParameter(PDOMLinkage linkage, long record, IType type) { super(linkage, record); @@ -50,7 +49,7 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin throws CoreException { super(linkage, parent, param.getNameCharArray()); fType= null; // this constructor is used for adding parameters to the database, only. - + Database db = getDB(); db.putRecPtr(record + NEXT_PARAM, 0); @@ -67,7 +66,7 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin public int getNodeType() { return IIndexCBindingConstants.CPARAMETER; } - + @Override public IType getType() { return fType; @@ -75,13 +74,13 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin @Override public boolean isAuto() { - byte flag = 1<= 0;) { - next= new PDOMCPPParameter(linkage, this, params[i], next); + PDOMCPPParameter next = null; + for (int i = params.length; --i >= 0;) { + next = new PDOMCPPParameter(linkage, this, params[i], next); } db.putRecPtr(record + FIRST_PARAM, next == null ? 0 : next.getRecord()); } private void setType(ICPPFunctionType ft) throws CoreException { - fType= null; + fType = null; getLinkage().storeType(record + FUNCTION_TYPE, ft); } - + @Override public int getSignatureHash() throws CoreException { return getDB().getInt(record + SIGNATURE_HASH); } - + public static int getSignatureHash(PDOMLinkage linkage, long record) throws CoreException { return linkage.getDB().getInt(record + SIGNATURE_HASH); } - + public PDOMCPPFunction(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } - + @Override protected int getRecordSize() { return RECORD_SIZE; @@ -229,12 +228,12 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl public int getNodeType() { return IIndexCPPBindingConstants.CPPFUNCTION; } - + private PDOMCPPParameter getFirstParameter(IType type) throws CoreException { long rec = getDB().getRecPtr(record + FIRST_PARAM); return rec != 0 ? new PDOMCPPParameter(getLinkage(), rec, type) : null; } - + @Override public boolean isInline() { return getBit(getAnnotation(), PDOMCAnnotation.INLINE_OFFSET); @@ -244,9 +243,9 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl public int getRequiredArgumentCount() { if (fRequiredArgCount == -1) { try { - fRequiredArgCount= getDB().getInt(record + REQUIRED_ARG_COUNT); + fRequiredArgCount = getDB().getInt(record + REQUIRED_ARG_COUNT); } catch (CoreException e) { - fRequiredArgCount= 0; + fRequiredArgCount = 0; } } return fRequiredArgCount; @@ -255,9 +254,9 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl final protected short getAnnotation() { if (fAnnotation == -1) { try { - fAnnotation= getDB().getShort(record + ANNOTATION); + fAnnotation = getDB().getShort(record + ANNOTATION); } catch (CoreException e) { - fAnnotation= 0; + fAnnotation = 0; } } return fAnnotation; @@ -281,20 +280,20 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl @Override public ICPPParameter[] getParameters() { try { - PDOMLinkage linkage= getLinkage(); - Database db= getDB(); + PDOMLinkage linkage = getLinkage(); + Database db = getDB(); ICPPFunctionType ft = getType(); - IType[] ptypes= ft == null ? IType.EMPTY_TYPE_ARRAY : ft.getParameterTypes(); - + IType[] ptypes = ft == null ? IType.EMPTY_TYPE_ARRAY : ft.getParameterTypes(); + int n = db.getInt(record + NUM_PARAMS); ICPPParameter[] result = new ICPPParameter[n]; - + long next = db.getRecPtr(record + FIRST_PARAM); - for (int i = 0; i < n && next != 0; i++) { - IType type= i= 0; --i) { + for (int i= length; --i >= 0;) { // There may be fewer or less original parameters, because of parameter packs. if (i < origAstParams.length - 1) { // Normal case origPar= new PDOMCPPParameter(linkage, specialized, origAstParams[i], null); } else if (origPar == null) { // Use last parameter - origPar= new PDOMCPPParameter(linkage, specialized, origAstParams[origAstParams.length-1], null); + origPar= new PDOMCPPParameter(linkage, specialized, origAstParams[origAstParams.length - 1], null); } next= new PDOMCPPParameterSpecialization(linkage, this, astParams[i], origPar, next); } @@ -205,8 +205,8 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP if (fType == null) { try { fType= (ICPPFunctionType) getLinkage().loadType(record + FUNCTION_TYPE); - } catch(CoreException ce) { - CCorePlugin.log(ce); + } catch (CoreException e) { + CCorePlugin.log(e); fType= new ProblemFunctionType(ISemanticProblem.TYPE_NOT_PERSISTED); } } @@ -287,7 +287,7 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP @Override public int pdomCompareTo(PDOMBinding other) { int cmp= super.pdomCompareTo(other); - return cmp==0 ? PDOMCPPFunction.compareSignatures(this, other) : cmp; + return cmp == 0 ? PDOMCPPFunction.compareSignatures(this, other) : cmp; } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java index beed91a0823..f206ab32729 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java @@ -6,9 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Doug Schaefer (QNX) - Initial API and implementation - * Markus Schorn (Wind River Systems) - * IBM Corporation + * Doug Schaefer (QNX) - Initial API and implementation + * Markus Schorn (Wind River Systems) + * IBM Corporation *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom.cpp; @@ -35,7 +35,6 @@ import org.eclipse.core.runtime.CoreException; * Binding for a parameter of a c++ function in the index. */ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBinding { - private static final int NEXT_PARAM = PDOMNamedNode.RECORD_SIZE; private static final int ANNOTATIONS = NEXT_PARAM + Database.PTR_SIZE; private static final int FLAGS = ANNOTATIONS + 1; @@ -44,10 +43,11 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind static { assert RECORD_SIZE <= 22; // 23 would yield a 32-byte block } - + private static final byte FLAG_DEFAULT_VALUE = 0x1; private final IType fType; + public PDOMCPPParameter(PDOMLinkage linkage, long record, IType type) { super(linkage, record); fType= type; @@ -57,7 +57,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind throws CoreException { super(linkage, parent, param.getNameCharArray()); fType= null; // this constructor is used for adding parameters to the database, only. - + Database db = getDB(); db.putByte(record + FLAGS, param.hasDefaultValue() ? FLAG_DEFAULT_VALUE : 0); db.putRecPtr(record + NEXT_PARAM, next == null ? 0 : next.getRecord()); @@ -77,9 +77,9 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind db.putByte(record + FLAGS, FLAG_DEFAULT_VALUE); } else if (newPar.isParameterPack()) { db.putByte(record + FLAGS, (byte) 0); - } + } storeAnnotations(db, newPar); - + final char[] newName = newPar.getNameCharArray(); if (!CharArrayUtils.equals(newName, getNameCharArray())) { updateName(newName); @@ -95,7 +95,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind public int getNodeType() { return IIndexCPPBindingConstants.CPPPARAMETER; } - + @Override public String[] getQualifiedName() { return new String[] {getName()}; @@ -114,7 +114,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind @Override public boolean isMutable() { // ISO/IEC 14882:2003 7.1.1.8 - return false; + return false; } @Override @@ -125,14 +125,14 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind @Override public boolean isAuto() { // ISO/IEC 14882:2003 7.1.1.2 - byte flag = 1<