com.sun.jdi.ArrayReference Java Examples

The following examples show how to use com.sun.jdi.ArrayReference. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrayFieldVariable.java    From netbeans with Apache License 2.0 6 votes vote down vote up
ArrayFieldVariable (
    JPDADebuggerImpl debugger,
    PrimitiveValue value,
    String declaredType,
    ObjectVariable array,
    int index,
    int maxIndex,
    String parentID
) {
    super (
        debugger, 
        value, 
        parentID + '.' + index +
            (value instanceof ObjectReference ? "^" : "")
    );
    this.index = index;
    this.maxIndexLog = log10(maxIndex);
    this.declaredType = declaredType;
    this.parent = array;
    this.array = (ArrayReference) ((JDIVariable) array).getJDIValue();
}
 
Example #2
Source File: EvaluatorTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public boolean equals(Object obj) {
    if (!(obj instanceof JDIValue)) return false;
    Value v = ((JDIValue) obj).value;
    if (value == null) return v == null;
    if (value instanceof StringReference) {
        if (!(v instanceof StringReference)) return false;
        return ((StringReference) value).value().equals(((StringReference) v).value());
    }
    if (value instanceof ArrayReference) {
        if (!(v instanceof ArrayReference)) return false;
        ArrayReference a1 = (ArrayReference) value;
        ArrayReference a2 = (ArrayReference) v;
        if (!a1.type().equals(a2.type())) return false;
        if (a1.length() != a2.length()) return false;
        int n = a1.length();
        for (int i = 0; i < n; i++) {
            if (!new JDIValue(a1.getValue(i)).equals(new JDIValue(a2.getValue(i)))) {
                return false;
            }
        }
        return true;
    }
    return value.equals(v);
}
 
