diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java index 1c695bfdfa5..a58b6da1961 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java @@ -516,7 +516,7 @@ public class IndexUpdateTests extends IndexTestBase { fIndex.acquireReadLock(); try { final char[] nchars = name.toCharArray(); - final String refType = name + "&"; + final String refType = name + " &"; final String constRefType = "const " + refType; IIndexBinding[] ctors= fIndex.findBindings(new char[][]{nchars, nchars}, IndexFilter.ALL_DECLARED_OR_IMPLICIT, NPM); 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 f3c39447e53..bc46e01cca7 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 @@ -438,25 +438,22 @@ public class ASTTypeUtil { // pop all of the types off of the stack, and build the string representation while doing so for (int j = types.length - 1; j >= 0; j--) { + if (types[j] != null && result.length() > 0) + result.append(SPACE); // only add a space if this is not the first type being added + if (types[j] != null) { if (j > 0 && types[j - 1] instanceof IQualifierType) { - smartAppend(result, getTypeString(types[j - 1])); - smartAppend(result, getTypeString(types[j])); + result.append(getTypeString(types[j - 1])); + result.append(SPACE); + result.append(getTypeString(types[j])); --j; } else { - smartAppend(result, getTypeString(types[j])); + result.append(getTypeString(types[j])); } } } - - return result.toString(); - } - private static void smartAppend(StringBuilder buf, String str) { - if (buf.length() > 0 && str.length() > 0 && "&*".indexOf(str.charAt(0)) < 0) { //$NON-NLS-1$ - buf.append(SPACE); - } - buf.append(str); + return result.toString(); } /**