Index: /luni-kernel/src/main/java/java/lang/reflect/Method.java =================================================================== --- /luni-kernel/src/main/java/java/lang/reflect/Method.java (revision 409856) +++ /luni-kernel/src/main/java/java/lang/reflect/Method.java (working copy) @@ -15,13 +15,147 @@ package java.lang.reflect; +import java.lang.annotation.Annotation; + /** - * This class must be implemented by the vm vendor. This class models a method. + * 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 { +public final class Method extends AccessibleObject implements GenericDeclaration, Member { + + public TypeVariable[] getTypeParameters() { + return null; + } + + /** + *

+ * Returns the String representation of the method's declaration, including + * the type parameters. + *

+ * + * @return An instance of String. + * @since 1.5 + */ + public String toGenericString() { + return null; + } + + /** + *

+ * Gets the parameter types as an array of {@link Type} instances, in + * declaration order. If the method has no parameters, then an empty array + * is returned. + *

+ * + * @return An array of {@link Type} instances. + * @throws GenericSignatureFormatError if the generic method signature is + * invalid. + * @throws TypeNotPresentException if the component type points to a missing + * type. + * @throws MalformedParameterizedTypeException if the component type points + * to a type that can't be instantiated for some reason. + * @since 1.5 + */ + public Type[] getGenericParameterTypes() { + return null; + } + + /** + *

+ * Gets the exception types as an array of {@link Type} instances. If the + * method has no declared exceptions, then an empty array is returned. + *

+ * + * @return An array of {@link Type} instances. + * @throws GenericSignatureFormatError if the generic method signature is + * invalid. + * @throws TypeNotPresentException if the component type points to a missing + * type. + * @throws MalformedParameterizedTypeException if the component type points + * to a type that can't be instantiated for some reason. + * @since 1.5 + */ + public Type[] getGenericExceptionTypes() { + return null; + } + + /** + *

+ * Gets the return type as a {@link Type} instance. + *

+ * + * @return A {@link Type} instance. + * @throws GenericSignatureFormatError if the generic method signature is + * invalid. + * @throws TypeNotPresentException if the component type points to a missing + * type. + * @throws MalformedParameterizedTypeException if the component type points + * to a type that can't be instantiated for some reason. + * @since 1.5 + */ + public Type getGenericReturnType() { + return null; + } + + /** + *

+ * Gets an array of arrays that represent the annotations of the formal + * parameters of this method. If there are no parameters on this method, + * then an empty array is returned. If there are no annotations set, then + * and array of empty arrays is returned. + *

+ * + * @return An array of arrays of {@link Annotation} instances. + * @since 1.5 + */ + public Annotation[][] getParameterAnnotations() { + return null; + } + + /** + *

+ * Indicates whether or not this method takes a variable number argument. + *

+ * + * @return A value of true if a vararg is declare, otherwise + * false. + * @since 1.5 + */ + public boolean isVarArgs() { + return false; + } + + /** + *

+ * Indicates whether or not this method is a bridge. + *

+ * + * @return A value of true if this method's a bridge, + * otherwise false. + * @since 1.5 + */ + public boolean isBridge() { + return false; + } + + public boolean isSynthetic() { + return false; + } + + /** + *

Gets the default value for the annotation member represented by + * this method.

+ * @return The default value or null if none. + * @throws TypeNotPresentException if the annotation is of type {@link Class} + * and no definition can be found. + * @since 1.5 + */ + public Object getDefaultValue() { + return null; + } + /** * 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 @@ -39,7 +173,7 @@ /** * Return the java.lang.Class associated with the class that defined this - * constructor. + * method. * * @return the declaring class */ @@ -59,7 +193,7 @@ } /** - * Return the modifiers for the modelled constructor. The Modifier class + * Return the modifiers for the modelled method. The Modifier class * should be used to decode the result. * * @return the modifiers @@ -152,7 +286,7 @@ * @param receiver * The object on which to call the modelled method * @param args - * the arguments to the constructor + * the arguments to the method * @return the new, initialized, object * @exception java.lang.NullPointerException * if the receiver is null for a non-static method @@ -163,7 +297,7 @@ * 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 + * if an exception was thrown by the invoked method * @see java.lang.reflect.AccessibleObject */ public Object invoke(Object receiver, Object args[]) Index: /luni-kernel/src/main/java/java/lang/reflect/Field.java =================================================================== --- /luni-kernel/src/main/java/java/lang/reflect/Field.java (revision 409856) +++ /luni-kernel/src/main/java/java/lang/reflect/Field.java (working copy) @@ -16,24 +16,71 @@ package java.lang.reflect; /** - * This class must be implemented by the vm vendor. This class models a field. + * 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 { + public boolean isSynthetic() { + return false; + } + + /** + *

+ * Returns the String representation of the field's declaration, including + * the type parameters. + *

+ * + * @return An instance of String. + * @since 1.5 + */ + public String toGenericString() { + return null; + } + + /** + *

+ * Indicates whether or not this field is an enumeration constant. + *

+ * + * @return A value of true if this field is an enumeration + * constant, otherwise false. + * @since 1.5 + */ + public boolean isEnumConstant() { + return false; + } + + /** + *

+ * Gets the declared type of this field. + *

+ * + * @return An instance of {@link Type}. + * @throws GenericSignatureFormatError if the generic method signature is + * invalid. + * @throws TypeNotPresentException if the component type points to a missing + * type. + * @throws MalformedParameterizedTypeException if the component type points + * to a type that can't be instantiated for some reason. + * @since 1.5 + */ + public Type getGenericType() { + return null; + } + /** - * 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 - */ + * 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; } Index: /luni-kernel/src/main/java/java/lang/reflect/AccessibleObject.java =================================================================== --- /luni-kernel/src/main/java/java/lang/reflect/AccessibleObject.java (revision 409856) +++ /luni-kernel/src/main/java/java/lang/reflect/AccessibleObject.java (working copy) @@ -15,8 +15,10 @@ package java.lang.reflect; +import java.lang.annotation.Annotation; + /** - * This class must be implemented by the vm vendor. This class is the superclass + * 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 @@ -31,8 +33,9 @@ * @see Constructor * @see Method * @see ReflectPermission + * @since 1.2 */ -public class AccessibleObject { +public class AccessibleObject implements AnnotatedElement { static final Object[] emptyArgs = new Object[0]; /** @@ -89,6 +92,22 @@ public void setAccessible(boolean flag) throws SecurityException { return; } + + public boolean isAnnotationPresent(Class annotationType) { + return false; + } + + public Annotation[] getDeclaredAnnotations() { + return new Annotation[0]; + } + + public Annotation[] getAnnotations() { + return new Annotation[0]; + } + + public T getAnnotation(Class annotationType) { + return null; + } static Object[] marshallArguments(Class[] parameterTypes, Object[] args) throws IllegalArgumentException { Index: /luni-kernel/src/main/java/java/lang/reflect/Constructor.java =================================================================== --- /luni-kernel/src/main/java/java/lang/reflect/Constructor.java (revision 409856) +++ /luni-kernel/src/main/java/java/lang/reflect/Constructor.java (working copy) @@ -15,48 +15,138 @@ package java.lang.reflect; +import java.lang.annotation.Annotation; + /** - * This class must be implemented by the vm vendor. This class models a + * 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 { +public final class Constructor extends AccessibleObject implements GenericDeclaration, Member { + public TypeVariable>[] getTypeParameters() { + return null; + } + + /** + *

+ * Returns the String representation of the constructor's declaration, + * including the type parameters. + *

+ * + * @return An instance of String. + * @since 1.5 + */ + public String toGenericString() { + return null; + } + + /** + *

+ * Gets the parameter types as an array of {@link Type} instances, in + * declaration order. If the constructor has no parameters, then an empty + * array is returned. + *

+ * + * @return An array of {@link Type} instances. + * @throws GenericSignatureFormatError if the generic method signature is + * invalid. + * @throws TypeNotPresentException if the component type points to a missing + * type. + * @throws MalformedParameterizedTypeException if the component type points + * to a type that can't be instantiated for some reason. + * @since 1.5 + */ + public Type[] getGenericParameterTypes() { + return null; + } + + /** + *

+ * Gets the exception types as an array of {@link Type} instances. If the + * constructor has no declared exceptions, then an empty array is returned. + *

+ * + * @return An array of {@link Type} instances. + * @throws GenericSignatureFormatError if the generic method signature is + * invalid. + * @throws TypeNotPresentException if the component type points to a missing + * type. + * @throws MalformedParameterizedTypeException if the component type points + * to a type that can't be instantiated for some reason. + * @since 1.5 + */ + public Type[] getGenericExceptionTypes() { + return null; + } + + /** + *

+ * Gets an array of arrays that represent the annotations of the formal + * parameters of this constructor. If there are no parameters on this + * constructor, then an empty array is returned. If there are no annotations + * set, then and array of empty arrays is returned. + *

+ * + * @return An array of arrays of {@link Annotation} instances. + * @since 1.5 + */ + public Annotation[][] getParameterAnnotations() { + return null; + } + + /** + *

+ * Indicates whether or not this constructor takes a variable number + * argument. + *

+ * + * @return A value of true if a vararg is declare, otherwise + * false. + * @since 1.5 + */ + public boolean isVarArgs() { + return false; + } + + public boolean isSynthetic() { + return false; + } + /** - * 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 - */ + * 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 + * Return the {@link Class} associated with the class that defined this * constructor. * * @return the declaring class */ - public Class getDeclaringClass() { + public Class getDeclaringClass() { return null; } /** - * Return an array of the java.lang.Class objects associated with the + * Return an array of the {@link 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() { + public Class[] getExceptionTypes() { return null; } @@ -82,13 +172,13 @@ } /** - * Return an array of the java.lang.Class objects associated with the + * Return an array of the {@link 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() { + public Class[] getParameterTypes() { return null; } @@ -146,7 +236,7 @@ * if an exception was thrown by the invoked constructor * @see java.lang.reflect.AccessibleObject */ - public Object newInstance(Object args[]) throws InstantiationException, + public T newInstance(Object... args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { return null; Index: /luni-kernel/src/main/java/java/lang/reflect/Array.java =================================================================== --- /luni-kernel/src/main/java/java/lang/reflect/Array.java (revision 409856) +++ /luni-kernel/src/main/java/java/lang/reflect/Array.java (working copy) @@ -230,10 +230,10 @@ public static native short getShort(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException; - private static native Object multiNewArrayImpl(Class componentType, + private static native Object multiNewArrayImpl(Class componentType, int dimensions, int[] dimensionsArray); - private static native Object newArrayImpl(Class componentType, int dimension); + private static native Object newArrayImpl(Class componentType, int dimension); /** * Return a new multidimensional array of the specified component type and @@ -255,7 +255,7 @@ * limit of the number of dimension for an array (currently * 255) */ - public static Object newInstance(Class componentType, int[] dimensions) + public static Object newInstance(Class componentType, int[] dimensions) throws NegativeArraySizeException, IllegalArgumentException { return null; } @@ -274,7 +274,7 @@ * @exception java.lang.NegativeArraySizeException * if the size if negative */ - public static Object newInstance(Class componentType, int size) + public static Object newInstance(Class componentType, int size) throws NegativeArraySizeException { return null; }