harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r350181 [57/198] - in /incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core: ./ depends/ depends/files/ depends/jars/ depends/libs/ depends/libs/linux.IA32/ depends/libs/win.IA32/ depends/oss/ depends/oss/linux.IA32/ depends/oss/win.I...
Date Thu, 01 Dec 2005 06:04:00 GMT
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Array.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Array.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Array.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Array.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,481 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.lang.reflect;
+
+/**
+ * This class must be implemented by the vm vendor. This class provides methods
+ * to dynamically create and access arrays.
+ * 
+ */
+public final class Array {
+
+	/**
+	 * Return the element of the array at the specified index. This reproduces
+	 * the effect of <code>array[index]</code> If the array component is a
+	 * base type, the result is automatically wrapped.
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element, possibly wrapped
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native Object get(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * boolean if possible. This reproduces the effect of
+	 * <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native boolean getBoolean(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * byte if possible. This reproduces the effect of <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native byte getByte(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * char if possible. This reproduces the effect of <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native char getChar(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * double if possible. This reproduces the effect of
+	 * <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native double getDouble(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * float if possible. This reproduces the effect of
+	 * <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native float getFloat(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to an
+	 * int if possible. This reproduces the effect of <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native int getInt(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the length of the array. This reproduces the effect of
+	 * <code>array.length</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @return the length
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array
+	 */
+	public static native int getLength(Object array)
+			throws IllegalArgumentException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * long if possible. This reproduces the effect of <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native long getLong(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * short if possible. This reproduces the effect of
+	 * <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native short getShort(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	private static native Object multiNewArrayImpl(Class componentType,
+			int dimensions, int[] dimensionsArray);
+
+	private static native Object newArrayImpl(Class componentType, int dimension);
+
+	/**
+	 * Return a new multidimensional array of the specified component type and
+	 * dimensions. This reproduces the effect of
+	 * <code>new componentType[d0][d1]...[dn]</code> for a dimensions array of {
+	 * d0, d1, ... , dn }
+	 * 
+	 * @param componentType
+	 *            the component type of the new array
+	 * @param dimensions
+	 *            the dimensions of the new array
+	 * @return the new array
+	 * @exception java.lang.NullPointerException
+	 *                if the component type is null
+	 * @exception java.lang.NegativeArraySizeException
+	 *                if any of the dimensions are negative
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array of dimensions is of size zero, or exceeds the
+	 *                limit of the number of dimension for an array (currently
+	 *                255)
+	 */
+	public static Object newInstance(Class componentType, int[] dimensions)
+			throws NegativeArraySizeException, IllegalArgumentException {
+		return null;
+	}
+
+	/**
+	 * Return a new array of the specified component type and length. This
+	 * reproduces the effect of <code>new componentType[size]</code>
+	 * 
+	 * @param componentType
+	 *            the component type of the new array
+	 * @param size
+	 *            the length of the new array
+	 * @return the new array
+	 * @exception java.lang.NullPointerException
+	 *                if the component type is null
+	 * @exception java.lang.NegativeArraySizeException
+	 *                if the size if negative
+	 */
+	public static Object newInstance(Class componentType, int size)
+			throws NegativeArraySizeException {
+		return null;
+	}
+
+	/**
+	 * Set the element of the array at the specified index to the value. This
+	 * reproduces the effect of <code>array[index] = value</code> If the array
+	 * component is a base type, the value is automatically unwrapped
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void set(Object array, int index, Object value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the boolean value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setBoolean(Object array, int index, boolean value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the byte value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setByte(Object array, int index, byte value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the char value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setChar(Object array, int index, char value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the double value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setDouble(Object array, int index, double value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the float value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setFloat(Object array, int index, float value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the int value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setInt(Object array, int index, int value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the long value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setLong(Object array, int index, long value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the short value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setShort(Object array, int index, short value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Constructor.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Constructor.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Constructor.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Constructor.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,167 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.lang.reflect;
+
+/**
+ * This class must be implemented by the vm vendor. This class models a
+ * constructor. Information about the constructor can be accessed, and the
+ * constructor can be invoked dynamically.
+ * 
+ */
+public final class Constructor extends AccessibleObject implements Member {
+
+	/**
+	 * Compares the specified object to this Constructor and answer if they are
+	 * equal. The object must be an instance of Constructor with the same
+	 * defining class and parameter types.
+	 * 
+	 * @param object
+	 *            the object to compare
+	 * @return true if the specified object is equal to this Constructor, false
+	 *         otherwise
+	 * @see #hashCode
+	 */
+	public boolean equals(Object object) {
+		return false;
+	}
+
+	/**
+	 * Return the java.lang.Class associated with the class that defined this
+	 * constructor.
+	 * 
+	 * @return the declaring class
+	 */
+	public Class getDeclaringClass() {
+		return null;
+	}
+
+	/**
+	 * Return an array of the java.lang.Class objects associated with the
+	 * exceptions declared to be thrown by this constructor. If the constructor
+	 * was not declared to throw any exceptions, the array returned will be
+	 * empty.
+	 * 
+	 * @return the declared exception classes
+	 */
+	public Class[] getExceptionTypes() {
+		return null;
+	}
+
+	/**
+	 * Return the modifiers for the modelled constructor. The Modifier class
+	 * should be used to decode the result.
+	 * 
+	 * @return the modifiers
+	 * @see java.lang.reflect.Modifier
+	 */
+	public int getModifiers() {
+		return 0;
+	}
+
+	/**
+	 * Return the name of the modelled constructor. This is the name of the
+	 * declaring class.
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return null;
+	}
+
+	/**
+	 * Return an array of the java.lang.Class objects associated with the
+	 * parameter types of this constructor. If the constructor was declared with
+	 * no parameters, the array returned will be empty.
+	 * 
+	 * @return the parameter types
+	 */
+	public Class[] getParameterTypes() {
+		return null;
+	}
+
+	/**
+	 * Answers an integer hash code for the receiver. Objects which are equal
+	 * answer the same value for this method. The hash code for a Constructor is
+	 * the hash code of the declaring class' name.
+	 * 
+	 * @return the receiver's hash
+	 * @see #equals
+	 */
+	public int hashCode() {
+		return 0;
+	}
+
+	/**
+	 * Return a new instance of the declaring class, initialized by dynamically
+	 * invoking the modelled constructor. This reproduces the effect of
+	 * <code>new declaringClass(arg1, arg2, ... , argN)</code> This method
+	 * performs the following:
+	 * <ul>
+	 * <li>A new instance of the declaring class is created. If the declaring
+	 * class cannot be instantiated (i.e. abstract class, an interface, an array
+	 * type, or a base type) then an InstantiationException is thrown.</li>
+	 * <li>If this Constructor object is enforcing access control (see
+	 * AccessibleObject) and the modelled constructor is not accessible from the
+	 * current context, an IllegalAccessException is thrown.</li>
+	 * <li>If the number of arguments passed and the number of parameters do
+	 * not match, an IllegalArgumentException is thrown.</li>
+	 * <li>For each argument passed:
+	 * <ul>
+	 * <li>If the corresponding parameter type is a base type, the argument is
+	 * unwrapped. If the unwrapping fails, an IllegalArgumentException is
+	 * thrown.</li>
+	 * <li>If the resulting argument cannot be converted to the parameter type
+	 * via a widening conversion, an IllegalArgumentException is thrown.</li>
+	 * </ul>
+	 * <li>The modelled constructor is then invoked. If an exception is thrown
+	 * during the invocation, it is caught and wrapped in an
+	 * InvocationTargetException. This exception is then thrown. If the
+	 * invocation completes normally, the newly initialized object is returned.
+	 * </ul>
+	 * 
+	 * @param args
+	 *            the arguments to the constructor
+	 * @return the new, initialized, object
+	 * @exception java.lang.InstantiationException
+	 *                if the class cannot be instantiated
+	 * @exception java.lang.IllegalAccessException
+	 *                if the modelled constructor is not accessible
+	 * @exception java.lang.IllegalArgumentException
+	 *                if an incorrect number of arguments are passed, or an
+	 *                argument could not be converted by a widening conversion
+	 * @exception java.lang.reflect.InvocationTargetException
+	 *                if an exception was thrown by the invoked constructor
+	 * @see java.lang.reflect.AccessibleObject
+	 */
+	public Object newInstance(Object args[]) throws InstantiationException,
+			IllegalAccessException, IllegalArgumentException,
+			InvocationTargetException {
+		return null;
+	}
+
+	/**
+	 * Answers a string containing a concise, human-readable description of the
+	 * receiver. The format of the string is modifiers (if any) declaring class
+	 * name '(' parameter types, separated by ',' ')' If the constructor throws
+	 * exceptions, ' throws ' exception types, separated by ',' For example:
+	 * <code>public String(byte[],String) throws UnsupportedEncodingException</code>
+	 * 
+	 * @return a printable representation for the receiver
+	 */
+	public String toString() {
+		return null;
+	}
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Field.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Field.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Field.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Field.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,624 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.lang.reflect;
+
+/**
+ * This class must be implemented by the vm vendor. This class models a field.
+ * Information about the field can be accessed, and the field's value can be
+ * accessed dynamically.
+ * 
+ */
+public final class Field extends AccessibleObject implements Member {
+
+	/**
+	 * Compares the specified object to this Field and answer if they are equal.
+	 * The object must be an instance of Field with the same defining class and
+	 * name.
+	 * 
+	 * @param object
+	 *            the object to compare
+	 * @return true if the specified object is equal to this Field, false
+	 *         otherwise
+	 * @see #hashCode
+	 */
+	public boolean equals(Object object) {
+		return false;
+	}
+
+	/**
+	 * Return the value of the field in the specified object. This reproduces
+	 * the effect of <code>object.fieldName</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * The value of the field is returned. If the type of this field is a base
+	 * type, the field value is automatically wrapped.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @return the field value, possibly wrapped
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native Object get(Object object) throws IllegalAccessException,
+			IllegalArgumentException;
+
+	/**
+	 * Return the value of the field in the specified object as a boolean. This
+	 * reproduces the effect of <code>object.fieldName</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @return the field value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native boolean getBoolean(Object object)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Return the value of the field in the specified object as a byte. This
+	 * reproduces the effect of <code>object.fieldName</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @return the field value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native byte getByte(Object object) throws IllegalAccessException,
+			IllegalArgumentException;
+
+	/**
+	 * Return the value of the field in the specified object as a char. This
+	 * reproduces the effect of <code>object.fieldName</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @return the field value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native char getChar(Object object) throws IllegalAccessException,
+			IllegalArgumentException;
+
+	/**
+	 * Return the java.lang.Class associated with the class that defined this
+	 * field.
+	 * 
+	 * @return the declaring class
+	 */
+	public Class getDeclaringClass() {
+		return null;
+	}
+
+	/**
+	 * Return the value of the field in the specified object as a double. This
+	 * reproduces the effect of <code>object.fieldName</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @return the field value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native double getDouble(Object object)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Return the value of the field in the specified object as a float. This
+	 * reproduces the effect of <code>object.fieldName</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @return the field value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native float getFloat(Object object) throws IllegalAccessException,
+			IllegalArgumentException;
+
+	/**
+	 * Return the value of the field in the specified object as an int. This
+	 * reproduces the effect of <code>object.fieldName</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @return the field value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native int getInt(Object object) throws IllegalAccessException,
+			IllegalArgumentException;
+
+	/**
+	 * Return the value of the field in the specified object as a long. This
+	 * reproduces the effect of <code>object.fieldName</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @return the field value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native long getLong(Object object) throws IllegalAccessException,
+			IllegalArgumentException;
+
+	/**
+	 * Return the modifiers for the modelled field. The Modifier class should be
+	 * used to decode the result.
+	 * 
+	 * @return the modifiers
+	 * @see java.lang.reflect.Modifier
+	 */
+	public native int getModifiers();
+
+	/**
+	 * Return the name of the modelled field.
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return null;
+	}
+
+	/**
+	 * Return the value of the field in the specified object as a short. This
+	 * reproduces the effect of <code>object.fieldName</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @return the field value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native short getShort(Object object) throws IllegalAccessException,
+			IllegalArgumentException;
+
+	native String getSignature();
+
+	/**
+	 * Return the java.lang.Class associated with the type of this field.
+	 * 
+	 * @return the type
+	 */
+	public Class getType() {
+		return null;
+	}
+
+	/**
+	 * Answers an integer hash code for the receiver. Objects which are equal
+	 * answer the same value for this method.
+	 * <p>
+	 * The hash code for a Field is the hash code of the field's name.
+	 * 
+	 * @return the receiver's hash
+	 * @see #equals
+	 */
+	public int hashCode() {
+		return 0;
+	}
+
+	/**
+	 * Set the value of the field in the specified object to the boolean value.
+	 * This reproduces the effect of <code>object.fieldName = value</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * If the field type is a base type, the value is automatically unwrapped.
+	 * If the unwrap fails, an IllegalArgumentException is thrown. If the value
+	 * cannot be converted to the field type via a widening conversion, an
+	 * IllegalArgumentException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @param value
+	 *            the new value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native void set(Object object, Object value)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Set the value of the field in the specified object to the boolean value.
+	 * This reproduces the effect of <code>object.fieldName = value</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * If the value cannot be converted to the field type via a widening
+	 * conversion, an IllegalArgumentException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @param value
+	 *            the new value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native void setBoolean(Object object, boolean value)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Set the value of the field in the specified object to the byte value.
+	 * This reproduces the effect of <code>object.fieldName = value</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * If the value cannot be converted to the field type via a widening
+	 * conversion, an IllegalArgumentException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @param value
+	 *            the new value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native void setByte(Object object, byte value)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Set the value of the field in the specified object to the char value.
+	 * This reproduces the effect of <code>object.fieldName = value</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * If the value cannot be converted to the field type via a widening
+	 * conversion, an IllegalArgumentException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @param value
+	 *            the new value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native void setChar(Object object, char value)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Set the value of the field in the specified object to the double value.
+	 * This reproduces the effect of <code>object.fieldName = value</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * If the value cannot be converted to the field type via a widening
+	 * conversion, an IllegalArgumentException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @param value
+	 *            the new value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native void setDouble(Object object, double value)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Set the value of the field in the specified object to the float value.
+	 * This reproduces the effect of <code>object.fieldName = value</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * If the value cannot be converted to the field type via a widening
+	 * conversion, an IllegalArgumentException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @param value
+	 *            the new value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native void setFloat(Object object, float value)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Set the value of the field in the specified object to the int value. This
+	 * reproduces the effect of <code>object.fieldName = value</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * If the value cannot be converted to the field type via a widening
+	 * conversion, an IllegalArgumentException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @param value
+	 *            the new value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native void setInt(Object object, int value)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Set the value of the field in the specified object to the long value.
+	 * This reproduces the effect of <code>object.fieldName = value</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * If the value cannot be converted to the field type via a widening
+	 * conversion, an IllegalArgumentException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @param value
+	 *            the new value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native void setLong(Object object, long value)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Set the value of the field in the specified object to the short value.
+	 * This reproduces the effect of <code>object.fieldName = value</code>
+	 * <p>
+	 * If the modelled field is static, the object argument is ignored.
+	 * Otherwise, if the object is null, a NullPointerException is thrown. If
+	 * the object is not an instance of the declaring class of the method, an
+	 * IllegalArgumentException is thrown.
+	 * <p>
+	 * If this Field object is enforcing access control (see AccessibleObject)
+	 * and the modelled field is not accessible from the current context, an
+	 * IllegalAccessException is thrown.
+	 * <p>
+	 * If the value cannot be converted to the field type via a widening
+	 * conversion, an IllegalArgumentException is thrown.
+	 * 
+	 * @param object
+	 *            the object to access
+	 * @param value
+	 *            the new value
+	 * @throws NullPointerException
+	 *             if the object is null and the field is non-static
+	 * @throws IllegalArgumentException
+	 *             if the object is not compatible with the declaring class
+	 * @throws IllegalAccessException
+	 *             if modelled field is not accessible
+	 */
+	public native void setShort(Object object, short value)
+			throws IllegalAccessException, IllegalArgumentException;
+
+	/**
+	 * Answers a string containing a concise, human-readable description of the
+	 * receiver.
+	 * <p>
+	 * The format of the string is:
+	 * <ul>
+	 * <li>modifiers (if any)
+	 * <li>return type
+	 * <li>declaring class name
+	 * <li>'.'
+	 * <li>field name
+	 * </ul>
+	 * <p>
+	 * For example:
+	 * <code>public static java.io.InputStream java.lang.System.in</code>
+	 * 
+	 * @return a printable representation for the receiver
+	 */
+	public String toString() {
+		return null;
+	}
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Method.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Method.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Method.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/lang/reflect/Method.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,186 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.lang.reflect;
+
+/**
+ * This class must be implemented by the vm vendor. This class models a method.
+ * Information about the method can be accessed, and the method can be invoked
+ * dynamically.
+ * 
+ */
+public final class Method extends AccessibleObject implements Member {
+	/**
+	 * Compares the specified object to this Method and answer if they are
+	 * equal. The object must be an instance of Method with the same defining
+	 * class and parameter types.
+	 * 
+	 * @param object
+	 *            the object to compare
+	 * @return true if the specified object is equal to this Method, false
+	 *         otherwise
+	 * @see #hashCode
+	 */
+	public boolean equals(Object object) {
+		return false;
+	}
+
+	/**
+	 * Return the java.lang.Class associated with the class that defined this
+	 * constructor.
+	 * 
+	 * @return the declaring class
+	 */
+	public Class getDeclaringClass() {
+		return null;
+	}
+
+	/**
+	 * Return an array of the java.lang.Class objects associated with the
+	 * exceptions declared to be thrown by this method. If the method was not
+	 * declared to throw any exceptions, the array returned will be empty.
+	 * 
+	 * @return the declared exception classes
+	 */
+	public Class[] getExceptionTypes() {
+		return null;
+	}
+
+	/**
+	 * Return the modifiers for the modelled constructor. The Modifier class
+	 * should be used to decode the result.
+	 * 
+	 * @return the modifiers
+	 * @see java.lang.reflect.Modifier
+	 */
+	public int getModifiers() {
+		return 0;
+	}
+
+	/**
+	 * Return the name of the modelled method.
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return null;
+	}
+
+	/**
+	 * Return an array of the java.lang.Class objects associated with the
+	 * parameter types of this method. If the method was declared with no
+	 * parameters, the array returned will be empty.
+	 * 
+	 * @return the parameter types
+	 */
+	public Class[] getParameterTypes() {
+		return null;
+	}
+
+	/**
+	 * Return the java.lang.Class associated with the return type of this
+	 * method.
+	 * 
+	 * @return the return type
+	 */
+	public Class getReturnType() {
+		return null;
+	}
+
+	/**
+	 * Answers an integer hash code for the receiver. Objects which are equal
+	 * answer the same value for this method. The hash code for a Method is the
+	 * hash code of the method's name.
+	 * 
+	 * @return the receiver's hash
+	 * @see #equals
+	 */
+	public int hashCode() {
+		return 0;
+	}
+
+	/**
+	 * Return the result of dynamically invoking the modelled method. This
+	 * reproduces the effect of
+	 * <code>receiver.methodName(arg1, arg2, ... , argN)</code> This method
+	 * performs the following:
+	 * <ul>
+	 * <li>If the modelled method is static, the receiver argument is ignored.
+	 * </li>
+	 * <li>Otherwise, if the receiver is null, a NullPointerException is
+	 * thrown.</li>
+	 * If the receiver is not an instance of the declaring class of the method,
+	 * an IllegalArgumentException is thrown.
+	 * <li>If this Method object is enforcing access control (see
+	 * AccessibleObject) and the modelled method is not accessible from the
+	 * current context, an IllegalAccessException is thrown.</li>
+	 * <li>If the number of arguments passed and the number of parameters do
+	 * not match, an IllegalArgumentException is thrown.</li>
+	 * <li>For each argument passed:
+	 * <ul>
+	 * <li>If the corresponding parameter type is a base type, the argument is
+	 * unwrapped. If the unwrapping fails, an IllegalArgumentException is
+	 * thrown.</li>
+	 * <li>If the resulting argument cannot be converted to the parameter type
+	 * via a widening conversion, an IllegalArgumentException is thrown.</li>
+	 * </ul>
+	 * <li>If the modelled method is static, it is invoked directly. If it is
+	 * non-static, the modelled method and the receiver are then used to perform
+	 * a standard dynamic method lookup. The resulting method is then invoked.
+	 * </li>
+	 * <li>If an exception is thrown during the invocation it is caught and
+	 * wrapped in an InvocationTargetException. This exception is then thrown.
+	 * </li>
+	 * <li>If the invocation completes normally, the return value is itself
+	 * returned. If the method is declared to return a base type, the return
+	 * value is first wrapped. If the return type is void, null is returned.
+	 * </li>
+	 * </ul>
+	 * 
+	 * @param args
+	 *            the arguments to the constructor
+	 * @return the new, initialized, object
+	 * @exception java.lang.NullPointerException
+	 *                if the receiver is null for a non-static method
+	 * @exception java.lang.IllegalAccessException
+	 *                if the modelled method is not accessible
+	 * @exception java.lang.IllegalArgumentException
+	 *                if an incorrect number of arguments are passed, the
+	 *                receiver is incompatible with the declaring class, or an
+	 *                argument could not be converted by a widening conversion
+	 * @exception java.lang.reflect.InvocationTargetException
+	 *                if an exception was thrown by the invoked constructor
+	 * @see java.lang.reflect.AccessibleObject
+	 */
+	public Object invoke(Object receiver, Object args[])
+			throws IllegalAccessException, IllegalArgumentException,
+			InvocationTargetException {
+		return null;
+	}
+
+	/**
+	 * Answers a string containing a concise, human-readable description of the
+	 * receiver. The format of the string is modifiers (if any) return type
+	 * declaring class name '.' method name '(' parameter types, separated by
+	 * ',' ')' If the method throws exceptions, ' throws ' exception types,
+	 * separated by ',' For example:
+	 * <code>public native Object java.lang.Method.invoke(Object,Object) throws IllegalAccessException,IllegalArgumentException,InvocationTargetException</code>
+	 * 
+	 * @return a printable representation for the receiver
+	 */
+	public String toString() {
+		return null;
+	}
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/security/AccessControlContext.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/security/AccessControlContext.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/security/AccessControlContext.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/security/AccessControlContext.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,163 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.security;
+
+/**
+ * The vm vendor may choose to implement this class. The reference
+ * implementation must be used if the reference implementation of
+ * AccessController is used.
+ * 
+ * An AccessControlContext encapsulates the information which is needed by class
+ * AccessController to detect if a Permission would be granted at a particular
+ * point in a programs execution.
+ * 
+ */
+
+public final class AccessControlContext {
+	DomainCombiner domainCombiner;
+
+	ProtectionDomain[] domainsArray;
+
+	private static final SecurityPermission createAccessControlContext = new SecurityPermission(
+			"createAccessControlContext");
+
+	private static final SecurityPermission getDomainCombiner = new SecurityPermission(
+			"getDomainCombiner");
+
+	/**
+	 * Constructs a new instance of this class given an array of protection
+	 * domains.
+	 * 
+	 */
+	public AccessControlContext(ProtectionDomain[] context) {
+		int length = context.length;
+		int domainIndex = 0;
+		this.domainsArray = new ProtectionDomain[length];
+		next: for (int i = 0; i < length; i++) {
+			ProtectionDomain current = context[i];
+			for (int j = 0; j < i; j++)
+				if (current == this.domainsArray[j])
+					continue next;
+			this.domainsArray[domainIndex++] = current;
+		}
+		if (domainIndex != length) {
+			ProtectionDomain[] copy = new ProtectionDomain[domainIndex];
+			System.arraycopy(this.domainsArray, 0, copy, 0, domainIndex);
+			this.domainsArray = copy;
+		}
+	}
+
+	AccessControlContext(ProtectionDomain[] context, boolean ignored) {
+		domainsArray = context;
+	}
+
+	/**
+	 * Constructs a new instance of this class given a context and a
+	 * DomainCombiner
+	 */
+	public AccessControlContext(AccessControlContext acc,
+			DomainCombiner combiner) {
+		SecurityManager security = System.getSecurityManager();
+		if (security != null)
+			security.checkPermission(createAccessControlContext);
+		this.domainsArray = acc.domainsArray;
+		this.domainCombiner = combiner;
+	}
+
+	/**
+	 * Checks if the permission <code>perm</code> is allowed in this context.
+	 * All ProtectionDomains must grant the permission for it to be granted.
+	 * 
+	 * @param perm
+	 *            java.security.Permission the permission to check
+	 * @exception java.security.AccessControlException
+	 *                thrown when perm is not granted.
+	 */
+	public void checkPermission(Permission perm) throws AccessControlException {
+		if (perm == null)
+			throw new NullPointerException();
+		int i = domainsArray.length;
+		while (--i >= 0 && domainsArray[i].implies(perm))
+			;
+		if (i >= 0) {
+			throw new AccessControlException("Access Denied", perm);
+		}
+	}
+
+	/**
+	 * Compares the argument to the receiver, and answers true if they represent
+	 * the <em>same</em> object using a class specific comparison. In this
+	 * case, they must both be AccessControlContexts and contain the same
+	 * protection domains.
+	 * 
+	 * 
+	 * @param o
+	 *            the object to compare with this object
+	 * @return <code>true</code> if the object is the same as this object
+	 *         <code>false</code> if it is different from this object
+	 * @see #hashCode
+	 */
+	public boolean equals(Object o) {
+		if (this == o)
+			return true;
+		if (o == null || this.getClass() != o.getClass())
+			return false;
+		AccessControlContext otherContext = (AccessControlContext) o;
+		ProtectionDomain[] otherDomains = otherContext.domainsArray;
+		int length = domainsArray.length;
+		if (length != otherDomains.length)
+			return false;
+
+		next: for (int i = 0; i < length; i++) {
+			ProtectionDomain current = domainsArray[i];
+			for (int j = 0; j < length; j++)
+				if (current == otherDomains[j])
+					continue next;
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Answers an integer hash code for the receiver. Any two objects which
+	 * answer <code>true</code> when passed to <code>equals</code> must
+	 * answer the same value for this method.
+	 * 
+	 * 
+	 * @return the receiver's hash
+	 * 
+	 * @see #equals
+	 */
+	public int hashCode() {
+		int result = 0;
+		int i = domainsArray.length;
+		while (--i >= 0)
+			result ^= domainsArray[i].hashCode();
+		return result;
+	}
+
+	/**
+	 * Answers the DomainCombiner for the receiver.
+	 * 
+	 */
+	public DomainCombiner getDomainCombiner() {
+		SecurityManager security = System.getSecurityManager();
+		if (security != null)
+			security.checkPermission(getDomainCombiner);
+		return domainCombiner;
+	}
+
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/security/AccessController.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/security/AccessController.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/security/AccessController.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/kernel/src/java/security/AccessController.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,271 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.security;
+
+/**
+ * This class must be implemented by the vm vendor, or the reference
+ * implementation can be used if the documented native is implemented.
+ * 
+ * Checks access to system resources. Supports marking of code as priveleged.
+ * Makes context snapshots to allow checking from other contexts.
+ * 
+ */
+
+public final class AccessController {
+	static {
+		// Initialize vm-internal caches
+		initializeInternal();
+	}
+
+	private static native void initializeInternal();
+
+	/**
+	 * Prevents this class from being instantiated.
+	 */
+	private AccessController() {
+	}
+
+	/**
+	 * This native must be implemented to use the reference implementation of
+	 * this class. It is used by checkPermission() and getContext(), which call
+	 * this native with depth = 1.
+	 * 
+	 * Returns an array of ProtectionDomain from the classes on the stack, from
+	 * the specified depth up to the first privileged frame, or the end of the
+	 * stack if there is not a privileged frame. The array may be larger than
+	 * required, but must be null terminated. As bootstrap classes have all
+	 * permissions, bootstrap class frames SHOULD be skipped. Bootstrap class
+	 * frames MUST be skipped if the ProtectionDomain of bootstrap classes is
+	 * null. Duplicate ProtectionDomains SHOULD be removed.
+	 * 
+	 * The first element of the result is the AccessControlContext, which may be
+	 * null, either from the privileged frame, or from the current Thread if
+	 * there is not a privileged frame.
+	 * 
+	 * A privileged frame is any frame running one of the following methods:
+	 * 
+	 * <code><ul>
+	 * <li>java/security/AccessController.doPrivileged(Ljava/security/PrivilegedAction;)Ljava/lang/Object;</li>
+	 * <li>java/security/AccessController.doPrivileged(Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;</li>
+	 * <li>java/security/AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;</li>
+	 * <li>java/security/AccessController.doPrivileged(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;</li>
+	 * </ul></code>
+	 * 
+	 * @param depth
+	 *            The stack depth at which to start. Depth 0 is the current
+	 *            frame (the caller of this native).
+	 * 
+	 * @return an Object[] where the first element is AccessControlContext, and
+	 *         the other elements are ProtectionsDomain.
+	 */
+
+	private static native Object[] getProtectionDomains(int depth);
+
+	/**
+	 * Checks whether the running program is allowed to access the resource
+	 * being guarded by the given Permission argument.
+	 * 
+	 * 
+	 * @param perm
+	 *            the permission to check
+	 * @exception AccessControlException
+	 *                if access is not allowed.
+	 */
+	public static void checkPermission(Permission perm)
+			throws AccessControlException {
+		if (perm == null)
+			throw new NullPointerException();
+		Object[] domains = getProtectionDomains(1);
+		AccessControlContext acc = (AccessControlContext) domains[0];
+		ProtectionDomain[] pDomains = null;
+		if (acc != null && acc.domainCombiner != null) {
+			pDomains = acc.domainCombiner.combine(toArrayOfProtectionDomains(
+					domains, null), acc.domainsArray);
+		} else {
+			pDomains = toArrayOfProtectionDomains(domains, acc);
+		}
+		for (int i = 0, length = pDomains.length; i < length; i++) {
+			if (!pDomains[i].implies(perm)) {
+				throw new AccessControlException("Access Denied " + perm, perm);
+			}
+		}
+	}
+
+	/**
+	 * Used to keep the context live during doPrivileged().
+	 * 
+	 * 
+	 * @see #doPrivileged(PrivilegedAction, AccessControlContext)
+	 */
+	private static void keepalive(AccessControlContext context) {
+	}
+
+	/**
+	 * Answers the access controller context of the current thread, including
+	 * the inherited ones. It basically retrieves all the protection domains
+	 * from the calling stack and creates an <code>AccessControlContext</code>
+	 * with them.
+	 * 
+	 * 
+	 * @see AccessControlContext
+	 */
+	public static AccessControlContext getContext() {
+		Object[] domains = getProtectionDomains(1);
+		AccessControlContext acc = (AccessControlContext) domains[0];
+		ProtectionDomain[] pDomains = null;
+		if (acc != null && acc.domainCombiner != null) {
+			pDomains = acc.domainCombiner.combine(toArrayOfProtectionDomains(
+					domains, null), acc.domainsArray);
+			AccessControlContext result = new AccessControlContext(pDomains,
+					false);
+			result.domainCombiner = acc.domainCombiner;
+			return result;
+		}
+		return new AccessControlContext(
+				toArrayOfProtectionDomains(domains, acc), false);
+	}
+
+	private static ProtectionDomain[] toArrayOfProtectionDomains(
+			Object[] domains, AccessControlContext acc) {
+		int len = 0, size = domains.length - 1;
+		int extra = acc == null ? 0 : acc.domainsArray.length;
+		ProtectionDomain[] answer = new ProtectionDomain[size + extra];
+		for (int i = 1; i <= size; i++) {
+			boolean found = false;
+			if ((answer[len] = (ProtectionDomain) domains[i]) == null)
+				break;
+			if (acc != null) {
+				for (int j = 0; j < acc.domainsArray.length; j++) {
+					if (answer[len] == acc.domainsArray[j]) {
+						found = true;
+						break;
+					}
+				}
+			}
+			if (!found)
+				len++;
+		}
+		if (len == 0 && acc != null)
+			return acc.domainsArray;
+		else if (len < size) {
+			ProtectionDomain[] copy = new ProtectionDomain[len + extra];
+			System.arraycopy(answer, 0, copy, 0, len);
+			answer = copy;
+		}
+		if (acc != null)
+			System.arraycopy(acc.domainsArray, 0, answer, len,
+					acc.domainsArray.length);
+		return answer;
+	}
+
+	/**
+	 * Performs the privileged action specified by <code>action</code>.
+	 * <p>
+	 * When permission checks are made, if the permission has been granted by
+	 * all frames below and including the one representing the call to this
+	 * method, then the permission is granted. In otherwords, the check stops
+	 * here.
+	 * 
+	 * Any unchecked exception generated by this method will propagate up the
+	 * chain.
+	 * 
+	 * 
+	 * @see #doPrivileged(PrivilegedAction)
+	 */
+	public static Object doPrivileged(PrivilegedAction action) {
+		return action.run();
+	}
+
+	/**
+	 * Performs the privileged action specified by <code>action</code>.
+	 * <p>
+	 * When permission checks are made, if the permission has been granted by
+	 * all frames below and including the one representing the call to this
+	 * method, then the permission is granted iff it is granted by the
+	 * AccessControlContext <code>context</code>. In otherwords, no more
+	 * checking of the current stack is performed. Instead, the passed in
+	 * context is checked.
+	 * 
+	 * Any unchecked exception generated by this method will propagate up the
+	 * chain.
+	 * 
+	 * 
+	 * @see #doPrivileged(PrivilegedAction)
+	 */
+	public static Object doPrivileged(PrivilegedAction action,
+			AccessControlContext context) {
+		Object result = action.run();
+		keepalive(context);
+		return result;
+	}
+
+	/**
+	 * Performs the privileged action specified by <code>action</code>.
+	 * <p>
+	 * When permission checks are made, if the permission has been granted by
+	 * all frames below and including the one representing the call to this
+	 * method, then the permission is granted. In otherwords, the check stops
+	 * here.
+	 * 
+	 * Any unchecked exception generated by this method will propagate up the
+	 * chain. However, checked exceptions will be caught an re-thrown as
+	 * PrivilegedActionExceptions
+	 * 
+	 * 
+	 * @see #doPrivileged(PrivilegedAction)
+	 */
+	public static Object doPrivileged(PrivilegedExceptionAction action)
+			throws PrivilegedActionException {
+		try {
+			return action.run();
+		} catch (RuntimeException ex) {
+			throw ex;
+		} catch (Exception ex) {
+			throw new PrivilegedActionException(ex);
+		}
+	}
+
+	/**
+	 * Performs the privileged action specified by <code>action</code>.
+	 * <p>
+	 * When permission checks are made, if the permission has been granted by
+	 * all frames below and including the one representing the call to this
+	 * method, then the permission is granted iff it is granted by the
+	 * AccessControlContext <code>context</code>. In otherwords, no more
+	 * checking of the current stack is performed. Instead, the passed in
+	 * context is checked.
+	 * 
+	 * Any unchecked exception generated by this method will propagate up the
+	 * chain. However, checked exceptions will be caught an re-thrown as
+	 * PrivilegedActionExceptions
+	 * 
+	 * 
+	 * @see #doPrivileged(PrivilegedAction)
+	 */
+	public static Object doPrivileged(PrivilegedExceptionAction action,
+			AccessControlContext context) throws PrivilegedActionException {
+		try {
+			Object result = action.run();
+			keepalive(context);
+			return result;
+		} catch (RuntimeException ex) {
+			throw ex;
+		} catch (Exception ex) {
+			throw new PrivilegedActionException(ex);
+		}
+	}
+
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/META-INF/MANIFEST.MF?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/META-INF/MANIFEST.MF (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/META-INF/MANIFEST.MF Wed Nov 30 21:29:27 2005
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Harmony LUNI
+Bundle-SymbolicName: org.apache.harmony.luni
+Bundle-Version: 1.0.0
+Bundle-ClassPath: .
+Eclipse-JREBundle: true
+Import-Package: com.ibm.io.nio.factory,
+ java.nio.charset,
+ java.security,
+ java.util.jar,
+ java.util.regex,
+ java.util.zip
+Export-Package: com.ibm.misc.util,
+ com.ibm.oti.util,
+ java.io,
+ java.lang,
+ java.lang.ref,
+ java.lang.reflect,
+ java.net,
+ java.util
+

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/com/ibm/misc/util/NotYetImplementedException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/com/ibm/misc/util/NotYetImplementedException.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/com/ibm/misc/util/NotYetImplementedException.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/com/ibm/misc/util/NotYetImplementedException.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,89 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.misc.util;
+
+
+/**
+ * This exception is thrown by methods that are not currently implemented, so
+ * that programs that call the stubs fail early and predictably.
+ * 
+ */
+public class NotYetImplementedException extends RuntimeException {
+
+	/**
+	 * Comment for <code>serialVersionUID</code>
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Default constructor.
+	 */
+	public NotYetImplementedException() {
+		super();
+		System.err.println("*** NOT YET IMPLEMENTED EXCEPTION ***"); //$NON-NLS-1$
+		StackTraceElement thrower = getStackTrace()[0];
+		System.err
+				.println("*** thrown from class  -> " + thrower.getClassName()); //$NON-NLS-1$
+		System.err
+				.println("***             method -> " + thrower.getMethodName()); //$NON-NLS-1$
+
+		System.err.print("*** defined in         -> "); //$NON-NLS-1$
+		if (thrower.isNativeMethod()) {
+			System.err.println("a native method"); //$NON-NLS-1$
+		} else {
+			String fileName = thrower.getFileName();
+			if (fileName == null) {
+				System.err.println("an unknown source"); //$NON-NLS-1$
+			} else {
+				int lineNumber = thrower.getLineNumber();
+				System.err.print("the file \"" + fileName + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+				if (lineNumber >= 0) {
+					System.err.print(" on line #" + lineNumber); //$NON-NLS-1$
+				}
+				System.err.println();
+			}
+		}
+	}
+
+	/**
+	 * Constructor that takes a reason message.
+	 * 
+	 * @param detailMessage
+	 */
+	public NotYetImplementedException(String detailMessage) {
+		super(detailMessage);
+	}
+
+	/**
+	 * Constructor that takes a reason and a wrapped exception.
+	 * 
+	 * @param detailMessage
+	 * @param throwable
+	 */
+	public NotYetImplementedException(String detailMessage, Throwable throwable) {
+		super(detailMessage, throwable);
+	}
+
+	/**
+	 * Constructor that takes a wrapped exception.
+	 * 
+	 * @param throwable
+	 */
+	public NotYetImplementedException(Throwable throwable) {
+		super(throwable);
+	}
+
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/com/ibm/oti/lang/ProcessInputStream.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/com/ibm/oti/lang/ProcessInputStream.java?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/com/ibm/oti/lang/ProcessInputStream.java (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/java-src/luni/src/com/ibm/oti/lang/ProcessInputStream.java Wed Nov 30 21:29:27 2005
@@ -0,0 +1,171 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.oti.lang;
+
+
+class ProcessInputStream extends java.io.InputStream {
+
+	private long handle;
+
+	private java.io.FileDescriptor fd;
+
+	// Fill in the JNI id caches
+	private static native void oneTimeInitialization();
+
+	static {
+		oneTimeInitialization();
+	}
+
+	/**
+	 * Open an InputStream based on the handle.
+	 */
+	protected ProcessInputStream(long handle) {
+		this.fd = new java.io.FileDescriptor();
+		setFDImpl(fd, handle);
+		this.handle = handle;
+	}
+
+	/**
+	 * Answers a int representing then number of bytes that are available before
+	 * this InputStream will block.
+	 * 
+	 * @return the number of bytes available before blocking.
+	 * 
+	 * @throws java.io.IOException
+	 *             If an error occurs in this InputStream.
+	 */
+	public int available() throws java.io.IOException {
+		synchronized (this) {
+			if (handle == -1)
+				return -1;
+			return availableImpl();
+		}
+	}
+
+	/**
+	 * Native to determine the bytes available.
+	 */
+	private native int availableImpl() throws java.io.IOException;
+
+	/*
+	 * There is no way, at the library/vm level, to know when the stream will be
+	 * available for closing. If the user doesn't close it in his code, the
+	 * finalize() will run (eventually ?) and close the dangling OS
+	 * fileDescriptor.
+	 */
+	protected void finalize() throws Throwable {
+		close();
+	}
+
+	/**
+	 * Close the stream.
+	 */
+	public void close() throws java.io.IOException {
+		synchronized (this) {
+			if (handle == -1)
+				return;
+			closeImpl();
+			handle = -1;
+		}
+	}
+
+	/**
+	 * Native to close the stream.
+	 */
+	private native void closeImpl() throws java.io.IOException;
+
+	/**
+	 * Reads a single byte from this InputStream and returns the result as an
+	 * int. The low-order byte is returned or -1 of the end of stream was
+	 * encountered.
+	 * 
+	 * @return the byte read or -1 if end of stream.
+	 * 
+	 * @throws java.io.IOException
+	 *             If the stream is already closed or another IOException
+	 *             occurs.
+	 */
+	public int read() throws java.io.IOException {
+		byte buf[] = new byte[1];
+		synchronized (this) {
+			if (readImpl(buf, 0, 1, handle) == -1)
+				return -1;
+		}
+
+		return buf[0];
+	}
+
+	/**
+	 * Reads bytes from the Stream and stores them in byte array
+	 * <code>buffer</code>. Answer the number of bytes actually read or -1 if
+	 * no bytes were read and end of stream was encountered.
+	 * 
+	 * @param buffer
+	 *            the byte array in which to store the read bytes.
+	 * @return the number of bytes actually read or -1 if end of stream.
+	 * 
+	 * @throws java.io.IOException
+	 *             If the stream is already closed or another IOException
+	 *             occurs.
+	 */
+	public int read(byte[] buffer) throws java.io.IOException {
+		synchronized (this) {
+			return readImpl(buffer, 0, buffer.length, handle);
+		}
+	}
+
+	/**
+	 * Reads at most <code>nbytes</code> bytes from the Stream and stores them
+	 * in byte array <code>buffer</code> starting at <code>offset</code>.
+	 * Answer the number of bytes actually read or -1 if no bytes were read and
+	 * end of stream was encountered.
+	 * 
+	 * @param buffer
+	 *            the byte array in which to store the read bytes.
+	 * @param offset
+	 *            the offset in <code>buffer</code> to store the read bytes.
+	 * @param nbytes
+	 *            the maximum number of bytes to store in <code>buffer</code>.
+	 * @return the number of bytes actually read or -1 if end of stream.
+	 * 
+	 * @throws java.io.IOException
+	 *             If the stream is already closed or another IOException
+	 *             occurs.
+	 */
+	public int read(byte[] buffer, int offset, int nbytes)
+			throws java.io.IOException {
+		synchronized (this) {
+			if (handle == -1)
+				return -1;
+			if ((nbytes < 0 || nbytes > buffer.length)
+					|| (offset < 0 || offset > buffer.length)
+					|| ((nbytes + offset) > buffer.length))
+				throw new ArrayIndexOutOfBoundsException();
+			return readImpl(buffer, offset, nbytes, handle);
+		}
+	}
+
+	/**
+	 * Native to read into the buffer from the stream.
+	 */
+	private native int readImpl(byte[] buf, int offset, int nbytes, long hndl)
+			throws java.io.IOException;
+
+	/**
+	 * Native to set the FileDescriptor handle.
+	 */
+	private native void setFDImpl(java.io.FileDescriptor fd, long handle);
+}



Mime
View raw message