Bug 359450 - IJavaArray.setValues throws exception when passing in
zero-length array
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArrayTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArrayTests.java
index 454562d..98bb1ff 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArrayTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArrayTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -176,4 +176,470 @@
 		}	
 	}	
 	
+	/**
+	 * Sets a zero-length array as the new values
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetZeroLengthArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			IJavaArray javaArray = type.newInstance(1);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			
+			IJavaValue[] replacements = new IJavaValue[0];
+			array.setValues(replacements);
+			// the overall size of the array will never change size, and trying to set no values has not effect
+			assertEquals(1, array.getLength());
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}	
+	
+	/**
+	 * Tries to set a new array with a starting index of -1
+	 * 
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetBadLowerIndexArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			IJavaArray javaArray = type.newInstance(1);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			
+			IJavaValue[] replacements = {target.nullValue()};
+			try {
+				array.setValues(-1, 0, replacements, 0);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				//got the expected exception
+				return;
+			}
+			fail("Should have gotten an IndexOutOfBoundsException trying to use a offset of -1");
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
+	
+	/**
+	 * Tries to set an array with an index greater than the total length of the source array
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetBadUpperIndexArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			IJavaArray javaArray = type.newInstance(1);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaValue bite = target.newValue((byte)-1);
+			IJavaValue[] replacements = {bite};
+			try {
+				array.setValues(3, 0, replacements, 0);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				//got the expected exception
+				return;
+			}
+			fail("Should have gotten an IndexOutOfBoundsException trying to use an offset of 3");
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
+	
+	/**
+	 * Tries to set an array with an index greater than the total length of the soure array
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetExactUpperIndexArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			// assign a new array
+			IJavaArray javaArray = type.newInstance(3);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaValue bite = target.newValue((byte)-1);
+			IJavaValue[] replacements = {bite, bite, bite};
+			try {
+				array.setValues(3, 0, replacements, 0);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				//got the expected exception
+				return;
+			}
+			fail("Should have gotten an IndexOutOfBoundsException trying to use an offset of 3");
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
+	
+	/**
+	 * Tries to set an array with a source index greater than the total length of the new values array
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetBadLowerSrcIndexArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			// assign a new array
+			IJavaArray javaArray = type.newInstance(3);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaValue bite = target.newValue((byte)-1);
+			IJavaValue[] replacements = {bite, bite, bite};
+			try {
+				array.setValues(0, 1, replacements, -2);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				//got the expected exception
+				return;
+			}
+			fail("Should have gotten an IndexOutOfBoundsException trying to use a source offset of -2");
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
+	
+	/**
+	 * Tries to set an array with a source index greater than the total length of the new values array
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetBadUpperSrcIndexArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			// assign a new array
+			IJavaArray javaArray = type.newInstance(3);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaValue bite = target.newValue((byte)-1);
+			IJavaValue[] replacements = {bite, bite, bite};
+			try {
+				array.setValues(0, 1, replacements, 4);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				//got the expected exception
+				return;
+			}
+			fail("Should have gotten an IndexOutOfBoundsException trying to use a source offset of 4");
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
+	
+	/**
+	 * Tries to set an array with a source index greater than the total length of the new values array
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetExactSrcIndexArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			// assign a new array
+			IJavaArray javaArray = type.newInstance(3);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaValue bite = target.newValue((byte)-1);
+			IJavaValue[] replacements = {bite, bite, bite};
+			try {
+				array.setValues(0, 1, replacements, 3);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				//got the expected exception
+				return;
+			}
+			fail("Should have gotten an IndexOutOfBoundsException trying to use a source offset of 3");
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
+	
+	/**
+	 * Tries to set an array with a length less than -1
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetBadLowerLengthArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			// assign a new array
+			IJavaArray javaArray = type.newInstance(3);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaValue bite = target.newValue((byte)-1);
+			IJavaValue[] replacements = {bite, bite, bite};
+			try {
+				array.setValues(0, -2, replacements, 3);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				//got the expected exception
+				return;
+			}
+			fail("Should have gotten an IndexOutOfBoundsException trying to use a length less than -1");
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
+	
+	/**
+	 * Tries to set an array with a length equal to -1
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetMinus1LengthArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			// assign a new array
+			IJavaArray javaArray = type.newInstance(3);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaValue bite = target.newValue((byte)-1);
+			IJavaValue[] replacements = {bite, bite, bite};
+			try {
+				array.setValues(0, -1, replacements, 0);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				fail("should be able to set all values passing -1 as length");
+			}
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
+	
+	/**
+	 * Tries to set an array where the given length and index combined exceed the length of the array 
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetBadLengthPlusIndexArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			// assign a new array
+			IJavaArray javaArray = type.newInstance(3);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaValue bite = target.newValue((byte)-1);
+			IJavaValue[] replacements = {bite, bite, bite};
+			try {
+				array.setValues(2, 2, replacements, 0);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				//got the expected exception
+				return;
+			}
+			fail("Should have gotten an IndexOutOfBoundsException trying to set a combined index of 4");
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
+	
+	/**
+	 * Tries to set an array where the given length and source index combined exceed the length of the array 
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetBadLengthPlusSrcIndexArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			IJavaArray javaArray = type.newInstance(3);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaValue bite = target.newValue((byte)-1);
+			IJavaValue[] replacements = {bite, bite, bite};
+			try {
+				array.setValues(0, 2, replacements, 2);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				//got the expected exception
+				return;
+			}
+			fail("Should have gotten an IndexOutOfBoundsException trying to set a combined source index of 4");
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
+	
+	/**
+	 * Tries to set an array where the source array is longer than the array to set the values into
+	 * @throws Exception
+	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=359450
+	 */
+	public void testSetLongerSrcArray() throws Exception {
+		String typeName = "ByteArrayTests";
+		ILineBreakpoint bp = createLineBreakpoint(32, typeName);
+		
+		IJavaThread thread = null;
+		try {
+			thread= launchToLineBreakpoint(typeName, bp);
+			IJavaStackFrame frame = (IJavaStackFrame) thread.getTopStackFrame();
+			assertNotNull(frame);
+			IJavaVariable v = findVariable(frame, "bytes");
+			assertNotNull(v);
+			IJavaArrayType type = (IJavaArrayType) v.getJavaType();
+			IJavaValue value = (IJavaValue) v.getValue();
+			assertNotNull(value);
+			IJavaArray javaArray = type.newInstance(3);
+			v.setValue(javaArray);
+			IJavaArray  array = (IJavaArray) v.getValue();
+			IJavaDebugTarget target = (IJavaDebugTarget) frame.getDebugTarget();
+			IJavaValue bite = target.newValue((byte)-1);
+			IJavaValue[] replacements = {bite, bite, bite, bite, bite, bite};
+			try {
+				array.setValues(0, -1, replacements, 0);
+			}
+			catch(IndexOutOfBoundsException ioobe) {
+				fail("Should not have gotten an IndexOutOfBoundsException trying to set an oversized source array");
+			}
+		} finally {
+			terminateAndRemove(thread);
+			removeAllBreakpoints();
+		}	
+	}
 }