Example #3
Source File: OomDebugTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test2() throws Exception {
    System.out.println("DEBUG: ------------> Running test2");
    try {
        Field field = targetClass.fieldByName("byteArray");
        ArrayType arrType = (ArrayType)field.type();

        for (int i = 0; i < 15; i++) {
            ArrayReference byteArrayVal = arrType.newInstance(3000000);
            if (byteArrayVal.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testPrimitive", "([B)V", byteArrayVal);
        }
    } catch (VMOutOfMemoryException e) {
        defaultHandleOOMFailure(e);
    }
}
 
Example #4
Source File: OomDebugTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test2() throws Exception {
    System.out.println("DEBUG: ------------> Running test2");
    try {
        Field field = targetClass.fieldByName("byteArray");
        ArrayType arrType = (ArrayType)field.type();

        for (int i = 0; i < 15; i++) {
            ArrayReference byteArrayVal = arrType.newInstance(3000000);
            if (byteArrayVal.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testPrimitive", "([B)V", byteArrayVal);
        }
    } catch (VMOutOfMemoryException e) {
        defaultHandleOOMFailure(e);
    }
}
 
Example #5
Source File: OomDebugTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test2() throws Exception {
    System.out.println("DEBUG: ------------> Running test2");
    try {
        Field field = targetClass.fieldByName("byteArray");
        ArrayType arrType = (ArrayType)field.type();

        for (int i = 0; i < 15; i++) {
            ArrayReference byteArrayVal = arrType.newInstance(3000000);
            if (byteArrayVal.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testPrimitive", "([B)V", byteArrayVal);
        }
    } catch (VMOutOfMemoryException e) {
        defaultHandleOOMFailure(e);
    }
}
 
Example #6
Source File: SetVariableRequestHandler.java    From java-debug with Eclipse Public License 1.0 6 votes vote down vote up
private Value handleSetValueForObject(String name, String belongToClass, String valueString,
        ObjectReference container, Map<String, Object> options) throws InvalidTypeException, ClassNotLoadedException {
    Value newValue;
    if (container instanceof ArrayReference) {
        ArrayReference array = (ArrayReference) container;
        Type eleType = ((ArrayType) array.referenceType()).componentType();
        newValue = setArrayValue(array, eleType, Integer.parseInt(name), valueString, options);
    } else {
        if (StringUtils.isBlank(belongToClass)) {
            Field field = container.referenceType().fieldByName(name);
            if (field != null) {
                if (field.isStatic()) {
                    newValue = this.setStaticFieldValue(container.referenceType(), field, name, valueString, options);
                } else {
                    newValue = this.setObjectFieldValue(container, field, name, valueString, options);
                }
            } else {
                throw new IllegalArgumentException(
                        String.format("SetVariableRequest: Variable %s cannot be found.", name));
            }
        } else {
            newValue = setFieldValueWithConflict(container, container.referenceType().allFields(), name, belongToClass, valueString, options);
        }
    }
    return newValue;
}
 
Example #7
Source File: AbstractObjectVariable.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
* Returns string representation of type of this variable.
*
* @return string representation of type of this variable.
*/
@Override
public int getFieldsCount () {
    Value v = getInnerValue ();
    if (v == null) {
        return 0;
    }
    if (v instanceof ArrayReference) {
        return ArrayReferenceWrapper.length0((ArrayReference) v);
    } else {
        synchronized (fieldsLock) {
            if (fields == null || refreshFields) {
                initFields ();
            }
            return fields.length;
        }
    }
}
 
Example #8
Source File: ObjectArrayFieldVariable.java    From netbeans with Apache License 2.0 6 votes vote down vote up
ObjectArrayFieldVariable (
    JPDADebuggerImpl debugger,
    ObjectReference value,
    String declaredType,
    ObjectVariable array,
    int index,
    int maxIndex,
    String parentID
) {
    super (
        debugger, 
        value, 
        parentID + '.' + index + "^"
    );
    this.index = index;
    this.maxIndexLog = ArrayFieldVariable.log10(maxIndex);
    this.declaredType = declaredType;
    this.parent = array;
    this.array = (ArrayReference) ((JDIVariable) array).getJDIValue();
}
 
Example #9
Source File: OomDebugTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test2() throws Exception {
    System.out.println("DEBUG: ------------> Running test2");
    try {
        Field field = targetClass.fieldByName("byteArray");
        ArrayType arrType = (ArrayType)field.type();

        for (int i = 0; i < 15; i++) {
            ArrayReference byteArrayVal = arrType.newInstance(3000000);
            if (byteArrayVal.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testPrimitive", "([B)V", byteArrayVal);
        }
    } catch (VMOutOfMemoryException e) {
        defaultHandleOOMFailure(e);
    }
}
 
Example #10
Source File: OomDebugTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test2() throws Exception {
    System.out.println("DEBUG: ------------> Running test2");
    try {
        Field field = targetClass.fieldByName("byteArray");
        ArrayType arrType = (ArrayType)field.type();

        for (int i = 0; i < 15; i++) {
            ArrayReference byteArrayVal = arrType.newInstance(3000000);
            if (byteArrayVal.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testPrimitive", "([B)V", byteArrayVal);
        }
    } catch (VMOutOfMemoryException e) {
        defaultHandleOOMFailure(e);
    }
}
 
Example #11
Source File: OomDebugTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test2() throws Exception {
    System.out.println("DEBUG: ------------> Running test2");
    try {
        Field field = targetClass.fieldByName("byteArray");
        ArrayType arrType = (ArrayType)field.type();

        for (int i = 0; i < 15; i++) {
            ArrayReference byteArrayVal = arrType.newInstance(3000000);
            if (byteArrayVal.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testPrimitive", "([B)V", byteArrayVal);
        }
    } catch (VMOutOfMemoryException e) {
        defaultHandleOOMFailure(e);
    }
}
 
Example #12
Source File: OomDebugTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test2() throws Exception {
    System.out.println("DEBUG: ------------> Running test2");
    try {
        Field field = targetClass.fieldByName("byteArray");
        ArrayType arrType = (ArrayType)field.type();

        for (int i = 0; i < 15; i++) {
            ArrayReference byteArrayVal = arrType.newInstance(3000000);
            if (byteArrayVal.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testPrimitive", "([B)V", byteArrayVal);
        }
    } catch (VMOutOfMemoryException e) {
        defaultHandleOOMFailure(e);
    }
}
 
Example #13
Source File: ValueFactory.java    From nopol with GNU General Public License v2.0 5 votes vote down vote up
public static Value create(Object value) {
    if (value == null) {
        return new ComplexValueImpl(null);
    }
    if (value instanceof Value) {
        return (Value) value;
    }
    if (value instanceof ArrayReference) {
        ArrayReference array = (ArrayReference) value;
        List<Value> arrayValues = create(array.getValues());
        return new ArrayValueImpl(array.type().name(), array, arrayValues, value);
    }
    if (value instanceof ObjectReference) {
        return new ComplexValueImpl((ObjectReference) value);
    }
    if (value instanceof ClassType) {
        return new TypeValueImpl((ClassType) value);
    }
    if (value instanceof PrimitiveValue) {
        try {
            java.lang.reflect.Method valueMethod = value.getClass().getMethod("value");
            Object result = valueMethod.invoke(value);
            PrimitiveValueImpl primitiveValue = new PrimitiveValueImpl(result);
            primitiveValue.setJDIValue((PrimitiveValue) value);
            return primitiveValue;
        } catch (Exception e) {
            return null;
        }
    }
    if (value.getClass().isArray()) {
        List<Object> values = new ArrayList<>();
        int length = Array.getLength(value);
        for (int i = 0; i< length; i++) {
            values.add(Array.get(value, i));
        }
        return new ArrayValueImpl(value.getClass().getComponentType().getCanonicalName(), null, create(values), value);
    }
    return new PrimitiveValueImpl(value);
}
 
Example #14
Source File: VariableUtils.java    From java-debug with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Get the variables of the object.
 *
 * @param obj
 *            the object
 * @return the variable list
 * @throws AbsentInformationException
 *             when there is any error in retrieving information
 */
public static List<Variable> listFieldVariables(ObjectReference obj, boolean includeStatic) throws AbsentInformationException {
    List<Variable> res = new ArrayList<>();
    Type type = obj.type();
    if (type instanceof ArrayType) {
        int arrayIndex = 0;
        for (Value elementValue : ((ArrayReference) obj).getValues()) {
            Variable ele = new Variable(String.valueOf(arrayIndex++), elementValue);
            res.add(ele);
        }
        return res;
    }
    List<Field> fields = obj.referenceType().allFields().stream().filter(t -> includeStatic || !t.isStatic())
            .sorted((a, b) -> {
                try {
                    boolean v1isStatic = a.isStatic();
                    boolean v2isStatic = b.isStatic();
                    if (v1isStatic && !v2isStatic) {
                        return -1;
                    }
                    if (!v1isStatic && v2isStatic) {
                        return 1;
                    }
                    return a.name().compareToIgnoreCase(b.name());
                } catch (Exception e) {
                    logger.log(Level.SEVERE, String.format("Cannot sort fields: %s", e), e);
                    return -1;
                }
            }).collect(Collectors.toList());
    fields.forEach(f -> {
        Variable var = new Variable(f.name(), obj.getValue(f));
        var.field = f;
        res.add(var);
    });
    return res;
}
 
Example #15
Source File: VariableUtils.java    From java-debug with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Get the variables of the object with pagination.
 *
 * @param obj
 *            the object
 * @param start
 *            the start of the pagination
 * @param count
 *            the number of variables needed
 * @return the variable list
 * @throws AbsentInformationException
 *             when there is any error in retrieving information
 */
public static List<Variable> listFieldVariables(ObjectReference obj, int start, int count)
        throws AbsentInformationException {
    List<Variable> res = new ArrayList<>();
    Type type = obj.type();
    if (type instanceof ArrayType) {
        int arrayIndex = start;
        for (Value elementValue : ((ArrayReference) obj).getValues(start, count)) {
            res.add(new Variable(String.valueOf(arrayIndex++), elementValue));
        }
        return res;
    }
    throw new UnsupportedOperationException("Only Array type is supported.");
}
 
Example #16
Source File: VariableUtils.java    From java-debug with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Test whether the value has referenced objects.
 *
 * @param value
 *            the value.
 * @param includeStatic
 *            whether or not the static fields are visible.
 * @return true if this value is reference objects.
 */
public static boolean hasChildren(Value value, boolean includeStatic) {
    if (value == null || !(value instanceof ObjectReference)) {
        return false;
    }
    Type type = value.type();
    if (type instanceof ArrayType) {
        return ((ArrayReference) value).length() > 0;
    }
    return value.type() instanceof ReferenceType && ((ReferenceType) type).allFields().stream()
            .filter(t -> includeStatic || !t.isStatic()).toArray().length > 0;
}
 
Example #17
Source File: OomDebugTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test2() throws Exception {
    System.out.println("DEBUG: ------------> Running " + testMethodName);
    try {
        Field field = targetClass.fieldByName("byteArray");
        ArrayType arrType = (ArrayType)field.type();

        for (int i = 0; i < 15; i++) {
            ArrayReference byteArrayVal = arrType.newInstance(3000000);
            invoke("testPrimitive", "([B)V", byteArrayVal);
        }
    } catch (VMOutOfMemoryException e) {
        defaultHandleOOMFailure(e);
    }
}
 
Example #18
Source File: RemoteServices.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static ArrayReference createTargetBytes(VirtualMachine vm, byte[] bytes,
                                                ByteValue[] mirrorBytesCache) throws InvalidTypeException,
                                                                                     ClassNotLoadedException,
                                                                                     InternalExceptionWrapper,
                                                                                     VMDisconnectedExceptionWrapper,
                                                                                     ObjectCollectedExceptionWrapper {
    ArrayType bytesArrayClass = getArrayClass(vm, "byte[]");
    ArrayReference array = null;
    boolean disabledCollection = false;
    while (!disabledCollection) {
        array = ArrayTypeWrapper.newInstance(bytesArrayClass, bytes.length);
        try {
            ObjectReferenceWrapper.disableCollection(array);
            disabledCollection = true;
        } catch (ObjectCollectedExceptionWrapper ocex) {
            // Collected too soon, try again...
        } catch (UnsupportedOperationExceptionWrapper uex) {
            // Hope it will not be GC'ed...
            disabledCollection = true;
        }
    }
    List<Value> values = new ArrayList<Value>(bytes.length);
    for (int i = 0; i < bytes.length; i++) {
        byte b = bytes[i];
        ByteValue mb = mirrorBytesCache[128 + b];
        if (mb == null) {
            mb = VirtualMachineWrapper.mirrorOf(vm, b);
            mirrorBytesCache[128 + b] = mb;
        }
        values.add(mb);
    }
    ArrayReferenceWrapper.setValues(array, values);
    return array;
}
 
Example #19
Source File: AbstractObjectVariable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Return all inherited fields.
 * 
 * @return all inherited fields
 */
@Override
public Field[] getInheritedFields (int from, int to) {
    Value v = getInnerValue ();
    if (v == null || v instanceof ArrayReference) {
        return new Field[] {};
    }
    synchronized (fieldsLock) {
        if (fields == null || refreshFields) {
            initFields ();
        }
        return getSubFields(inheritedFields, from, to);
    }
}
 
Example #20
Source File: AbstractObjectVariable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Return all static fields.
 *
 * @return all static fields
 */
@Override
public Field[] getAllStaticFields (int from, int to) {
    Value v = getInnerValue ();
    if (v == null || v instanceof ArrayReference) {
        return new Field[] {};
    }
    synchronized (fieldsLock) {
        if (fields == null || refreshFields) {
            initFields ();
        }
        return getSubFields(staticFields, from, to);
    }
}
 
Example #21
Source File: AbstractVariable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static String getValue (Value v) {
    if (v == null) {
        return "null";
    }
    if (v instanceof VoidValue) {
        return "void";
    }
    if (v instanceof CharValue) {
        return "\'" + v.toString () + "\'";
    }
    if (v instanceof PrimitiveValue) {
        return v.toString ();
    }
    try {
        if (v instanceof StringReference) {
            String str = ShortenedStrings.getStringWithLengthControl((StringReference) v);
            return "\"" + str + "\"";
        }
        if (v instanceof ClassObjectReference) {
            return "class " + ReferenceTypeWrapper.name(ClassObjectReferenceWrapper.reflectedType((ClassObjectReference) v));
        }
        if (v instanceof ArrayReference) {
            return "#" + ObjectReferenceWrapper.uniqueID((ArrayReference) v) +
                "(length=" + ArrayReferenceWrapper.length((ArrayReference) v) + ")";
        }
        return "#" + ObjectReferenceWrapper.uniqueID((ObjectReference) v);
    } catch (InternalExceptionWrapper iex) {
        return "";
    } catch (ObjectCollectedExceptionWrapper oex) {
        return "";
    } catch (VMDisconnectedExceptionWrapper dex) {
        return "";
    }
}
 
Example #22
Source File: RemoteServices.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static ArrayReference createTargetBytes(VirtualMachine vm, byte[] bytes,
                                                ByteValue[] mirrorBytesCache) throws InvalidTypeException,
                                                                                     ClassNotLoadedException,
                                                                                     InternalExceptionWrapper,
                                                                                     VMDisconnectedExceptionWrapper,
                                                                                     ObjectCollectedExceptionWrapper,
                                                                                     UnsupportedOperationExceptionWrapper {
    ArrayType bytesArrayClass = getArrayClass(vm, "byte[]");
    ArrayReference array = null;
    boolean disabledCollection = false;
    while (!disabledCollection) {
        array = ArrayTypeWrapper.newInstance(bytesArrayClass, bytes.length);
        try {
            ObjectReferenceWrapper.disableCollection(array);
            disabledCollection = true;
        } catch (ObjectCollectedExceptionWrapper ocex) {
            // Collected too soon, try again...
        }
    }
    List<Value> values = new ArrayList<Value>(bytes.length);
    for (int i = 0; i < bytes.length; i++) {
        byte b = bytes[i];
        ByteValue mb = mirrorBytesCache[128 + b];
        if (mb == null) {
            mb = VirtualMachineWrapper.mirrorOf(vm, b);
            mirrorBytesCache[128 + b] = mb;
        }
        values.add(mb);
    }
    ArrayReferenceWrapper.setValues(array, values);
    return array;
}
 
Example #23
Source File: RemoteServices.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static ArrayReference createTargetBytes(VirtualMachine vm, byte[] bytes,
                                                ByteValue[] mirrorBytesCache) throws InvalidTypeException,
                                                                                     ClassNotLoadedException,
                                                                                     InternalExceptionWrapper,
                                                                                     VMDisconnectedExceptionWrapper,
                                                                                     ObjectCollectedExceptionWrapper,
                                                                                     UnsupportedOperationExceptionWrapper {
    ArrayType bytesArrayClass = getArrayClass(vm, "byte[]");
    ArrayReference array = null;
    boolean disabledCollection = false;
    while (!disabledCollection) {
        array = ArrayTypeWrapper.newInstance(bytesArrayClass, bytes.length);
        try {
            ObjectReferenceWrapper.disableCollection(array);
            disabledCollection = true;
        } catch (ObjectCollectedExceptionWrapper ocex) {
            // Collected too soon, try again...
        }
    }
    List<Value> values = new ArrayList<Value>(bytes.length);
    for (int i = 0; i < bytes.length; i++) {
        byte b = bytes[i];
        ByteValue mb = mirrorBytesCache[128 + b];
        if (mb == null) {
            mb = VirtualMachineWrapper.mirrorOf(vm, b);
            mirrorBytesCache[128 + b] = mb;
        }
        values.add(mb);
    }
    ArrayReferenceWrapper.setValues(array, values);
    return array;
}
 
Example #24
Source File: EvaluationContext.java    From netbeans with Apache License 2.0 4 votes vote down vote up
ArrayElementInf(ArrayReference array, int index) {
    this.array = array;
    this.index = index;
}
 
Example #25
Source File: EvaluationContext.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void putArrayAccess(Tree tree, ArrayReference array, int index) {
    VariableInfo info = new VariableInfo.ArrayElementInf(array, index);
    variables.put(tree, info);
}
 
Example #26
Source File: ArrayObjectFormatter.java    From java-debug with Eclipse Public License 1.0 4 votes vote down vote up
private static int arrayLength(Value value) {
    return ((ArrayReference) value).length();
}
 
Example #27
Source File: SetVariableRequestHandler.java    From java-debug with Eclipse Public License 1.0 4 votes vote down vote up
private Value setArrayValue(ArrayReference array, Type eleType, int index, String value, Map<String, Object> options)
        throws ClassNotLoadedException, InvalidTypeException {
    return setValueProxy(eleType, value, newValue -> array.setValue(index, newValue), options);
}
 
Example #28
Source File: ShortenedStrings.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private StringInfo(StringReference sr, int shortLength, int length, ArrayReference chars) {
    this.sr = sr;
    this.shortLength = shortLength;
    this.length = length;
    this.chars = chars;
}
 
Example #29
Source File: ShortenedStrings.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static void register(String shortedString, StringReference sr, int length, ArrayReference chars) {
    StringInfo si = new StringInfo(sr, shortedString.length() - 3, length, chars);
    synchronized (infoStrings) {
        infoStrings.put(shortedString, si);
    }
}
 
Example #30
Source File: VariableUtilsTest.java    From java-debug with Eclipse Public License 1.0 4 votes vote down vote up
@Test
public void testHasChildren() throws Exception {
    ObjectReference foo = this.getObjectReference("Foo");
    assertTrue("class Foo should have children", VariableUtils.hasChildren(foo, true));
    assertTrue("class Foo should have children", VariableUtils.hasChildren(foo, false));

    Value string = this.getLocalValue("str");

    assertTrue("String object should have children", VariableUtils.hasChildren(string, true));
    assertTrue("String object should have children", VariableUtils.hasChildren(string, false));

    ArrayReference arrays = (ArrayReference) this.getLocalValue("arrays");
    assertTrue("Array object with elements should have children", VariableUtils.hasChildren(
        arrays, true));
    assertTrue("Array object with elements should have children", VariableUtils.hasChildren(
        arrays, false));

    assertFalse("Array object with no elements should not have children", VariableUtils.hasChildren(
        ((ArrayType) arrays.type()).newInstance(0), true));

    assertFalse("Array object with no elements should not have children", VariableUtils.hasChildren(
        ((ArrayType) arrays.type()).newInstance(0), false));

    assertTrue("List object with elements should have children", VariableUtils.hasChildren(
        this.getLocalValue("strList"), false));

    assertFalse("Object should not have children", VariableUtils.hasChildren(this.getLocalValue("obj"), true));
    assertFalse("Object should not have children", VariableUtils.hasChildren(this.getLocalValue("obj"), false));

    assertTrue("Class object should have children", VariableUtils.hasChildren(this.getLocalValue("b"), false));
    assertTrue("Class object should have children", VariableUtils.hasChildren(this.getLocalValue("b"), false));

    assertFalse("Null object should not have children", VariableUtils.hasChildren(null, true));
    assertFalse("Null object should not have children", VariableUtils.hasChildren(null, false));

    assertTrue("Boolean object should have children", VariableUtils.hasChildren(getLocalValue("boolVar"), false));
    assertFalse("boolean object should not have children", VariableUtils.hasChildren(getVM().mirrorOf(true), false));

    assertFalse("Class with no fields should not have children", VariableUtils.hasChildren(this.getLocalValue("a"), true));
    assertFalse("Class with no fields should not have children", VariableUtils.hasChildren(this.getLocalValue("a"), false));

    assertFalse("Primitive object should not have children", VariableUtils.hasChildren(
        getVM().mirrorOf(1), true));
    assertFalse("Primitive object should not have children", VariableUtils.hasChildren(
        getVM().mirrorOf(true), true));
    assertFalse("Primitive object should not have children", VariableUtils.hasChildren(
        getVM().mirrorOf('c'), true));
    assertFalse("Primitive object should not have children", VariableUtils.hasChildren(
        getVM().mirrorOf(1000L), true));

}