diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java index 515d3fa3eac..ce8b29f5163 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java @@ -650,29 +650,13 @@ public class ASTTypeUtil { return false; } } - - /** - * Checks if a type is present in an array of types. - * @param type a type. - * @param array an array of types - * @return offset of the first occurrence of type in the array, or -1 if not found. - * @since 5.2 - */ - public static int findType(IType type, IType[] array) { - for (int i = 0; i < array.length; i++) { - if (type.isSameType(array[i])) { - return i; - } - } - return -1; - } - + private static String[] getQualifiedNameForAnonymous(ICPPBinding binding, boolean normalize) throws DOMException { LinkedList result= new LinkedList(); result.addFirst(getNameForAnonymous(binding)); IBinding owner= binding.getOwner(); - while (owner instanceof ICPPNamespace || owner instanceof IType) { + while(owner instanceof ICPPNamespace || owner instanceof IType) { char[] name= owner.getNameCharArray(); if (name == null || name.length == 0) { if (!(binding instanceof ICPPNamespace)) { @@ -737,6 +721,7 @@ public class ASTTypeUtil { return null; } + private static int findFileNameStart(char[] fname) { for (int i= fname.length - 2; i >= 0; i--) { switch (fname[i]) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ProblemBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ProblemBinding.java index 926256b6c84..e1b8be95af4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ProblemBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ProblemBinding.java @@ -9,7 +9,6 @@ * Andrew Niefer (IBM Corporation) - initial API and implementation * Markus Schorn (Wind River Systems) * Bryan Wilkinson (QNX) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java index ffd03b364d6..2854a68739b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java @@ -1643,7 +1643,7 @@ public class CVisitor extends ASTQueries { * Searches for the function enclosing the given node. May return null. */ public static IBinding findEnclosingFunction(IASTNode node) { - while (node != null && !(node instanceof IASTFunctionDefinition)) { + while(node != null && node instanceof IASTFunctionDefinition == false) { node= node.getParent(); } if (node == null) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java index a317b94f4c2..62bb7095063 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java @@ -50,8 +50,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPField; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration; @@ -67,7 +65,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType.CPPClassTypeProblem; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; import org.eclipse.core.runtime.CoreException; /** @@ -125,41 +122,6 @@ public class ClassTypeHelper { return resultSet.keyArray(IBinding.class); } - /** - * Checks if a binding is a friend of a class. Only classes and functions can be friends of a class. - * A class is considered a friend of itself. - * @param binding a binding. - * @param classType a class. - * @return true if binding is a friend of classType. - * @throws DOMException - */ - public static boolean isFriend(IBinding binding, ICPPClassType classType) throws DOMException { - IType type; - if (binding instanceof ICPPClassType) { - type = (IType) binding; - if (type.isSameType(classType)) { - return true; - } - for (IBinding friend : classType.getFriends()) { - if (friend instanceof ICPPClassType && type.isSameType((IType) friend)) { - return true; - } - } - } else if (binding instanceof ICPPFunction) { - type = ((ICPPFunction) binding).getType(); - char[] name = binding.getNameCharArray(); - for (IBinding friend : classType.getFriends()) { - if (friend instanceof ICPPFunction && - CharArrayUtils.equals(name, friend.getNameCharArray()) && - SemanticUtil.isSameOwner(binding.getOwner(), friend.getOwner()) && - type.isSameType(((ICPPFunction) friend).getType())) { - return true; - } - } - } - return false; - } - /** * A host maybe backed up with a definition from the index. * @throws DOMException @@ -245,39 +207,22 @@ public class ClassTypeHelper { return (ICPPField[]) ArrayUtil.trim(ICPPField.class, result); } - public static ICPPClassType[] getAllBases(ICPPClassType classType) throws DOMException { - return getAllBases(classType, ICPPBase.v_private); - } - - /** - * Returns all direct and indirect base classes that have at least a given visibility level. - * @param classType a class - * @param minVisibility one of ICPPBase.v_private, ICPPBase.v_protected, - * or ICPPBase.v_public. All base classes are returned if - * minVisibility == ICPPBase.v_private since it is the lowest visibility level. - * @return An array of visible base classes in arbitrary order. - * @throws DOMException - */ - public static ICPPClassType[] getAllBases(ICPPClassType classType, int minVisibility) throws DOMException { + public static ICPPClassType[] getAllBases(ICPPClassType ct) throws DOMException { HashSet result= new HashSet(); - result.add(classType); - getAllBases(classType, minVisibility, result); - result.remove(classType); + result.add(ct); + getAllBases(ct, result); + result.remove(ct); return result.toArray(new ICPPClassType[result.size()]); } - private static void getAllBases(ICPPClassType classType, int minVisibility, HashSet result) throws DOMException { - ICPPBase[] bases= classType.getBases(); + private static void getAllBases(ICPPClassType ct, HashSet result) throws DOMException { + ICPPBase[] bases= ct.getBases(); for (ICPPBase base : bases) { - // Note that numeric visibility values are ordered backwards: - // ICPPBase.v_public < ICPPBase.v_protected < ICPPBase.v_private. - if (base.getVisibility() <= minVisibility) { - IBinding b= base.getBaseClass(); - if (b instanceof ICPPClassType) { - final ICPPClassType baseClass = (ICPPClassType) b; - if (result.add(baseClass)) { - getAllBases(baseClass, minVisibility, result); - } + IBinding b= base.getBaseClass(); + if (b instanceof ICPPClassType) { + final ICPPClassType ctbase = (ICPPClassType) b; + if (result.add(ctbase)) { + getAllBases(ctbase, result); } } } @@ -285,7 +230,7 @@ public class ClassTypeHelper { public static ICPPMethod[] getAllDeclaredMethods(ICPPClassType ct) throws DOMException { ICPPMethod[] methods= ct.getDeclaredMethods(); - ICPPClassType[] bases= getAllBases(ct, ICPPBase.v_private); + ICPPClassType[] bases= getAllBases(ct); for (ICPPClassType base : bases) { methods = (ICPPMethod[]) ArrayUtil.addAll(ICPPMethod.class, methods, base.getDeclaredMethods()); } @@ -298,7 +243,7 @@ public class ClassTypeHelper { ICPPClassScope scope= (ICPPClassScope) ct.getCompositeScope(); set.addAll(scope.getImplicitMethods()); - ICPPClassType[] bases= getAllBases(ct, ICPPBase.v_private); + ICPPClassType[] bases= getAllBases(ct); for (ICPPClassType base : bases) { set.addAll(base.getDeclaredMethods()); final IScope compositeScope = base.getCompositeScope(); @@ -419,7 +364,7 @@ public class ClassTypeHelper { public static IField[] getFields(ICPPClassType ct) throws DOMException { IField[] fields = ct.getDeclaredFields(); - ICPPClassType[] bases = getAllBases(ct, ICPPBase.v_private); + ICPPClassType[] bases = getAllBases(ct); for (ICPPClassType base : bases) { fields = (IField[]) ArrayUtil.addAll(IField.class, fields, base.getFields()); } @@ -487,7 +432,7 @@ public class ClassTypeHelper { if (sourceClass == null || targetClass == null) return false; - ICPPClassType[] bases= getAllBases(sourceClass, ICPPBase.v_private); + ICPPClassType[] bases= getAllBases(sourceClass); for (ICPPClassType base : bases) { if (base.isSameType(targetClass)) return true; @@ -657,7 +602,7 @@ public class ClassTypeHelper { return null; List inheritedTypeids = new ArrayList(); - ICPPClassType[] bases= getAllBases(owner, ICPPBase.v_private); + ICPPClassType[] bases= getAllBases(owner); for (ICPPClassType base : bases) { if (!(base instanceof ICPPDeferredClassInstance)) { ICPPMethod baseMethod= getMethodInClass(base, kind); @@ -749,54 +694,4 @@ public class ClassTypeHelper { } return null; } - - /** - * Compares two visibility values. ICPPBase.v_public is the highest visibility, ICPPBase.v_private is - * the lowest. - * @param visibility1 one of: ICPPBase.v_public, ICPPBase.v_protected, ICPPBase.v_private. - * @param visibility2 one of: ICPPBase.v_public, ICPPBase.v_protected, ICPPBase.v_private. - * @return true if visibility1 is less than visibility2. - */ - public static boolean isLessVisibility(int visibility1, int visibility2) { - // Note that numeric visibility values are ordered backwards: - // ICPPBase.v_public < ICPPBase.v_protected < ICPPBase.v_private. - return visibility1 > visibility2; - } - - /** - * Removes bindings that are not visible at the given visibility level. - * @param bindings bindings to be filtered. - * @param minVisibility one of: ICPPMember.v_public, ICPPMember.v_protected, ICPPMember.v_private. - */ - public static void filterByVisibility(IBinding[] bindings, int minVisibility) { - final int length = bindings.length; - int pos = 0; - for (int i = 0; i < length; i++) { - final IBinding binding= bindings[i]; - if (binding != null && isVisible(binding, minVisibility)) { - bindings[pos++]= binding; - } - } - while (pos < length) { - bindings[pos++]= null; - } - } - - /** - * Checks if a binding is visible at the given visibility level. - * @param binding a binding. - * @param minVisibility one of: ICPPMember.v_public, ICPPMember.v_protected, ICPPMember.v_private. - * @return true if visibility of the binding is not less than minVisibility. - */ - public static boolean isVisible(IBinding binding, int minVisibility) { - try { - if (binding instanceof ICPPMember) { - return !isLessVisibility(((ICPPMember) binding).getVisibility(), minVisibility); - } - // TODO(sprigogin): Handle visibility of nested types - } catch (DOMException e) { - // Presume visibility if anything goes wrong. - } - return true; - } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java index b2383d56f10..4c4cd2dc1bc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java @@ -7,7 +7,6 @@ * * Contributors: * Markus Schorn - initial API and implementation - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics; @@ -31,15 +30,13 @@ import org.eclipse.cdt.core.index.IIndexFileSet; import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.core.parser.util.CharArrayObjectMap; import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding; -import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding; /** - * Helper class for performing the base class lookup. First a directed graph without loops is computed - * to represent the base class hierarchy up to those bases for which the lookup finds matches. Next, from - * these leaves we search for virtual bases that are hidden. With this information the matches are extracted - * from the graph. + * Helper class for performing the base class lookup. First a directed graph without loops is computed to represent the base + * class hierarchy up to those bases for which the lookup finds matches. Next, from these leaves we search for virtual bases + * that are hidden. With this information the matches are extracted from the graph. */ class BaseClassLookup { public static void lookupInBaseClasses(LookupData data, ICPPClassScope classScope, IIndexFileSet fileSet) { @@ -49,10 +46,9 @@ class BaseClassLookup { final ICPPClassType classType= classScope.getClassType(); if (classType == null) return; - + final HashMap infoMap = new HashMap(); - BaseClassLookup rootInfo= lookupInBaseClass(data, null, false, classType, ICPPMember.v_public, - fileSet, infoMap, 0); + BaseClassLookup rootInfo= lookupInBaseClass(data, null, false, classType, fileSet, infoMap, 0); if (data.contentAssist) { rootInfo.collectResultForContentAssist(data); } else { @@ -75,7 +71,6 @@ class BaseClassLookup { private BaseClassLookup(ICPPClassType type) { fClassType= type; } - ICPPClassType getClassType() { return fClassType; } @@ -83,11 +78,9 @@ class BaseClassLookup { IBinding[] getResult() { return fBindings; } - boolean containsVirtualBase() { - return fVirtual != null && fVirtual.nextSetBit(0) >= 0; + return (fVirtual != null && fVirtual.nextSetBit(0) >= 0); } - boolean hasMatches() { return fBindings != null && fBindings.length > 0 && fBindings[0] != null; } @@ -111,12 +104,11 @@ class BaseClassLookup { public void setHiddenAsVirtualBase() { fHiddenAsVirtualBase= true; } - public void propagateHiddenAsVirtual() { if (fPropagationDone) return; fPropagationDone= true; - for (int i= 0; i < fChildren.size(); i++) { + for (int i=0; i infoMap, int depth) { + static BaseClassLookup lookupInBaseClass(LookupData data, ICPPClassScope baseClassScope, boolean isVirtual, ICPPClassType root, IIndexFileSet fileSet, HashMap infoMap, int depth) { if (depth++ > CPPSemantics.MAX_INHERITANCE_DEPTH) return null; - if (data.filterByVisibility) { - ICPPClassType classType = baseClassScope != null ? baseClassScope.getClassType() : root; - int baseVisibility = CPPSemantics.getClassVisibility(classType, data.getVisibilityContext()); - if (ClassTypeHelper.isLessVisibility(baseVisibility, minVisibility)) { - minVisibility = baseVisibility; - } - } - if (baseClassScope != null) { BaseClassLookup info= infoMap.get(baseClassScope); if (info != null) { // avoid loops if (info.getResult() == null) { - data.problem = new ProblemBinding(null, IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, - root.getNameCharArray()); + data.problem = new ProblemBinding(null, IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, root.getNameCharArray()); return null; } return info; @@ -186,10 +167,6 @@ class BaseClassLookup { if (data.typesOnly) { CPPSemantics.removeObjects(members); } - if (data.filterByVisibility) { - ClassTypeHelper.filterByVisibility(members, minVisibility); - } - if (members != null && members.length > 0 && members[0] != null) { if (data.prefixLookup) { matches= members; @@ -203,8 +180,7 @@ class BaseClassLookup { } } - // There is no result in the baseClass itself or we do content assist, we have to examine its - // base-classes + // there is no result in the baseClass itself or we do content assist, we have to examine its base-classes ICPPClassType baseClass= result.getClassType(); if (baseClass != null) { ICPPBase[] grandBases= null; @@ -218,12 +194,8 @@ class BaseClassLookup { for (ICPPBase grandBase : grandBases) { if (grandBase instanceof IProblemBinding) continue; + try { - if (data.filterByVisibility && - ClassTypeHelper.isLessVisibility(grandBase.getVisibility(), minVisibility)) { - continue; - } - IBinding grandBaseBinding = grandBase.getBaseClass(); if (!(grandBaseBinding instanceof ICPPClassType)) { // 14.6.2.3 scope is not examined @@ -247,11 +219,8 @@ class BaseClassLookup { } if (!(grandBaseScope instanceof ICPPClassScope)) continue; - - BaseClassLookup baseInfo= lookupInBaseClass(data, (ICPPClassScope) grandBaseScope, - grandBase.isVirtual(), root, - minVisibility == ICPPMember.v_private ? ICPPMember.v_protected : minVisibility, - fileSet, infoMap, depth); + + BaseClassLookup baseInfo= lookupInBaseClass(data, (ICPPClassScope) grandBaseScope, grandBase.isVirtual(), root, fileSet, infoMap, depth); if (baseInfo != null) result.addBase(grandBase.isVirtual(), baseInfo); } catch (DOMException e) { @@ -327,14 +296,14 @@ class BaseClassLookup { } } } - public void collectResultForContentAssist(LookupData data) { if (fCollected) return; fCollected= true; data.foundItems = CPPSemantics.mergePrefixResults((CharArrayObjectMap) data.foundItems, fBindings, true); - for (BaseClassLookup child : fChildren) { + for (int i=0; i= 0) { - visibility = ICPPMember.v_protected; - break; - } - } - } - } - } - } catch (DOMException e) { - visibility = ICPPMember.v_private; // Presume complete visibility if anything goes wrong. - } - return visibility; - } - private static ICPPTemplateScope enclosingTemplateScope(IASTNode node) { IASTNode parent= node.getParent(); if (parent instanceof IASTName) { @@ -1717,9 +1675,9 @@ public class CPPSemantics { } else if (type != temp) { int c = compareByRelevance(data, type, temp); if (c < 0) { - type= temp; + type= temp; } else if (c == 0) { - if (((IType) type).isSameType((IType) temp)) { + if (((IType)type).isSameType((IType) temp)) { if (type instanceof ITypedef && !(temp instanceof ITypedef)) { // Between same types prefer non-typedef. type= temp; @@ -1738,7 +1696,7 @@ public class CPPSemantics { } else { int c = compareByRelevance(data, obj, temp); if (c < 0) { - obj= temp; + obj= temp; } else if (c == 0) { return new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.getFoundBindings()); @@ -2872,19 +2830,18 @@ public class CPPSemantics { LookupData data = createLookupData(name, true); data.contentAssist = true; data.prefixLookup = prefixLookup; - data.filterByVisibility = true; data.foundItems = new CharArrayObjectMap(2); return contentAssistLookup(data, name); } - private static IBinding[] contentAssistLookup(LookupData data, Object start) { + private static IBinding[] contentAssistLookup(LookupData data, Object start) { try { lookup(data, start); } catch (DOMException e) { } CharArrayObjectMap map = (CharArrayObjectMap) data.foundItems; - IBinding[] result = IBinding.EMPTY_BINDING_ARRAY; + IBinding[] result = null; if (!map.isEmpty()) { char[] key = null; Object obj = null; @@ -2893,28 +2850,28 @@ public class CPPSemantics { key = map.keyAt(i); obj = map.get(key); if (obj instanceof IBinding) { - result = ArrayUtil.append(result, (IBinding) obj); + result = (IBinding[]) ArrayUtil.append(IBinding.class, result, obj); } else if (obj instanceof IASTName) { IBinding binding = ((IASTName) obj).resolveBinding(); if (binding != null && !(binding instanceof IProblemBinding)) - result = ArrayUtil.append(result, binding); + result = (IBinding[]) ArrayUtil.append(IBinding.class, result, binding); } else if (obj instanceof Object[]) { Object[] objs = (Object[]) obj; for (int j = 0; j < objs.length && objs[j] != null; j++) { Object item = objs[j]; if (item instanceof IBinding) { - result = ArrayUtil.append(result, (IBinding) item); + result = (IBinding[]) ArrayUtil.append(IBinding.class, result, item); } else if (item instanceof IASTName) { IBinding binding = ((IASTName) item).resolveBinding(); if (binding != null && !(binding instanceof IProblemBinding)) - result = ArrayUtil.append(result, binding); + result = (IBinding[]) ArrayUtil.append(IBinding.class, result, binding); } } } } } - return ArrayUtil.trim(result); + return (IBinding[]) ArrayUtil.trim(IBinding.class, result); } private static IBinding[] standardLookup(LookupData data, Object start) { @@ -2977,7 +2934,7 @@ public class CPPSemantics { return false; } - protected static IBinding resolveUnknownName(IScope scope, ICPPUnknownBinding unknown) { + static protected IBinding resolveUnknownName(IScope scope, ICPPUnknownBinding unknown) { final IASTName unknownName = unknown.getUnknownName(); LookupData data = new LookupData(unknownName); data.checkPointOfDecl= false; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java index 65878a0d261..13aa2e1ba00 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java @@ -872,8 +872,8 @@ public class CPPVisitor extends ASTQueries { } /** - * Returns enclosing function definition, or null if the given node - * is not part of a function definition. + * Searches for an enclosing function definition or declaration, returns + * the name of the function. If you pass the name of a function, it will be returned. */ public static ICPPASTFunctionDefinition findEnclosingFunctionDefinition(IASTNode node) { while (node != null) { @@ -1086,7 +1086,7 @@ public class CPPVisitor extends ASTQueries { } return null; } - + public static class CollectProblemsAction extends CPPASTVisitor { { shouldVisitDeclarations = true; @@ -1872,10 +1872,8 @@ public class CPPVisitor extends ASTQueries { break; if (owner instanceof ICPPFunction) break; - if (owner instanceof ICPPNamespace && n.length() == 0) { - // TODO(sprigogin): Do not ignore anonymous namespaces. + if (owner instanceof ICPPNamespace && n.length() == 0) continue; - } ns = (String[]) ArrayUtil.append(String.class, ns, n); } @@ -1990,36 +1988,12 @@ public class CPPVisitor extends ASTQueries { return null; } - /** - * Searches for the function or class enclosing the given node. May return null. - */ - public static IBinding findEnclosingFunctionOrClass(IASTNode node) { - IASTName name = null; - for (; node != null; node= node.getParent()) { - if (node instanceof IASTFunctionDefinition) { - IASTDeclarator dtor= findInnermostDeclarator(((IASTFunctionDefinition) node).getDeclarator()); - if (dtor != null) { - name= dtor.getName(); - } - break; - } - if (node instanceof IASTCompositeTypeSpecifier) { - name= ((IASTCompositeTypeSpecifier) node).getName(); - break; - } - } - if (name == null) - return null; - - return name.resolveBinding(); - } - public static IBinding findNameOwner(IASTName name, boolean allowFunction) { IASTNode node= name; while (node instanceof IASTName) { if (node instanceof ICPPASTQualifiedName) { IASTName[] qn= ((ICPPASTQualifiedName) node).getNames(); - int i= qn.length; + int i = qn.length; while (--i >= 0) { if (qn[i] == name) { break; @@ -2029,17 +2003,16 @@ public class CPPVisitor extends ASTQueries { break; return qn[i].resolveBinding(); } - name= (IASTName) node; + name = (IASTName) node; node= node.getParent(); } return findDeclarationOwner(node, allowFunction); } - + /** - * Searches for the first class, namespace, or function, if allowFunction - * is true, enclosing the declaration the provided node belongs to and returns - * the binding for it. Returns null, if the declaration is not enclosed by any - * of the above constructs. + * Searches for the first function, class or namespace enclosing the declaration the provided + * node belongs to and returns the binding for it. Returns null, if the declaration + * is not enclosed by any of the above constructs. */ public static IBinding findDeclarationOwner(IASTNode node, boolean allowFunction) { // Search for declaration @@ -2053,7 +2026,7 @@ public class CPPVisitor extends ASTQueries { final IASTNode parent= node.getParent(); if (parent instanceof IASTSimpleDeclaration) { final IASTSimpleDeclaration sdecl = (IASTSimpleDeclaration) parent; - if (sdecl.getDeclarators().length == 0) { + if (sdecl.getDeclarators().length==0) { isNonSimpleElabDecl= false; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java index 119fd751f98..f799f4b3c18 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java @@ -18,7 +18,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression; @@ -42,7 +41,6 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IPointerType; -import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator; @@ -66,7 +64,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier; @@ -86,9 +83,12 @@ public class LookupData { protected CPPASTTranslationUnit tu; public Map> usingDirectives= Collections.emptyMap(); - /** Used to ensure we don't visit things more than once. */ + /* + * Used to ensure we don't visit things more than once + */ public ObjectSet visited= new ObjectSet(1); - + + @SuppressWarnings("unchecked") public ObjectSet associated = ObjectSet.EMPTY_SET; @@ -99,23 +99,17 @@ public class LookupData { public boolean forAssociatedScopes = false; public boolean contentAssist = false; public boolean prefixLookup = false; - /** Don't return private/protected members that are not visible. */ - public boolean filterByVisibility = false; public boolean typesOnly = false; public boolean considerConstructors = false; - /** For lookup of unknown bindings the point of declaration can be reversed. */ - public boolean checkPointOfDecl= true; - /** For field references or qualified names, enclosing template declarations are ignored. */ - public boolean usesEnclosingScope= true; - /** When computing the cost of a method call, treat the first argument as the implied method argument. */ - public boolean firstArgIsImpliedMethodArg = false; + public boolean checkPointOfDecl= true; // for lookup of unknown bindings the point of declaration can be reversed. + public boolean usesEnclosingScope= true; // for field references or qualified names, enclosing template declarations are ignored. + public boolean firstArgIsImpliedMethodArg = false; // when computing the cost of a method call treat the first argument as the implied method argument public boolean ignoreMembers = false; public ICPPClassType skippedScope; public Object foundItems = null; private Object[] functionArgs; private IType[] functionArgTypes; - private IBinding[] visibilityContext; public ProblemBinding problem; public LookupData(IASTName n) { @@ -664,39 +658,4 @@ public class LookupData { } return IBinding.EMPTY_BINDING_ARRAY; } - - /** - * Visibility context is a class or/and a function that determine visibility of private/protected - * members by participating in friendship or class inheritance relationships. If both, a class and - * a function are present in the context, the class has to be local to the function. - */ - public IBinding[] getVisibilityContext() { - if (visibilityContext == null) { - visibilityContext = IBinding.EMPTY_BINDING_ARRAY; - try { - IBinding previous = null; - for (IBinding binding = CPPVisitor.findEnclosingFunctionOrClass(astName); - binding != null; binding = binding.getOwner()) { - if (binding instanceof ICPPMethod || - // Definition of an undeclared method. - binding instanceof IProblemBinding && - ((IProblemBinding) binding).getID() == IProblemBinding.SEMANTIC_MEMBER_DECLARATION_NOT_FOUND) { - continue; - } - if (binding instanceof ICPPClassType && previous instanceof ICPPClassType) { - // Only the innermost class participates in the visibility context. - continue; - } - if (binding instanceof ICPPFunction || binding instanceof ICPPClassType) { - visibilityContext = ArrayUtil.append(visibilityContext, binding); - previous = binding; - } - } - } catch (DOMException e) { - CCorePlugin.log(e); - } - visibilityContext = ArrayUtil.trim(visibilityContext); - } - return visibilityContext; - } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java index ea58755f8f6..231a9ea5c67 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java @@ -13,7 +13,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics; -import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IArrayType; import org.eclipse.cdt.core.dom.ast.IBinding; @@ -27,7 +26,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument; @@ -291,6 +289,7 @@ public class SemanticUtil { return type; } + public static IType[] getSimplifiedTypes(IType[] types) { // Don't create a new array until it's really needed. IType[] result = types; @@ -393,38 +392,4 @@ public class SemanticUtil { } return baseType; } - - /** - * Returns true if two bindings have the same owner. - */ - public static boolean isSameOwner(IBinding owner1, IBinding owner2) { - try { - // Ignore anonymous namespaces - while (owner1 instanceof ICPPNamespace && owner1.getNameCharArray().length == 0) - owner1= owner1.getOwner(); - // Ignore anonymous namespaces - while (owner2 instanceof ICPPNamespace && owner2.getNameCharArray().length == 0) - owner2= owner2.getOwner(); - - if (owner1 == null) - return owner2 == null; - if (owner2 == null) - return false; - - if (owner1 instanceof IType) { - if (owner2 instanceof IType) { - return ((IType) owner1).isSameType((IType) owner2); - } - } else if (owner1 instanceof ICPPNamespace) { - if (owner2 instanceof ICPPNamespace) { - if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray())) - return false; - return isSameOwner(owner1.getOwner(), owner2.getOwner()); - } - } - } catch (DOMException e) { - CCorePlugin.log(e); - } - return false; - } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBinding.java index 46ffae81f15..f9cb5c01a3a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBinding.java @@ -17,8 +17,12 @@ import java.util.List; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ast.DOMException; +import org.eclipse.cdt.core.dom.ast.IBinding; +import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance; +import org.eclipse.cdt.core.parser.util.CharArrayUtils; import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage; import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; @@ -27,7 +31,7 @@ import org.eclipse.core.runtime.CoreException; /** * Mirrors type-hierarchy from DOM interfaces */ -public abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding { +abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding { @SuppressWarnings("hiding") protected static final int RECORD_SIZE= PDOMBinding.RECORD_SIZE + 0; @@ -35,11 +39,44 @@ public abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding public PDOMCPPBinding(PDOMLinkage linkage, long record) { super(linkage, record); } - public PDOMCPPBinding(PDOMLinkage linkage, PDOMNode parent, char[] name) throws CoreException { super(linkage, parent, name); } + protected boolean isSameOwner(IBinding owner1, IBinding owner2) { + try { + // ignore unnamed namespaces + while(owner1 instanceof ICPPNamespace && owner1.getNameCharArray().length == 0) + owner1= owner1.getOwner(); + // ignore unnamed namespaces + while(owner2 instanceof ICPPNamespace && owner2.getNameCharArray().length == 0) + owner2= owner2.getOwner(); + + if (owner1 == null) + return owner2 == null; + if (owner2 == null) + return false; + + if (owner1 instanceof IType) { + if (owner2 instanceof IType) { + return ((IType) owner1).isSameType((IType) owner2); + } + return false; + } + if (owner1 instanceof ICPPNamespace) { + if (owner2 instanceof ICPPNamespace) { + if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray())) + return false; + return isSameOwner(owner1.getOwner(), owner2.getOwner()); + } + return false; + } + } catch (DOMException e) { + CCorePlugin.log(e); + } + return false; + } + final public char[][] getQualifiedNameCharArray() throws DOMException { List result = new ArrayList(); try { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java index 8a17263bb9a..45e64de554d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java @@ -37,7 +37,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredClassInstance; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants; import org.eclipse.cdt.internal.core.pdom.db.Database; import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage; @@ -261,7 +260,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) return false; - return SemanticUtil.isSameOwner(getOwner(), ctype.getOwner()); + return isSameOwner(getOwner(), ctype.getOwner()); } catch (DOMException e) { return false; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java index 78a9033a3e1..d2402aaf044 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java @@ -36,7 +36,6 @@ import org.eclipse.cdt.core.parser.util.CharArrayUtils; import org.eclipse.cdt.internal.core.Util; import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding; import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants; import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList; import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner; @@ -269,7 +268,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) return false; - return SemanticUtil.isSameOwner(getOwner(), ctype.getOwner()); + return isSameOwner(getOwner(), ctype.getOwner()); } catch (DOMException e) { CCorePlugin.log(e); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java index f78a9fc646f..43daf76a7e5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java @@ -22,7 +22,6 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.parser.util.CharArrayUtils; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants; import org.eclipse.cdt.internal.core.index.IIndexType; import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; @@ -119,7 +118,7 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IEnumeration, IIndexT if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) return false; - return SemanticUtil.isSameOwner(getOwner(), etype.getOwner()); + return isSameOwner(getOwner(), etype.getOwner()); } } catch (DOMException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_AnonymousTypes.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_AnonymousTypes.java index e6080baf10e..9ba7cfd6e8c 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_AnonymousTypes.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_AnonymousTypes.java @@ -14,7 +14,7 @@ import junit.framework.Test; import junit.framework.TestSuite; /** - * Test that anonymous types are not returned as possibilities. + * Test that anonymous types are not returned as possibilites */ public class CompletionTest_AnonymousTypes extends CompletionProposalsBaseTest{ private final String fileName = "CompletionTestStart40.cpp"; diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java index b3ea0580088..cb8a5406f06 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java @@ -10,7 +10,6 @@ * Bryan Wilkinson (QNX) * Markus Schorn (Wind River Systems) * IBM Corporation - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.ui.tests.text.contentassist2; @@ -36,6 +35,7 @@ import org.eclipse.cdt.core.testplugin.util.TestSourceReader; * @since 4.0 */ public class CompletionTests extends AbstractContentAssistTest { + private static final String HEADER_FILE_NAME = "CompletionTest.h"; private static final String SOURCE_FILE_NAME = "CompletionTest.cpp"; private static final String CURSOR_LOCATION_TAG = "/*cursor*/"; @@ -86,8 +86,6 @@ public class CompletionTests extends AbstractContentAssistTest { // C1* m12(); // C1* m13(); // - //protected: - // void m1protected(); //private: // void m1private(); //}; @@ -104,12 +102,8 @@ public class CompletionTests extends AbstractContentAssistTest { // C2* m23(); // C1* operator()(int x); // - //protected: - // void m2protected(); //private: // void m2private(); - // friend void _friend_function(C3* x); - // friend class _friend_class; //}; //typedef C2 T2; // @@ -123,8 +117,6 @@ public class CompletionTests extends AbstractContentAssistTest { // C3* m13(); // // template T tConvert(); - //protected: - // void m3protected(); //private: // void m3private(); //}; @@ -223,67 +215,87 @@ public class CompletionTests extends AbstractContentAssistTest { } //void gfunc() {C1 v; v.m/*cursor*/ - public void testLocalVariable() throws Exception { + public void _testLocalVariable() throws Exception { + // fails because of additional m1private(void) + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172305 final String[] expected= { "m123(void)", "m12(void)", "m13(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } - //void gfunc() {C1 v; v.fMySelf->m/*cursor*/ - public void testLocalVariable_MemberVariable() throws Exception { + //void gfunc() {C1 v; v.fMySelf.m/*cursor*/ + public void _testLocalVariable_MemberVariable() throws Exception { + // fails because of additional m1private(void) + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172305 final String[] expected= { "m123(void)", "m12(void)", "m13(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } - //void gfunc() {C1 v; v.m12()->m/*cursor*/ - public void testLocalVariable_MemberFunction() throws Exception { + //void gfunc() {C1 v; v.m12().m/*cursor*/ + public void _testLocalVariable_MemberFunction() throws Exception { + // fails because of additional m1private(void) + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172305 final String[] expected= { "m123(void)", "m12(void)", "m13(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } - //void gfunc() {gfC1()->m/*cursor*/ - public void testGlobalFunction() throws Exception { + //void gfunc() {gfC1().m/*cursor*/ + public void _testGlobalFunction() throws Exception { + // fails because of additional m1private(void) + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172305 final String[] expected= { "m123(void)", "m12(void)", "m13(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void C1::self() {m/*cursor*/ public void testOwnMember() throws Exception { final String[] expected= { - "m123(void)", "m12(void)", "m13(void)", "m1private(void)", "m1protected(void)" + "m123(void)", "m12(void)", "m13(void)", "m1private(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void C1::self() {this->m/*cursor*/ public void testOwnMemberViaThis() throws Exception { final String[] expected= { - "m123(void)", "m12(void)", "m13(void)", "m1private(void)", "m1protected(void)" + "m123(void)", "m12(void)", "m13(void)", "m1private(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } - //void gfunc() {try{int bla;}catch(C1 v) {v.fMySelf->m/*cursor*/ - public void testCatchBlock1() throws Exception { + //void gfunc() {try{int bla;}catch(C1 v) {v.fMySelf.m/*cursor*/ + public void _testCatchBlock1() throws Exception { + // fails because of additional m1private(void) + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172305 final String[] expected= { "m123(void)", "m12(void)", "m13(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } - //void gfunc() {try{int bla;}catch(C2 c){} catch(C1 v) {v.fMySelf->m/*cursor*/ - public void testCatchBlock2() throws Exception { + //void gfunc() {try{int bla;}catch(C2 c){} catch(C1 v) {v.fMySelf.m/*cursor*/ + public void _testCatchBlock2() throws Exception { + // fails because of additional m1private(void) + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172305 final String[] expected= { "m123(void)", "m12(void)", "m13(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {gC/*cursor*/ @@ -291,7 +303,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "gC1", "gC2" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void C1::f() {gC/*cursor*/ @@ -299,7 +312,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "gC1", "gC2" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C2* cLocal1; while(true) {C1* cLocal2; cL/*cursor*/ @@ -307,7 +321,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "cLocal1", "cLocal2" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void C2::f() {C2* cLocal1; while(true) {C1* cLocal2; cL/*cursor*/ @@ -315,7 +330,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "cLocal1", "cLocal2" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C2* cLocal1; cLocal1->f/*cursor*/ @@ -323,7 +339,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "fMySelf" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void C2::f() {while(true) {f/*cursor*/ @@ -331,7 +348,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "fMySelf" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {gf/*cursor*/ @@ -339,7 +357,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "gfC1(void)", "gfC2(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void C3::f() {gf/*cursor*/ @@ -347,24 +366,30 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "gfC1(void)", "gfC2(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } - //void f() {C1* l1; l1->m/*cursor*/ - public void testMethods_GlobalScope() throws Exception { + //void f() {C1* l1; l1.m/*cursor*/ + public void _testMethods_GlobalScope() throws Exception { + // fails because of additional m1private(void) + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172305 final String[] expected= { "m123(void)", "m12(void)", "m13(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void C3::f() {m/*cursor*/ - public void testMethods_MethodScope() throws Exception { + public void _testMethods_MethodScope() throws Exception { + // fails because of additional m1private(void) + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172305 final String[] expected= { - "m123(void)", "m12(void)", "m13(void)", "m23(void)", "m1protected(void)", - "m2protected(void)", "m3private(void)", "m3protected(void)" + "m123(void)", "m12(void)", "m13(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C/*cursor*/ @@ -372,49 +397,17 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "C1", "C2", "C3" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } - //class _friend_class { C3* x; void m() {x->m/*cursor*/ - public void testTypes_FriendClass() throws Exception { - final String[] expected= { - "m123(void)", "m12(void)", "m13(void)", "m23(void)", "m1protected(void)", - "m2protected(void)", "m2private(void)" - }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); - } - - //namespace ns { class _friend_class { C3* x; void m() {x->m/*cursor*/ // Not a friend due to namespace - public void testTypes_FakeFriendClass() throws Exception { - final String[] expected= { - "m123(void)", "m12(void)", "m13(void)", "m23(void)" - }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); - } - - //void _friend_function(C3* x) { x->m/*cursor*/ - public void testTypes_FriendFunction() throws Exception { - final String[] expected= { - "m123(void)", "m12(void)", "m13(void)", "m23(void)", "m1protected(void)", - "m2protected(void)", "m2private(void)" - }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); - } - - //void _friend_function(C2* x) { x->m/*cursor*/ // Not a friend due to parameter type mismatch - public void testTypes_FakeFriendFunction() throws Exception { - final String[] expected= { - "m123(void)", "m12(void)", "m13(void)", "m23(void)" - }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); - } - //void C2::f() {T/*cursor*/ public void testTypes_MethodScope() throws Exception { final String[] expected= { "T1", "T2", "T3", "TClass" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //namespace ns {void nsfunc(){C/*cursor*/ @@ -422,7 +415,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "C1", "C2", "C3", "CNS" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //namespace ns {void gfunc(){::C/*cursor*/ @@ -430,7 +424,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "C1", "C2", "C3" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {e/*cursor*/ @@ -438,7 +433,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "e11", "e12", "E1" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void C3::f() {e/*cursor*/ @@ -446,7 +442,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "e11", "e12", "e21", "e22", "E1", "E2" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C3* l1; l1->C/*cursor*/ @@ -455,7 +452,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "C3", "C2", "C1" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C2* l1; l1->C/*cursor*/ @@ -464,7 +462,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "C2", "C1" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C3* l1; l1->C3::fMySelf->iam/*cursor*/ @@ -473,7 +472,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam3(void)", "iam2(void)", "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C3* l1; l1->C2::fMySelf->iam/*cursor*/ @@ -482,7 +482,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam2(void)", "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C3* l1; l1->C1::fMySelf->iam/*cursor*/ @@ -490,7 +491,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C3* l1; l1->T3::fMySelf->iam/*cursor*/ @@ -499,7 +501,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam3(void)", "iam2(void)", "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C3* l1; l1->T2::fMySelf->iam/*cursor*/ @@ -508,7 +511,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam2(void)", "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C3* l1; l1->T1::fMySelf->iam/*cursor*/ @@ -516,7 +520,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1().iam/*cursor*/ @@ -524,7 +529,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1 c; (&c)->iam/*cursor*/ @@ -532,7 +538,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1* c; (*c).iam/*cursor*/ @@ -540,7 +547,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1** c; (**c).iam/*cursor*/ @@ -548,14 +556,16 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1** c; (*c)->iam/*cursor*/ public void testDereferencingOperator3() throws Exception { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1* c; c[0].iam/*cursor*/ @@ -563,28 +573,32 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1** c; c[0][1].iam/*cursor*/ public void testArrayAccessOperator2() throws Exception { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1** c; c[0]->iam/*cursor*/ public void testArrayAccessOperator3() throws Exception { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1* c; (&c[0])->iam/*cursor*/ public void testArrayAccessOperator4() throws Exception { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {void* c; ((C1*)c)->iam/*cursor*/ @@ -592,14 +606,16 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void g(int a) {}; void f() {void* c; g(((C1*)c)->iam/*cursor*/ public void testCasts2() throws Exception { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1* c; c++->iam/*cursor*/ @@ -607,35 +623,40 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1* c; (*++c).iam/*cursor*/ public void testPointerArithmetic2() throws Exception { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1* c; c--->iam/*cursor*/ public void testPointerArithmetic3() throws Exception { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1 c; (&c+1)->iam/*cursor*/ public void testPointerArithmetic4() throws Exception { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {C1 c; (&c-1)->iam/*cursor*/ public void testPointerArithmetic5() throws Exception { final String[] expected= { "iam1(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void f() {int localVar=0; if (*cond && somefunc(&local/*cursor*/ @@ -643,7 +664,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "localVar" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //int a[] = {1,2}; void f(int _0306_b) {_0306_b/*cursor*/ @@ -651,14 +673,16 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "_0306_b" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //int a[] = {1,2}; void f(int b) {int _0306_b[] = {2,3}; _0306_b/*cursor*/ public void testCuttingInput2() throws Exception { final String[] expected= { "_0306_b" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //enum EnumType function() {int _031209_v; _031209/*cursor*/ @@ -666,7 +690,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "_031209_v" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //namespace ns {void x() {NSCO/*cursor*/ @@ -674,14 +699,16 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "NSCONST" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void ns::CNS::mcns(){NSCO/*cursor*/ public void testAccessToNamespaceFromClassMember2() throws Exception { final String[] expected= { "NSCONST" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //#i/*cursor*/ @@ -689,7 +716,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "#if", "#ifdef", "#ifndef", "#include" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //# d/*cursor*/ @@ -706,7 +734,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "defined" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void gfunc(){TClass t(0); t.a/*cursor*/ @@ -715,7 +744,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "add(int)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void gfunc(){C3 c3; c3.t/*cursor*/ @@ -724,7 +754,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "tConvert(void)" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //using namespace ns;void gfunc(){NSC/*cursor*/ @@ -732,7 +763,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "NSCONST" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_ID_STRINGS); } //void gfunc(){n/*cursor*/ @@ -740,7 +772,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "ns::" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_REP_STRINGS); } //using namespace /*cursor*/ @@ -748,7 +781,8 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "ns" }; - assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); + assertCompletionResults(fCursorOffset, expected, + AbstractContentAssistTest.COMPARE_REP_STRINGS); } //// to_be_replaced_