From 77a94b7f641366f20d6e8d399270b64af05bf94a Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Thu, 1 Sep 2011 12:10:36 -0700 Subject: [PATCH] Clarified Javadoc. --- .../cdt/core/parser/util/ArrayUtil.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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 837954fd5eb..029c609b77e 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 @@ -210,7 +210,14 @@ public abstract class ArrayUtil { } /** - * Assumes that both arrays contain nulls at the end, only. + * Takes contents of the two arrays up to the first null element and concatenates + * them. + * @param c The type of the element of the returned array if there was not enough free space + * in the destination array. + * @param dest The destination array. The elements of the source array are added to this array + * if there is enough free space in it. May be null. + * @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) { if (source == null || source.length == 0) @@ -246,8 +253,12 @@ public abstract class ArrayUtil { } /** - * Concatenates two arrays skipping null elements. - * Assumes that both arrays contain nulls at the end, only. + * Takes contents of the two arrays up to the first null element and concatenates + * them. + * @param dest The destination array. The elements of the source array are added to this array + * if there is enough free space in it. May be null. + * @param source The source array. May not be null. + * @return The concatenated array, which may be the same as the first parameter. * @since 5.2 */ @SuppressWarnings("unchecked") @@ -264,7 +275,8 @@ public abstract class ArrayUtil { } if (dest == null || dest.length == 0) { - Class c = dest != null ? dest.getClass().getComponentType() : source.getClass().getComponentType(); + Class c = dest != null ? + dest.getClass().getComponentType() : source.getClass().getComponentType(); dest = (T[]) Array.newInstance(c, numToAdd); System.arraycopy(source, 0, dest, 0, numToAdd); return dest;