private static void expandFieldArray(Object instance, String fieldName,
                                         Object[] extraElements) throws NoSuchFieldException, IllegalArgumentException,
            IllegalAccessException {
        Field jlrField = ReflectUtil.findField(instance, fieldName);
        Object[] original = (Object[]) jlrField.get(instance);
        Object[] combined = (Object[]) Array.newInstance(
                original.getClass().getComponentType(), original.length + extraElements.length);
        System.arraycopy(original, 0, combined, 0, original.length);
        System.arraycopy(extraElements, 0, combined, original.length, extraElements.length);
        jlrField.set(instance, combined);
    }
Replace the value of a field containing a non null array, by a new array containing the
elements of the original array plus the elements of extraElements.

@param instance      the instance whose field is to be modified.
@param fieldName     the field to modify.
@param extraElements elements to append at the end of the array.
freeline-runtime/src/main/java/com/antfortune/freeline/util/NativeUtils.java