/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
implements ArrayReference
{
}
// The method has to be a method on Object since
// arrays don't have methods nor any other 'superclasses'
// So, use the ClassTypeImpl for Object instead of
// the ArrayTypeImpl for the array itself.
}
return (ArrayTypeImpl)type();
}
/**
* Return array length.
* Need not be synchronized since it cannot be provably stale.
*/
public int length() {
if(length == -1) {
try {
} catch (JDWPException exc) {
throw exc.toJDIException();
}
}
return length;
}
}
}
/**
* length of -1 (meaning rest of array) has been converted
* before entry.
*/
// because length can be computed from index,
// index must be tested first for correct error message
throw new IndexOutOfBoundsException(
"Invalid array index: " + index);
}
if (length < 0) {
throw new IndexOutOfBoundsException(
"Invalid array range length: " + length);
}
throw new IndexOutOfBoundsException(
"Invalid array range: " +
}
}
@SuppressWarnings("unchecked")
return (T)x;
}
}
if (length == 0) {
}
try {
} catch (JDWPException exc) {
throw exc.toJDIException();
}
return vals;
}
throws InvalidTypeException,
}
throws InvalidTypeException,
}
throws InvalidTypeException,
// shorter of, the rest of the array and rest of
// the source values
}
throw new IndexOutOfBoundsException(
"Invalid source index: " + srcIndex);
}
throw new IndexOutOfBoundsException(
"Invalid source range: " +
srcIndex + " to " +
}
boolean somethingToSet = false;;
for (int i = 0; i < length; i++) {
try {
// Validate and convert if necessary
setValues[i] =
new Component());
somethingToSet = true;
} catch (ClassNotLoadedException e) {
/*
* Since we got this exception,
* the component must be a reference type.
* This means the class has not yet been loaded
* through the defining class's class loader.
* If the value we're trying to set is null,
* then setting to null is essentially a
* no-op, and we should allow it without an
* exception.
*/
throw e;
}
}
}
if (somethingToSet) {
try {
} catch (JDWPException exc) {
throw exc.toJDIException();
}
}
}
}
byte typeValueKey() {
}
throws InvalidTypeException, ClassNotLoadedException {
try {
super.validateAssignment(destination);
} catch (ClassNotLoadedException e) {
/*
* An array can be used extensively without the
* enclosing loader being recorded by the VM as an
* initiating loader of the array type. In addition, the
* load of an array class is fairly harmless as long as
* the component class is already loaded. So we relax the
* rules a bit and allow the assignment as long as the
* ultimate component types are assignable.
*/
boolean valid = false;
destination.signature());
/*
* Remove all dimensions from the destination. Remove
* the same number of dimensions from the source.
* Get types for both and check to see if they are
* compatible.
*/
}
if (!valid) {
throw new InvalidTypeException("Cannot assign " +
" to " +
destination.typeName());
}
}
}
/*
* Represents an array component to other internal parts of this
* implementation. This is not exposed at the JDI level. Currently,
* this class is needed only for type checking so it does not even
* reference a particular component - just a generic component
* of this array. In the future we may need to expand its use.
*/
return arrayType().componentType();
}
return arrayType().componentTypeName();
}
return arrayType().componentSignature();
}
}
}
}