diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ArrayUtilsTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ArrayUtilsTest.java index 707785be1e5..0e3f6c0be87 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ArrayUtilsTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ArrayUtilsTest.java @@ -30,9 +30,9 @@ public class ArrayUtilsTest extends TestCase { assertEquals(o2, array[1]); assertEquals(o3, array[2]); - array= ArrayUtil.append(Object.class, null, 0, o1); - array= ArrayUtil.append(Object.class, array, 1, o2); - array= ArrayUtil.append(Object.class, array, 2, o3); + array= ArrayUtil.appendAt(Object.class, null, 0, o1); + array= ArrayUtil.appendAt(Object.class, array, 1, o2); + array= ArrayUtil.appendAt(Object.class, array, 2, o3); assertEquals(o1, array[0]); assertEquals(o2, array[1]); assertEquals(o3, array[2]); diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters index 10c87060341..bf5b479e6bf 100644 --- a/core/org.eclipse.cdt.core/.settings/.api_filters +++ b/core/org.eclipse.cdt.core/.settings/.api_filters @@ -1,17 +1,55 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ArrayUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ArrayUtil.java index 029c609b77e..5bd2d9863ba 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ArrayUtil.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ArrayUtil.java @@ -16,6 +16,8 @@ package org.eclipse.cdt.core.parser.util; import java.lang.reflect.Array; +import org.eclipse.core.runtime.Assert; + /** * @noextend This class is not intended to be subclassed by clients. */ @@ -28,11 +30,12 @@ public abstract class ArrayUtil { * If the array is null or not large enough, a larger one is allocated, using * the given class object. */ - static public Object[] append(Class c, Object[] array, Object obj) { + @SuppressWarnings("unchecked") + static public T[] append(Class c, T[] array, T obj) { if (obj == null) return array; if (array == null || array.length == 0) { - array = (Object[]) Array.newInstance(c, DEFAULT_LENGTH); + array = (T[]) Array.newInstance(c, DEFAULT_LENGTH); array[0] = obj; return array; } @@ -43,7 +46,7 @@ public abstract class ArrayUtil { return array; } - Object[] temp = (Object[]) Array.newInstance(c, Math.max(array.length * 2, DEFAULT_LENGTH)); + T[] temp = (T[]) Array.newInstance(c, Math.max(array.length * 2, DEFAULT_LENGTH)); System.arraycopy(array, 0, temp, 0, array.length); temp[array.length] = obj; return temp; @@ -69,38 +72,12 @@ public abstract class ArrayUtil { return haveNull ? right + 1 : -1; } - /** - * Assumes that array contains nulls at the end, only. - * Appends object using the current length of the array. - * @since 4.0 - */ - static public Object[] append(Class c, Object[] array, int currentLength, Object obj) { - if (obj == null) - return array; - if (array == null || array.length == 0) { - array = (Object[]) Array.newInstance(c, DEFAULT_LENGTH); - array[0] = obj; - return array; - } - - if (currentLength < array.length) { - assert array[currentLength] == null; - assert currentLength == 0 || array[currentLength - 1] != null; - array[currentLength]= obj; - return array; - } - - Object[] temp = (Object[]) Array.newInstance(c, array.length * 2); - System.arraycopy(array, 0, temp, 0, array.length); - temp[array.length] = obj; - return temp; - } - /** * Assumes that array contains nulls at the end, only. * Appends element after the last non-null element. * If the array is not large enough, a larger one is allocated. - * Null array is supported for backward compatibility only and only when T is Object. + * Null array is supported for backward compatibility only and only when T is + * Object. */ @SuppressWarnings("unchecked") static public T[] append(T[] array, T obj) { @@ -127,12 +104,41 @@ public abstract class ArrayUtil { } /** - * Type safe version of {@link #append(Class, Object[], int, Object)} + * @deprecated Use {@link #appendAt(Class, Object[], int, Object)} instead. + * @since 4.0 + */ + @Deprecated + @SuppressWarnings("unchecked") + static public Object[] append(Class c, Object[] array, int currentLength, Object obj) { + return appendAt((Class) c, array, currentLength, obj); + } + + /** + * Assumes that array contains nulls at the end, only. + * Appends object using the current length of the array. * @since 5.1 */ @SuppressWarnings("unchecked") static public T[] appendAt(Class c, T[] array, int currentLength, T obj) { - return (T[]) append(c, array, currentLength, obj); + if (obj == null) + return array; + if (array == null || array.length == 0) { + array = (T[]) Array.newInstance(c, DEFAULT_LENGTH); + array[0] = obj; + return array; + } + + if (currentLength < array.length) { + Assert.isTrue(array[currentLength] == null); + Assert.isTrue(currentLength == 0 || array[currentLength - 1] != null); + array[currentLength]= obj; + return array; + } + + T[] temp = (T[]) Array.newInstance(c, array.length * 2); + System.arraycopy(array, 0, temp, 0, array.length); + temp[array.length] = obj; + return temp; } /** @@ -147,9 +153,10 @@ public abstract class ArrayUtil { * @param array the array to be trimmed * @param forceNew */ - static public Object[] trim(Class c, Object[] array, boolean forceNew) { + @SuppressWarnings("unchecked") + static public T[] trim(Class c, T[] array, boolean forceNew) { if (array == null) - return (Object[]) Array.newInstance(c, 0); + return (T[]) Array.newInstance(c, 0); int i = array.length; if (i == 0 || array[i - 1] != null) { @@ -158,15 +165,15 @@ public abstract class ArrayUtil { } } else { i= findFirstNull(array); - assert i >= 0; + Assert.isTrue(i >= 0); } - Object[] temp = (Object[]) Array.newInstance(c, i); + T[] temp = (T[]) Array.newInstance(c, i); System.arraycopy(array, 0, temp, 0, i); return temp; } - public static Object[] trim(Class c, Object[] array) { + public static T[] trim(Class c, T[] array) { return trim(c, array, false); } @@ -190,7 +197,7 @@ public abstract class ArrayUtil { } } else { i= findFirstNull(array); - assert i >= 0; + Assert.isTrue(i >= 0); } T[] temp = (T[]) Array.newInstance(array.getClass().getComponentType(), i); @@ -219,7 +226,8 @@ public abstract class ArrayUtil { * @param source The source array. May not be null. * @return The concatenated array, which may be the same as the first parameter. */ - public static Object[] addAll(Class c, Object[] dest, Object[] source) { + @SuppressWarnings("unchecked") + public static T[] addAll(Class c, T[] dest, T[] source) { if (source == null || source.length == 0) return dest; @@ -232,7 +240,7 @@ public abstract class ArrayUtil { } if (dest == null || dest.length == 0) { - dest = (Object[]) Array.newInstance(c, numToAdd); + dest = (T[]) Array.newInstance(c, numToAdd); System.arraycopy(source, 0, dest, 0, numToAdd); return dest; } @@ -246,7 +254,7 @@ public abstract class ArrayUtil { System.arraycopy(source, 0, dest, firstFree, numToAdd); return dest; } - Object[] temp = (Object[]) Array.newInstance(c, firstFree + numToAdd); + T[] temp = (T[]) Array.newInstance(c, firstFree + numToAdd); System.arraycopy(dest, 0, temp, 0, firstFree); System.arraycopy(source, 0, temp, firstFree, numToAdd); return temp; @@ -302,21 +310,22 @@ public abstract class ArrayUtil { * object identity. * @param array the array to search * @param obj the object to search for - * @return true if the specified array contains the specified object, or the specified array is null + * @return true if the specified array contains the specified object, or + * the specified array is null */ - public static boolean contains(Object[] array, Object obj) { + public static boolean contains(T[] array, T obj) { return indexOf(array, obj) >= 0; } /** - * Returns the index into the specified array of the specified object, or -1 if the array does not - * contain the object, or if the array is null. Comparison is by object identity. + * Returns the index into the specified array of the specified object, or -1 if the array does + * not contain the object, or if the array is null. Comparison is by object identity. * @param array the array to search * @param obj the object to search for - * @return the index into the specified array of the specified object, or -1 if the array does not - * contain the object, or if the array is null + * @return the index into the specified array of the specified object, or -1 if the array does + * not contain the object, or if the array is null */ - public static int indexOf(Object[] array, Object obj) { + public static int indexOf(T[] array, T obj) { int result = -1; if (array != null) { for (int i = 0; i < array.length; i++) { @@ -333,22 +342,23 @@ public abstract class ArrayUtil { * object identity. * @param array the array to search * @param obj the object to search for - * @return true if the specified array contains the specified object, or the specified array is null + * @return true if the specified array contains the specified object, or the specified array is + * null */ - public static boolean containsEqual(Object[] array, Object obj) { + public static boolean containsEqual(T[] array, T obj) { return indexOfEqual(array, obj) != -1; } /** * Assumes that array contains nulls at the end, only. - * Returns the index into the specified array of the specified object, or -1 if the array does not - * contain the object, or if the array is null. Comparison is by equals(). + * Returns the index into the specified array of the specified object, or -1 if the array does + * not contain the object, or if the array is null. Comparison is by equals(). * @param comments the array to search * @param comment the object to search for - * @return the index into the specified array of the specified object, or -1 if the array does not - * contain an equal object, or if the array is null + * @return the index into the specified array of the specified object, or -1 if the array does + * not contain an equal object, or if the array is null */ - public static int indexOfEqual(Object[] comments, Object comment) { + public static int indexOfEqual(T[] comments, T comment) { int result = -1; if (comments != null) { for (int i= 0; (i < comments.length) && (comments[i] != null); i++) { @@ -368,9 +378,10 @@ public abstract class ArrayUtil { * * If there are no nulls in the original array then the original array is returned. */ - public static Object[] removeNulls(Class c, Object[] array) { + @SuppressWarnings("unchecked") + public static T[] removeNulls(Class c, T[] array) { if (array == null) - return (Object[]) Array.newInstance(c, 0); + return (T[]) Array.newInstance(c, 0); int i; int validEntries = 0; @@ -382,7 +393,7 @@ public abstract class ArrayUtil { if (array.length == validEntries) return array; - Object[] newArray = (Object[]) Array.newInstance(c, validEntries); + T[] newArray = (T[]) Array.newInstance(c, validEntries); int j = 0; for (i = 0; i < array.length; i++) { if (array[i] != null) @@ -404,9 +415,8 @@ public abstract class ArrayUtil { */ @SuppressWarnings("unchecked") public static T[] removeNulls(T[] array) { - int i; int validEntries = 0; - for (i = 0; i < array.length; i++) { + for (int i = 0; i < array.length; i++) { if (array[i] != null) validEntries++; } @@ -416,7 +426,7 @@ public abstract class ArrayUtil { T[] newArray = (T[]) Array.newInstance(array.getClass().getComponentType(), validEntries); int j = 0; - for (i = 0; i < array.length; i++) { + for (int i = 0; i < array.length; i++) { if (array[i] != null) newArray[j++] = array[i]; } @@ -425,40 +435,45 @@ public abstract class ArrayUtil { } /** - * To improve performance, this method should be used instead of ArrayUtil#removeNulls(Class, Object[]) when - * all of the non-null elements in the array are grouped together at the beginning of the array - * and all of the nulls are at the end of the array. - * The position of the last non-null element in the array must also be known. + * @deprecated Use {@link #trimAt(Class, Object[], int)} instead */ + @SuppressWarnings("unchecked") + @Deprecated public static Object[] removeNullsAfter(Class c, Object[] array, int index) { + return trimAt((Class) c, array, index); + } + + /** + * To improve performance, this method should be used instead of + * {@link #removeNulls(Class, Object[])} when all of the non-null elements in + * the array are grouped together at the beginning of the array and all of the nulls are at + * the end of the array. The position of the last non-null element in the array must also + * be known. + * + * @since 5.1 + */ + @SuppressWarnings("unchecked") + public static T[] trimAt(Class c, T[] array, int index) { final int newLen= index + 1; if (array != null && array.length == newLen) return array; - Object[] newArray = (Object[]) Array.newInstance(c, newLen); + T[] newArray = (T[]) Array.newInstance(c, newLen); if (array != null && newLen > 0) System.arraycopy(array, 0, newArray, 0, newLen); return newArray; } - /** - * Type safe version of {@link #removeNullsAfter(Class, Object[], int)} - * @since 5.1 - */ - @SuppressWarnings("unchecked") - public static T[] trimAt(Class c, T[] array, int index) { - return (T[]) removeNullsAfter(c, array, index); - } - /** * Inserts the obj at the beginning of the array, shifting the whole thing one index * Assumes that array contains nulls at the end, only. */ - public static Object[] prepend(Class c, Object[] array, Object obj) { + @SuppressWarnings("unchecked") + public static T[] prepend(Class c, T[] array, T obj) { if (obj == null) return array; if (array == null || array.length == 0) { - array = (Object[]) Array.newInstance(c, DEFAULT_LENGTH); + array = (T[]) Array.newInstance(c, DEFAULT_LENGTH); array[0] = obj; return array; } @@ -468,7 +483,7 @@ public abstract class ArrayUtil { System.arraycopy(array, 0, array, 1, i); array[0] = obj; } else { - Object[] temp = (Object[]) Array.newInstance(c, array.length * 2); + T[] temp = (T[]) Array.newInstance(c, array.length * 2); System.arraycopy(array, 0, temp, 1, array.length); temp[0] = obj; array = temp; @@ -484,7 +499,7 @@ public abstract class ArrayUtil { * @since 5.2 */ public static T[] prepend(T[] array, T obj) { - assert array != null; + Assert.isNotNull(array); if (obj == null) return array; @@ -517,7 +532,7 @@ public abstract class ArrayUtil { * Removes first occurrence of element in array and moves objects behind up front. * @since 4.0 */ - public static void remove(Object[] array, Object element) { + public static void remove(T[] array, T element) { if (array != null) { for (int i = 0; i < array.length; i++) { if (element == array[i]) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousNode.java index 3f56c3c2d08..de919e198f2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousNode.java @@ -45,7 +45,7 @@ public abstract class ASTAmbiguousNode extends ASTNode { } public IASTName[] getNames() { - names = (IASTName[]) ArrayUtil.removeNullsAfter(IASTName.class, names, namesPos); + names = (IASTName[]) ArrayUtil.trimAt(IASTName.class, names, namesPos); return names; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTQueries.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTQueries.java index 81679d19643..fa2fb6e9a8c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTQueries.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTQueries.java @@ -137,7 +137,7 @@ public class ASTQueries { active[j++]= d; } } - active= (IASTDeclaration[]) ArrayUtil.removeNullsAfter(IASTDeclaration.class, active, j-1); + active= (IASTDeclaration[]) ArrayUtil.trimAt(IASTDeclaration.class, active, j-1); } return active; } 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 61fe996efaf..3eb3a5561f6 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 @@ -91,7 +91,7 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat if (d != null) { d.setParent(this); d.setPropertyInParent(OWNED_DECLARATION); - fAllDeclarations = (IASTDeclaration[]) ArrayUtil.append(IASTDeclaration.class, + fAllDeclarations = (IASTDeclaration[]) ArrayUtil.appendAt(IASTDeclaration.class, fAllDeclarations, ++fLastDeclaration, d); fActiveDeclarations= null; } @@ -110,7 +110,7 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat @Override public final IASTDeclaration[] getDeclarations(boolean includeInactive) { if (includeInactive) { - fAllDeclarations= (IASTDeclaration[]) ArrayUtil.removeNullsAfter(IASTDeclaration.class, + fAllDeclarations= (IASTDeclaration[]) ArrayUtil.trimAt(IASTDeclaration.class, fAllDeclarations, fLastDeclaration); return fAllDeclarations; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousDeclarator.java index 5bccbb1cd58..aeac8d8dedd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousDeclarator.java @@ -54,14 +54,14 @@ public class CASTAmbiguousDeclarator extends ASTAmbiguousNode implements IASTAmb public void addDeclarator(IASTDeclarator d) { assertNotFrozen(); if (d != null) { - dtors = (IASTDeclarator[]) ArrayUtil.append(IASTDeclarator.class, dtors, ++dtorPos, d); + dtors = (IASTDeclarator[]) ArrayUtil.appendAt(IASTDeclarator.class, dtors, ++dtorPos, d); d.setParent(this); d.setPropertyInParent(SUBDECLARATOR); } } public IASTDeclarator[] getDeclarators() { - dtors = (IASTDeclarator[]) ArrayUtil.removeNullsAfter(IASTDeclarator.class, dtors, dtorPos ); + dtors = (IASTDeclarator[]) ArrayUtil.trimAt(IASTDeclarator.class, dtors, dtorPos ); return dtors; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousExpression.java index 7e4b98eadbd..6a98477782b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousExpression.java @@ -31,14 +31,14 @@ public class CASTAmbiguousExpression extends ASTAmbiguousNode implements IASTAmb public void addExpression(IASTExpression e) { assertNotFrozen(); if (e != null) { - expressions = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, expressions, ++expressionsPos, e ); + expressions = (IASTExpression[]) ArrayUtil.appendAt( IASTExpression.class, expressions, ++expressionsPos, e ); e.setParent(this); e.setPropertyInParent(SUBEXPRESSION); } } public IASTExpression[] getExpressions() { - expressions = (IASTExpression[]) ArrayUtil.removeNullsAfter( IASTExpression.class, expressions, expressionsPos ); + expressions = (IASTExpression[]) ArrayUtil.trimAt( IASTExpression.class, expressions, expressionsPos ); return expressions; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousParameterDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousParameterDeclaration.java index 9c457577c21..0b6133f6c73 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousParameterDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousParameterDeclaration.java @@ -41,7 +41,7 @@ public class CASTAmbiguousParameterDeclaration extends ASTAmbiguousNode implemen public void addParameterDeclaration(IASTParameterDeclaration d) { assertNotFrozen(); if (d != null) { - paramDecls = (IASTParameterDeclaration[]) ArrayUtil.append(IASTParameterDeclaration.class, paramDecls, ++declPos, d); + paramDecls = (IASTParameterDeclaration[]) ArrayUtil.appendAt(IASTParameterDeclaration.class, paramDecls, ++declPos, d); d.setParent(this); d.setPropertyInParent(SUBDECLARATION); } @@ -57,7 +57,7 @@ public class CASTAmbiguousParameterDeclaration extends ASTAmbiguousNode implemen } public IASTParameterDeclaration[] getParameterDeclarations() { - paramDecls = (IASTParameterDeclaration[]) ArrayUtil.removeNullsAfter(IASTParameterDeclaration.class, paramDecls, declPos ); + paramDecls = (IASTParameterDeclaration[]) ArrayUtil.trimAt(IASTParameterDeclaration.class, paramDecls, declPos ); return paramDecls; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousStatement.java index 6bc13e2de8f..770f8175087 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguousStatement.java @@ -73,7 +73,7 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi public void addStatement(IASTStatement s) { assertNotFrozen(); if (s != null) { - stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, ++stmtsPos, s ); + stmts = (IASTStatement[]) ArrayUtil.appendAt( IASTStatement.class, stmts, ++stmtsPos, s ); s.setParent(this); s.setPropertyInParent(STATEMENT); } @@ -81,7 +81,7 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi @Override public IASTStatement[] getStatements() { - stmts = (IASTStatement[]) ArrayUtil.removeNullsAfter( IASTStatement.class, stmts, stmtsPos ); + stmts = (IASTStatement[]) ArrayUtil.trimAt( IASTStatement.class, stmts, stmtsPos ); return stmts; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDeclarator.java index 6c64668ab1e..93a9726c953 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDeclarator.java @@ -57,7 +57,7 @@ public class CASTArrayDeclarator extends CASTDeclarator implements IASTArrayDecl public IASTArrayModifier[] getArrayModifiers() { if (arrayMods == null) return IASTArrayModifier.EMPTY_ARRAY; - arrayMods = (IASTArrayModifier[]) ArrayUtil.removeNullsAfter(IASTArrayModifier.class, + arrayMods = (IASTArrayModifier[]) ArrayUtil.trimAt(IASTArrayModifier.class, arrayMods, arrayModsPos); return arrayMods; @@ -69,7 +69,7 @@ public class CASTArrayDeclarator extends CASTDeclarator implements IASTArrayDecl if (arrayModifier != null) { arrayModifier.setParent(this); arrayModifier.setPropertyInParent(ARRAY_MODIFIER); - arrayMods = (IASTArrayModifier[]) ArrayUtil.append(IASTArrayModifier.class, arrayMods, + arrayMods = (IASTArrayModifier[]) ArrayUtil.appendAt(IASTArrayModifier.class, arrayMods, ++arrayModsPos, arrayModifier); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDeclarator.java index ed669b53a32..ad2d0cda805 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDeclarator.java @@ -76,7 +76,7 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig public IASTPointerOperator[] getPointerOperators() { if (pointerOps == null) return IASTPointerOperator.EMPTY_ARRAY; - pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter(IASTPointerOperator.class, pointerOps, pointerOpsPos); + pointerOps = (IASTPointerOperator[]) ArrayUtil.trimAt(IASTPointerOperator.class, pointerOps, pointerOpsPos); return pointerOps; } @@ -106,7 +106,7 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig if (operator != null) { operator.setParent(this); operator.setPropertyInParent(POINTER_OPERATOR); - pointerOps = (IASTPointerOperator[]) ArrayUtil.append(IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator); + pointerOps = (IASTPointerOperator[]) ArrayUtil.appendAt(IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDesignatedInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDesignatedInitializer.java index 6ac163ae905..edfee77e35c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDesignatedInitializer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTDesignatedInitializer.java @@ -61,14 +61,14 @@ public class CASTDesignatedInitializer extends ASTNode implements ICASTDesignate if (designator != null) { designator.setParent(this); designator.setPropertyInParent(DESIGNATOR); - designators = (ICASTDesignator[]) ArrayUtil.append( ICASTDesignator.class, designators, ++designatorsPos, designator ); + designators = (ICASTDesignator[]) ArrayUtil.appendAt( ICASTDesignator.class, designators, ++designatorsPos, designator ); } } public ICASTDesignator[] getDesignators() { if( designators == null ) return ICASTDesignatedInitializer.EMPTY_DESIGNATOR_ARRAY; - designators = (ICASTDesignator[]) ArrayUtil.removeNullsAfter( ICASTDesignator.class, designators, designatorsPos ); + designators = (ICASTDesignator[]) ArrayUtil.trimAt( ICASTDesignator.class, designators, designatorsPos ); return designators; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java index f608ab7fedf..33459d9f031 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java @@ -69,14 +69,14 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier if (enumerator != null) { enumerator.setParent(this); enumerator.setPropertyInParent(ENUMERATOR); - enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator ); + enumerators = (IASTEnumerator[]) ArrayUtil.appendAt( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator ); } } public IASTEnumerator[] getEnumerators() { if( enumerators == null ) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY; - enumerators = (IASTEnumerator[]) ArrayUtil.removeNullsAfter( IASTEnumerator.class, enumerators, enumeratorsPos ); + enumerators = (IASTEnumerator[]) ArrayUtil.trimAt( IASTEnumerator.class, enumerators, enumeratorsPos ); return enumerators; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDeclarator.java index 5248612a2a9..cc20ba0dfe3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDeclarator.java @@ -62,7 +62,7 @@ public class CASTFunctionDeclarator extends CASTDeclarator implements IASTStanda public IASTParameterDeclaration[] getParameters() { if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY; - parameters = (IASTParameterDeclaration[]) ArrayUtil.removeNullsAfter( IASTParameterDeclaration.class, parameters, parametersPos ); + parameters = (IASTParameterDeclaration[]) ArrayUtil.trimAt( IASTParameterDeclaration.class, parameters, parametersPos ); return parameters; } @@ -71,7 +71,7 @@ public class CASTFunctionDeclarator extends CASTDeclarator implements IASTStanda if (parameter != null) { parameter.setParent(this); parameter.setPropertyInParent(FUNCTION_PARAMETER); - parameters = (IASTParameterDeclaration[]) ArrayUtil.append( IASTParameterDeclaration.class, parameters, ++parametersPos, parameter ); + parameters = (IASTParameterDeclaration[]) ArrayUtil.appendAt( IASTParameterDeclaration.class, parameters, ++parametersPos, parameter ); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerList.java index bf7404a3598..795ab6cca03 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerList.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerList.java @@ -83,7 +83,7 @@ public class CASTInitializerList extends ASTNode implements IASTInitializerList, public void addClause(IASTInitializerClause d) { assertNotFrozen(); if (d != null) { - initializers = (IASTInitializerClause[]) ArrayUtil.append( IASTInitializerClause.class, initializers, ++initializersPos, d ); + initializers = (IASTInitializerClause[]) ArrayUtil.appendAt( IASTInitializerClause.class, initializers, ++initializersPos, d ); d.setParent(this); d.setPropertyInParent(NESTED_INITIALIZER); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclaration.java index 8a28daf6a53..46b1d5933d0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclaration.java @@ -61,7 +61,7 @@ public class CASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclarat public IASTDeclarator[] getDeclarators() { if (declarators == null) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY; - declarators = (IASTDeclarator[]) ArrayUtil.removeNullsAfter(IASTDeclarator.class, declarators, declaratorsPos); + declarators = (IASTDeclarator[]) ArrayUtil.trimAt(IASTDeclarator.class, declarators, declaratorsPos); return declarators; } @@ -70,7 +70,7 @@ public class CASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclarat if (d != null) { d.setParent(this); d.setPropertyInParent(DECLARATOR); - declarators = (IASTDeclarator[]) ArrayUtil.append(IASTDeclarator.class, declarators, ++declaratorsPos, d); + declarators = (IASTDeclarator[]) ArrayUtil.appendAt(IASTDeclarator.class, declarators, ++declaratorsPos, d); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousDeclarator.java index 7b2be658f5f..b71dddcfa55 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousDeclarator.java @@ -74,14 +74,14 @@ public class CPPASTAmbiguousDeclarator extends ASTAmbiguousNode implements IASTA public void addDeclarator(IASTDeclarator d) { assertNotFrozen(); if (d != null) { - dtors = (IASTDeclarator[]) ArrayUtil.append(IASTDeclarator.class, dtors, ++dtorPos, d); + dtors = (IASTDeclarator[]) ArrayUtil.appendAt(IASTDeclarator.class, dtors, ++dtorPos, d); d.setParent(this); d.setPropertyInParent(SUBDECLARATOR); } } public IASTDeclarator[] getDeclarators() { - dtors = (IASTDeclarator[]) ArrayUtil.removeNullsAfter(IASTDeclarator.class, dtors, dtorPos ); + dtors = (IASTDeclarator[]) ArrayUtil.trimAt(IASTDeclarator.class, dtors, dtorPos ); return dtors; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousExpression.java index 9081750edc5..04ba1474987 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousExpression.java @@ -40,14 +40,14 @@ public class CPPASTAmbiguousExpression extends ASTAmbiguousNode implements public void addExpression(IASTExpression e) { assertNotFrozen(); if (e != null) { - exp = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, exp, ++expPos, e ); + exp = (IASTExpression[]) ArrayUtil.appendAt( IASTExpression.class, exp, ++expPos, e ); e.setParent(this); e.setPropertyInParent(SUBEXPRESSION); } } public IASTExpression[] getExpressions() { - exp = (IASTExpression[]) ArrayUtil.removeNullsAfter( IASTExpression.class, exp, expPos ); + exp = (IASTExpression[]) ArrayUtil.trimAt( IASTExpression.class, exp, expPos ); return exp; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousStatement.java index c168e86be94..ec2cad3207a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousStatement.java @@ -84,7 +84,7 @@ public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements public void addStatement(IASTStatement s) { assertNotFrozen(); if (s != null) { - stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, ++stmtsPos, s ); + stmts = (IASTStatement[]) ArrayUtil.appendAt( IASTStatement.class, stmts, ++stmtsPos, s ); s.setParent(this); s.setPropertyInParent(STATEMENT); } @@ -92,7 +92,7 @@ public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements @Override public IASTStatement[] getStatements() { - stmts = (IASTStatement[]) ArrayUtil.removeNullsAfter( IASTStatement.class, stmts, stmtsPos ); + stmts = (IASTStatement[]) ArrayUtil.trimAt( IASTStatement.class, stmts, stmtsPos ); return stmts; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayDeclarator.java index f695773d03e..fc77f9b4215 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayDeclarator.java @@ -58,7 +58,7 @@ public class CPPASTArrayDeclarator extends CPPASTDeclarator implements ICPPASTAr public IASTArrayModifier[] getArrayModifiers() { if (arrayMods == null) return IASTArrayModifier.EMPTY_ARRAY; - arrayMods = (IASTArrayModifier[]) ArrayUtil.removeNullsAfter(IASTArrayModifier.class, + arrayMods = (IASTArrayModifier[]) ArrayUtil.trimAt(IASTArrayModifier.class, arrayMods, arrayModsPos); return arrayMods; } @@ -67,7 +67,7 @@ public class CPPASTArrayDeclarator extends CPPASTDeclarator implements ICPPASTAr public void addArrayModifier(IASTArrayModifier arrayModifier) { assertNotFrozen(); if (arrayModifier != null) { - arrayMods = (IASTArrayModifier[]) ArrayUtil.append(IASTArrayModifier.class, arrayMods, + arrayMods = (IASTArrayModifier[]) ArrayUtil.appendAt(IASTArrayModifier.class, arrayMods, ++arrayModsPos, arrayModifier); arrayModifier.setParent(this); arrayModifier.setPropertyInParent(ARRAY_MODIFIER); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java index feab85df793..8aa0add5bab 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java @@ -75,7 +75,7 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier if (enumerator != null) { enumerator.setParent(this); enumerator.setPropertyInParent(ENUMERATOR); - fItems = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, fItems, ++fItemPos, enumerator ); + fItems = (IASTEnumerator[]) ArrayUtil.appendAt( IASTEnumerator.class, fItems, ++fItemPos, enumerator ); } } @@ -83,7 +83,7 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier if (fItems == null) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY; - fItems = (IASTEnumerator[]) ArrayUtil.removeNullsAfter(IASTEnumerator.class, fItems, fItemPos); + fItems = (IASTEnumerator[]) ArrayUtil.trimAt(IASTEnumerator.class, fItems, fItemPos); return fItems; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionWithTryBlock.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionWithTryBlock.java index c555f9d0c4c..b95e03c33d8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionWithTryBlock.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionWithTryBlock.java @@ -69,7 +69,7 @@ public class CPPASTFunctionWithTryBlock extends CPPASTFunctionDefinition impleme public void addCatchHandler(ICPPASTCatchHandler statement) { assertNotFrozen(); if (statement != null) { - catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.append(ICPPASTCatchHandler.class, catchHandlers, ++catchHandlersPos, statement); + catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.appendAt(ICPPASTCatchHandler.class, catchHandlers, ++catchHandlersPos, statement); statement.setParent(this); statement.setPropertyInParent(CATCH_HANDLER); } @@ -78,7 +78,7 @@ public class CPPASTFunctionWithTryBlock extends CPPASTFunctionDefinition impleme @Override public ICPPASTCatchHandler[] getCatchHandlers() { if (catchHandlers == null) return ICPPASTCatchHandler.EMPTY_CATCHHANDLER_ARRAY; - catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.removeNullsAfter(ICPPASTCatchHandler.class, catchHandlers, catchHandlersPos); + catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.trimAt(ICPPASTCatchHandler.class, catchHandlers, catchHandlersPos); return catchHandlers; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerList.java index 52b420d917d..4e524147a97 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerList.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerList.java @@ -84,7 +84,7 @@ public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializer public void addClause(IASTInitializerClause d) { assertNotFrozen(); if (d != null) { - initializers = (IASTInitializerClause[]) ArrayUtil.append( IASTInitializerClause.class, initializers, ++initializersPos, d ); + initializers = (IASTInitializerClause[]) ArrayUtil.appendAt( IASTInitializerClause.class, initializers, ++initializersPos, d ); d.setParent(this); d.setPropertyInParent(NESTED_INITIALIZER); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLinkageSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLinkageSpecification.java index 6ec8a895c92..f8657377a39 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLinkageSpecification.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLinkageSpecification.java @@ -65,7 +65,7 @@ public class CPPASTLinkageSpecification extends ASTNode implements if (decl != null) { decl.setParent(this); decl.setPropertyInParent(OWNED_DECLARATION); - fAllDeclarations = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, fAllDeclarations, ++fLastDeclaration, decl); + fAllDeclarations = (IASTDeclaration[]) ArrayUtil.appendAt( IASTDeclaration.class, fAllDeclarations, ++fLastDeclaration, decl); fActiveDeclarations= null; } } @@ -81,7 +81,7 @@ public class CPPASTLinkageSpecification extends ASTNode implements public final IASTDeclaration[] getDeclarations(boolean includeInactive) { if (includeInactive) { - fAllDeclarations= (IASTDeclaration[]) ArrayUtil.removeNullsAfter(IASTDeclaration.class, fAllDeclarations, fLastDeclaration); + fAllDeclarations= (IASTDeclaration[]) ArrayUtil.trimAt(IASTDeclaration.class, fAllDeclarations, fLastDeclaration); return fAllDeclarations; } return getDeclarations(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java index e807f62daa3..313befcca06 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java @@ -85,7 +85,7 @@ public class CPPASTNamespaceDefinition extends ASTNode if (decl != null) { decl.setParent(this); decl.setPropertyInParent(OWNED_DECLARATION); - fAllDeclarations = (IASTDeclaration[]) ArrayUtil.append(IASTDeclaration.class, fAllDeclarations, ++fLastDeclaration, decl); + fAllDeclarations = (IASTDeclaration[]) ArrayUtil.appendAt(IASTDeclaration.class, fAllDeclarations, ++fLastDeclaration, decl); fActiveDeclarations= null; } } @@ -101,7 +101,7 @@ public class CPPASTNamespaceDefinition extends ASTNode public final IASTDeclaration[] getDeclarations(boolean includeInactive) { if (includeInactive) { - fAllDeclarations= (IASTDeclaration[]) ArrayUtil.removeNullsAfter(IASTDeclaration.class, fAllDeclarations, fLastDeclaration); + fAllDeclarations= (IASTDeclaration[]) ArrayUtil.trimAt(IASTDeclaration.class, fAllDeclarations, fLastDeclaration); return fAllDeclarations; } return getDeclarations(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java index 40391f11ef0..0314083f16a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java @@ -113,7 +113,7 @@ public class CPPASTQualifiedName extends CPPASTNameBase assertNotFrozen(); assert !(name instanceof ICPPASTQualifiedName); if (name != null) { - names = (IASTName[]) ArrayUtil.append(IASTName.class, names, ++namesPos, name); + names = (IASTName[]) ArrayUtil.appendAt(IASTName.class, names, ++namesPos, name); name.setParent(this); name.setPropertyInParent(SEGMENT_NAME); } @@ -123,7 +123,7 @@ public class CPPASTQualifiedName extends CPPASTNameBase if (namesPos < 0) return IASTName.EMPTY_NAME_ARRAY; - names = (IASTName[]) ArrayUtil.removeNullsAfter(IASTName.class, names, namesPos); + names = (IASTName[]) ArrayUtil.trimAt(IASTName.class, names, namesPos); return names; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java index e3ef9247c18..216dc28e910 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java @@ -59,7 +59,7 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar public IASTDeclarator[] getDeclarators() { if (declarators == null) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY; - declarators = (IASTDeclarator[]) ArrayUtil.removeNullsAfter(IASTDeclarator.class, declarators, declaratorsPos); + declarators = (IASTDeclarator[]) ArrayUtil.trimAt(IASTDeclarator.class, declarators, declaratorsPos); return declarators; } @@ -67,7 +67,7 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar public void addDeclarator(IASTDeclarator d) { assertNotFrozen(); if (d != null) { - declarators = (IASTDeclarator[]) ArrayUtil.append(IASTDeclarator.class, declarators, ++declaratorsPos, d); + declarators = (IASTDeclarator[]) ArrayUtil.appendAt(IASTDeclarator.class, declarators, ++declaratorsPos, d); d.setParent(this); d.setPropertyInParent(DECLARATOR); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateDeclaration.java index 2d604599d65..22d37821fef 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateDeclaration.java @@ -89,7 +89,7 @@ public class CPPASTTemplateDeclaration extends ASTNode @Override public ICPPASTTemplateParameter[] getTemplateParameters() { if (parameters == null) return ICPPASTTemplateParameter.EMPTY_TEMPLATEPARAMETER_ARRAY; - parameters = (ICPPASTTemplateParameter[]) ArrayUtil.removeNullsAfter(ICPPASTTemplateParameter.class, parameters, parametersPos); + parameters = (ICPPASTTemplateParameter[]) ArrayUtil.trimAt(ICPPASTTemplateParameter.class, parameters, parametersPos); return parameters; } @@ -97,7 +97,7 @@ public class CPPASTTemplateDeclaration extends ASTNode public void addTemplateParameter(ICPPASTTemplateParameter parm) { assertNotFrozen(); if (parm != null) { - parameters = (ICPPASTTemplateParameter[]) ArrayUtil.append(ICPPASTTemplateParameter.class, parameters, ++parametersPos, parm); + parameters = (ICPPASTTemplateParameter[]) ArrayUtil.appendAt(ICPPASTTemplateParameter.class, parameters, ++parametersPos, parm); parm.setParent(this); parm.setPropertyInParent(PARAMETER); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTryBlockStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTryBlockStatement.java index b51237f549c..7a95c23dcd1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTryBlockStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTryBlockStatement.java @@ -52,7 +52,7 @@ public class CPPASTTryBlockStatement extends ASTNode implements ICPPASTTryBlockS public void addCatchHandler(ICPPASTCatchHandler statement) { assertNotFrozen(); if (statement != null) { - catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.append( ICPPASTCatchHandler.class, catchHandlers, ++catchHandlersPos, statement ); + catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.appendAt( ICPPASTCatchHandler.class, catchHandlers, ++catchHandlersPos, statement ); statement.setParent(this); statement.setPropertyInParent(CATCH_HANDLER); } @@ -61,7 +61,7 @@ public class CPPASTTryBlockStatement extends ASTNode implements ICPPASTTryBlockS public ICPPASTCatchHandler[] getCatchHandlers() { if( catchHandlers == null ) return ICPPASTCatchHandler.EMPTY_CATCHHANDLER_ARRAY; - catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.removeNullsAfter( ICPPASTCatchHandler.class, catchHandlers, catchHandlersPos ); + catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.trimAt( ICPPASTCatchHandler.class, catchHandlers, catchHandlersPos ); return catchHandlers; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPCompositeBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPCompositeBinding.java index 031d28264e6..dfa4381fac4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPCompositeBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPCompositeBinding.java @@ -24,7 +24,7 @@ public class CPPCompositeBinding extends PlatformObject implements IBinding { IBinding[] bindings; public CPPCompositeBinding(IBinding[] bindingList) { - bindings = (IBinding[]) ArrayUtil.trim(IBinding.class, bindingList, true); + bindings = ArrayUtil.trim(bindingList, true); } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDeclaration.java index 07ceaa1c657..2175920ffbb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDeclaration.java @@ -100,7 +100,7 @@ class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclara do { IBinding delegate = alias.getBinding(); if (delegate != null) { - delegates= (IBinding[]) ArrayUtil.append(IBinding.class, delegates, i++, delegate); + delegates= (IBinding[]) ArrayUtil.appendAt(IBinding.class, delegates, i++, delegate); } } while ((alias = alias.getNext()) != null); } catch (CoreException e) {