diff --git a/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/ArrayReferenceImpl.java b/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/ArrayReferenceImpl.java
index 9218e7b..093f99a 100644
--- a/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/ArrayReferenceImpl.java
+++ b/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/ArrayReferenceImpl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -28,6 +28,7 @@
 import com.sun.jdi.ClassNotLoadedException;
 import com.sun.jdi.InternalException;
 import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Mirror;
 import com.sun.jdi.ObjectCollectedException;
 import com.sun.jdi.Type;
 import com.sun.jdi.Value;
@@ -168,7 +169,11 @@
 	}
 	
 	/**
-	 * @returns Returns sequence of values of primitive type.
+	 * @param length the number of primitives to read
+	 * @param type the type
+	 * @param in the input stream
+	 * @return Returns sequence of values of primitive type.
+	 * @throws IOException if reading from the stream encounters a problem
 	 */
 	private List readPrimitiveSequence(int length, int type, DataInputStream in) throws IOException {
 		List elements = new ArrayList(length);
@@ -180,7 +185,7 @@
 	}
 	
 	/**
-	 * @returns Returns the number of components in this array.
+	 * @return Returns the number of components in this array.
 	 */
 	public int length() {
 		if (fLength == -1) {
@@ -202,6 +207,11 @@
 	
 	/**
 	 * Replaces an array component with another value.
+	 * @param index the index to set the value in
+	 * @param value the new value
+	 * @throws InvalidTypeException thrown if the types of the replacements do not match the underlying type of the {@link ArrayReference}
+	 * @throws ClassNotLoadedException thrown if the class type for the {@link ArrayReference} is not loaded or has been GC'd
+	 * @see #setValues(int, List, int, int)
 	 */
 	public void setValue(int index, Value value) throws InvalidTypeException, ClassNotLoadedException {
 		ArrayList list = new ArrayList(1);
@@ -211,6 +221,11 @@
 	
 	/**
 	 * Replaces all array components with other values.
+	 * 
+	 * @param values the new values to set in the array
+	 * @throws InvalidTypeException thrown if the types of the replacements do not match the underlying type of the {@link ArrayReference}
+	 * @throws ClassNotLoadedException thrown if the class type for the {@link ArrayReference} is not loaded or has been GC'd
+	 * @see #setValues(int, List, int, int)
 	 */
 	public void setValues(List values) throws InvalidTypeException, ClassNotLoadedException {
 		setValues(0, values, 0, -1);
@@ -218,9 +233,19 @@
 	
 	/**
 	 * Replaces a range of array components with other values.
+	 * 
+	 * @param index offset in this array to start replacing values at
+	 * @param values replacement values 
+	 * @param srcIndex the first offset where values are copied from the given replacement values
+	 * @param length the number of values to replace in this array
+	 * @throws InvalidTypeException thrown if the types of the replacements do not match the underlying type of the {@link ArrayReference}
+	 * @throws ClassNotLoadedException thrown if the class type for the {@link ArrayReference} is not loaded or has been GC'd
 	 */
 	public void setValues(int index, List values, int srcIndex, int length) throws InvalidTypeException, ClassNotLoadedException {
-		
+		if(values == null || values.size() == 0) {
+			//trying to set nothing should do no work
+			return;
+		}
 		int valuesSize= values.size();
 		int arrayLength= length();
 		
@@ -284,8 +309,14 @@
 	}
 
 	/**
-	 * Check the type and the vm of the values. If the given type is a primitive type,
-	 * the values may be convert for match this type.
+	 * Check the type and the VM of the values. If the given type is a primitive type,
+	 * the values may be converted to match this type.
+	 * 
+	 * @param values the value(s) to check
+	 * @param type the type to compare the values to
+	 * @return the list of values converted to the given type
+	 * @throws InvalidTypeException if the underlying type of an object in the list is not compatible 
+	 * 
 	 * @see ValueImpl#checkValue(Value, Type, VirtualMachineImpl)
 	 */
 	private List checkValues(List values, Type type) throws InvalidTypeException {
@@ -297,8 +328,8 @@
 		return checkedValues;
 	}
 	
-	/**
-	 * @return Returns description of Mirror object.
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdi.internal.ObjectReferenceImpl#toString()
 	 */
 	public String toString() {
 		try {
@@ -317,7 +348,12 @@
 	}
 
 	/**
+	 * Reads JDWP representation and returns new instance.
+	 * 
+	 * @param target the target {@link Mirror} object
+	 * @param in the input stream to read from
 	 * @return Reads JDWP representation and returns new instance.
+	 * @throws IOException if there is a problem reading from the stream
 	 */
 	public static ArrayReferenceImpl read(MirrorImpl target, DataInputStream in) throws IOException {
 		VirtualMachineImpl vmImpl = target.virtualMachineImpl();