harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r390443 [4/5] - in /incubator/harmony/enhanced/classlib/trunk: make/ make/patternsets/ modules/kernel/ modules/luni-kernel/ modules/luni-kernel/META-INF/ modules/luni-kernel/src/ modules/luni-kernel/src/main/ modules/luni-kernel/src/main/ja...
Date Fri, 31 Mar 2006 15:34:51 GMT
Added: incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/PhantomReference.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/PhantomReference.java?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/PhantomReference.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/PhantomReference.java Fri Mar 31 07:34:47 2006
@@ -0,0 +1,49 @@
+/* Copyright 1998, 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 java.lang.ref;
+
+/**
+ * PhantomReference objects are used to detect referents which are no longer
+ * visible and are eligible to have their storage reclaimed.
+ * 
+ * @since JDK1.2
+ */
+public class PhantomReference extends java.lang.ref.Reference {
+
+	/**
+	 * Return the referent of the reference object. Phantom reference objects
+	 * referents are inaccessible, and so null is returned.
+	 * 
+	 * 
+	 * @return Object Returns null.
+	 */
+	public Object get() {
+		return null;
+	}
+
+	/**
+	 * Constructs a new instance of this class.
+	 * 
+	 * 
+	 * @param r
+	 *            referent to track.
+	 * @param q
+	 *            queue to register to the reference object with.
+	 */
+	public PhantomReference(Object r, ReferenceQueue q) {
+		super();
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/Reference.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/Reference.java?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/Reference.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/Reference.java Fri Mar 31 07:34:47 2006
@@ -0,0 +1,120 @@
+/* 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.ref;
+
+/**
+ * This class must be implemented by the vm vendor. The documented methods must
+ * be implemented to support the provided subclass implementations. As the
+ * provided subclass implementations are trivial and simply call
+ * initReference(Object) and initReference(Object, ReferenceQueue) from their
+ * constructors, the vm vendor may elect to implement the subclasses as well.
+ * Abstract class which describes behavior common to all reference objects.
+ * 
+ * @since JDK1.2
+ */
+public abstract class Reference extends Object {
+
+	/**
+	 * Make the referent null. This does not force the reference object to be
+	 * enqueued.
+	 * 
+	 */
+	public void clear() {
+		return;
+	}
+
+	/**
+	 * Force the reference object to be enqueued if it has been associated with
+	 * a queue.
+	 * 
+	 * @return boolean true if Reference is enqueued. false otherwise.
+	 */
+	public boolean enqueue() {
+		return false;
+	}
+
+	/**
+	 * Return the referent of the reference object.
+	 * 
+	 * @return Object Referent to which reference refers, or null if object has
+	 *         been cleared.
+	 */
+	public Object get() {
+		return null;
+	}
+
+	/**
+	 * Return whether the reference object has been enqueued.
+	 * 
+	 * @return boolean true if Reference has been enqueued. false otherwise.
+	 */
+	public boolean isEnqueued() {
+		return false;
+	}
+
+	/**
+	 * Enqueue the reference object on the associated queue.
+	 * 
+	 * @return boolean true if the Reference was successfully enqueued. false
+	 *         otherwise.
+	 */
+	boolean enqueueImpl() {
+		return false;
+	}
+
+	/**
+	 * Constructs a new instance of this class.
+	 * 
+	 */
+	Reference() {
+		super();
+	}
+
+	/**
+	 * Implement this method to support the provided subclass implementations.
+	 * Initialize a newly created reference object. Associate the reference
+	 * object with the referent.
+	 * 
+	 * @param r
+	 *            the referent
+	 */
+	void initReference(Object r) {
+		return;
+	}
+
+	/**
+	 * Implement this method to support the provided subclass implementations.
+	 * Initialize a newly created reference object. Associate the reference
+	 * object with the referent, and the specified ReferenceQueue.
+	 * 
+	 * @param r
+	 *            the referent
+	 * @param q
+	 *            the ReferenceQueue
+	 */
+	void initReference(Object r, ReferenceQueue q) {
+		return;
+	}
+
+	/**
+	 * Called when a Reference has been removed from its ReferenceQueue.
+	 * Set the enqueued field to false.
+	 */
+	void dequeue() {
+		return;
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/SoftReference.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/SoftReference.java?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/SoftReference.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/SoftReference.java Fri Mar 31 07:34:47 2006
@@ -0,0 +1,62 @@
+/* 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.ref;
+
+/**
+ * SoftReference objects are used to detect referents which are no longer
+ * visible and who's memory is to be reclaimed.
+ * 
+ * @since JDK1.2
+ */
+public class SoftReference extends java.lang.ref.Reference {
+	private int age;
+
+	/**
+	 * Constructs a new instance of this class.
+	 * 
+	 * 
+	 * @param r
+	 *            referent to track.
+	 * @param q
+	 *            queue to register to the reference object with.
+	 */
+	public SoftReference(Object r, ReferenceQueue q) {
+		initReference(r, q);
+	}
+
+	/**
+	 * Constructs a new instance of this class.
+	 * 
+	 * 
+	 * @param r
+	 *            referent to track.
+	 */
+	public SoftReference(Object r) {
+		initReference(r);
+	}
+
+	/**
+	 * Return the referent of the reference object.
+	 * 
+	 * 
+	 * @return Object Referent to which reference refers, or null if object has
+	 *         been cleared.
+	 */
+	public Object get() {
+		return super.get();
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/WeakReference.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/WeakReference.java?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/WeakReference.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/ref/WeakReference.java Fri Mar 31 07:34:47 2006
@@ -0,0 +1,49 @@
+/* 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.ref;
+
+/**
+ * WeakReference objects are used to detect referents which are no longer
+ * visible.
+ * 
+ * @since JDK1.2
+ */
+public class WeakReference extends java.lang.ref.Reference {
+
+	/**
+	 * Constructs a new instance of this class.
+	 * 
+	 * 
+	 * @param r
+	 *            referent to track.
+	 * @param q
+	 *            queue to register to the reference object with.
+	 */
+	public WeakReference(Object r, ReferenceQueue q) {
+		initReference(r, q);
+	}
+
+	/**
+	 * Constructs a new instance of this class.
+	 * 
+	 * 
+	 * @param r
+	 *            referent to track.
+	 */
+	public WeakReference(Object r) {
+		initReference(r);
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/AccessibleObject.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/AccessibleObject.java?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/AccessibleObject.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/AccessibleObject.java Fri Mar 31 07:34:47 2006
@@ -0,0 +1,146 @@
+/* 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 is the superclass
+ * of all member reflect classes (Field, Constructor, Method). AccessibleObject
+ * provides the ability to toggle access checks for these objects. By default
+ * accessing a member (for example, setting a field or invoking a method) checks
+ * the validity of the access (for example, invoking a private method from
+ * outside the defining class is prohibited) and throws IllegalAccessException
+ * if the operation is not permitted. If the accessible flag is set to true,
+ * these checks are omitted. This allows privileged applications such as Java
+ * Object Serialization, inspectors, and debuggers to have complete access to
+ * objects.
+ * 
+ * @see Field
+ * @see Constructor
+ * @see Method
+ * @see ReflectPermission
+ */
+public class AccessibleObject {
+	static final Object[] emptyArgs = new Object[0];
+
+	/**
+	 * AccessibleObject constructor. AccessibleObjects can only be created by
+	 * the Virtual Machine.
+	 */
+	protected AccessibleObject() {
+		super();
+	}
+
+	/**
+	 * Returns the value of the accessible flag. This is false if access checks
+	 * are performed, true if they are skipped.
+	 * 
+	 * @return the value of the accessible flag
+	 */
+	public boolean isAccessible() {
+		return false;
+	}
+
+	/**
+	 * Attempts to set the value of the accessible flag for all the objects in
+	 * the array provided. Only one security check is performed. Setting this
+	 * flag to false will enable access checks, setting to true will disable
+	 * them. If there is a security manager, checkPermission is called with a
+	 * ReflectPermission("suppressAccessChecks").
+	 * 
+	 * @param objects
+	 *            the accessible objects
+	 * @param flag
+	 *            the new value for the accessible flag
+	 * @see #setAccessible(boolean)
+	 * @see ReflectPermission
+	 * @throws SecurityException
+	 *             if the request is denied
+	 */
+	public static void setAccessible(AccessibleObject[] objects, boolean flag)
+			throws SecurityException {
+		return;
+	}
+
+	/**
+	 * Attempts to set the value of the accessible flag. Setting this flag to
+	 * false will enable access checks, setting to true will disable them. If
+	 * there is a security manager, checkPermission is called with a
+	 * ReflectPermission("suppressAccessChecks").
+	 * 
+	 * @param flag
+	 *            the new value for the accessible flag
+	 * @see ReflectPermission
+	 * @throws SecurityException
+	 *             if the request is denied
+	 */
+	public void setAccessible(boolean flag) throws SecurityException {
+		return;
+	}
+
+	static Object[] marshallArguments(Class[] parameterTypes, Object[] args)
+			throws IllegalArgumentException {
+		return null;
+	}
+
+	void invokeV(Object receiver, Object args[])
+			throws InvocationTargetException {
+		return;
+	}
+
+	Object invokeL(Object receiver, Object args[])
+			throws InvocationTargetException {
+		return null;
+	}
+
+	int invokeI(Object receiver, Object args[])
+			throws InvocationTargetException {
+		return 0;
+	}
+
+	long invokeJ(Object receiver, Object args[])
+			throws InvocationTargetException {
+		return 0L;
+	}
+
+	float invokeF(Object receiver, Object args[])
+			throws InvocationTargetException {
+		return 0.0F;
+	}
+
+	double invokeD(Object receiver, Object args[])
+			throws InvocationTargetException {
+		return 0.0D;
+	}
+
+	native Class[] getParameterTypesImpl();
+
+	native int getModifiers();
+
+	native Class[] getExceptionTypesImpl();
+
+	native String getSignature();
+
+	native boolean checkAccessibility(Class senderClass, Object receiver);
+
+	static native void initializeClass(Class clazz);
+
+	/**
+	 * Answer the class at depth. Notes: 1) This method operates on the defining
+	 * classes of methods on stack. NOT the classes of receivers. 2) The item at
+	 * index zero describes the caller of this method.
+	 */
+	static final native Class getStackClass(int depth);
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Array.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Array.java?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Array.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Array.java Fri Mar 31 07:34:47 2006
@@ -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/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Constructor.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Constructor.java?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Constructor.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Constructor.java Fri Mar 31 07:34:47 2006
@@ -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/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Field.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Field.java?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Field.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Field.java Fri Mar 31 07:34:47 2006
@@ -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/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Method.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Method.java?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Method.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/reflect/Method.java Fri Mar 31 07:34:47 2006
@@ -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/classlib/trunk/modules/security-kernel/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security-kernel/META-INF/MANIFEST.MF?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security-kernel/META-INF/MANIFEST.MF (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security-kernel/META-INF/MANIFEST.MF Fri Mar 31 07:34:47 2006
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Harmony Security Kernel
+Fragment-Host: org.apache.harmony.security;bundle-version="1.0.0"
+Bundle-SymbolicName: org.apache.harmony.security.kernel
+Bundle-Version: 1.0.0
+Bundle-ClassPath: .
+Eclipse-JREBundle: true
+Export-Package: java.security

Added: incubator/harmony/enhanced/classlib/trunk/modules/security-kernel/src/main/java/java/security/AccessControlContext.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security-kernel/src/main/java/java/security/AccessControlContext.java?rev=390443&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security-kernel/src/main/java/java/security/AccessControlContext.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security-kernel/src/main/java/java/security/AccessControlContext.java Fri Mar 31 07:34:47 2006
@@ -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;
+	}
+
+}



Mime
View raw message