Bringing in few reflection types, in order to support Class.getMethods jdk7-b147
authorJaroslav Tulach <jtulach@netbeans.org>
Tue, 04 Dec 2012 13:29:17 +0100
branchjdk7-b147
changeset 25821b390daf444
parent 163 d29326a16822
child 263 13b21fcbadbe
Bringing in few reflection types, in order to support Class.getMethods
emul/src/main/java/java/lang/reflect/AccessibleObject.java
emul/src/main/java/java/lang/reflect/AnnotatedElement.java
emul/src/main/java/java/lang/reflect/Field.java
emul/src/main/java/java/lang/reflect/GenericDeclaration.java
emul/src/main/java/java/lang/reflect/InvocationTargetException.java
emul/src/main/java/java/lang/reflect/Member.java
emul/src/main/java/java/lang/reflect/Method.java
emul/src/main/java/java/lang/reflect/Modifier.java
emul/src/main/java/java/lang/reflect/Type.java
emul/src/main/java/java/lang/reflect/TypeVariable.java
emul/src/main/java/java/lang/reflect/package-info.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/emul/src/main/java/java/lang/reflect/AccessibleObject.java	Tue Dec 04 13:29:17 2012 +0100
     1.3 @@ -0,0 +1,274 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package java.lang.reflect;
    1.30 +
    1.31 +import java.security.AccessController;
    1.32 +import sun.reflect.Reflection;
    1.33 +import sun.reflect.ReflectionFactory;
    1.34 +import java.lang.annotation.Annotation;
    1.35 +
    1.36 +/**
    1.37 + * The AccessibleObject class is the base class for Field, Method and
    1.38 + * Constructor objects.  It provides the ability to flag a reflected
    1.39 + * object as suppressing default Java language access control checks
    1.40 + * when it is used.  The access checks--for public, default (package)
    1.41 + * access, protected, and private members--are performed when Fields,
    1.42 + * Methods or Constructors are used to set or get fields, to invoke
    1.43 + * methods, or to create and initialize new instances of classes,
    1.44 + * respectively.
    1.45 + *
    1.46 + * <p>Setting the {@code accessible} flag in a reflected object
    1.47 + * permits sophisticated applications with sufficient privilege, such
    1.48 + * as Java Object Serialization or other persistence mechanisms, to
    1.49 + * manipulate objects in a manner that would normally be prohibited.
    1.50 + *
    1.51 + * <p>By default, a reflected object is <em>not</em> accessible.
    1.52 + *
    1.53 + * @see Field
    1.54 + * @see Method
    1.55 + * @see Constructor
    1.56 + * @see ReflectPermission
    1.57 + *
    1.58 + * @since 1.2
    1.59 + */
    1.60 +public class AccessibleObject implements AnnotatedElement {
    1.61 +
    1.62 +    /**
    1.63 +     * The Permission object that is used to check whether a client
    1.64 +     * has sufficient privilege to defeat Java language access
    1.65 +     * control checks.
    1.66 +     */
    1.67 +    static final private java.security.Permission ACCESS_PERMISSION =
    1.68 +        new ReflectPermission("suppressAccessChecks");
    1.69 +
    1.70 +    /**
    1.71 +     * Convenience method to set the {@code accessible} flag for an
    1.72 +     * array of objects with a single security check (for efficiency).
    1.73 +     *
    1.74 +     * <p>First, if there is a security manager, its
    1.75 +     * {@code checkPermission} method is called with a
    1.76 +     * {@code ReflectPermission("suppressAccessChecks")} permission.
    1.77 +     *
    1.78 +     * <p>A {@code SecurityException} is raised if {@code flag} is
    1.79 +     * {@code true} but accessibility of any of the elements of the input
    1.80 +     * {@code array} may not be changed (for example, if the element
    1.81 +     * object is a {@link Constructor} object for the class {@link
    1.82 +     * java.lang.Class}).  In the event of such a SecurityException, the
    1.83 +     * accessibility of objects is set to {@code flag} for array elements
    1.84 +     * upto (and excluding) the element for which the exception occurred; the
    1.85 +     * accessibility of elements beyond (and including) the element for which
    1.86 +     * the exception occurred is unchanged.
    1.87 +     *
    1.88 +     * @param array the array of AccessibleObjects
    1.89 +     * @param flag  the new value for the {@code accessible} flag
    1.90 +     *              in each object
    1.91 +     * @throws SecurityException if the request is denied.
    1.92 +     * @see SecurityManager#checkPermission
    1.93 +     * @see java.lang.RuntimePermission
    1.94 +     */
    1.95 +    public static void setAccessible(AccessibleObject[] array, boolean flag)
    1.96 +        throws SecurityException {
    1.97 +        SecurityManager sm = System.getSecurityManager();
    1.98 +        if (sm != null) sm.checkPermission(ACCESS_PERMISSION);
    1.99 +        for (int i = 0; i < array.length; i++) {
   1.100 +            setAccessible0(array[i], flag);
   1.101 +        }
   1.102 +    }
   1.103 +
   1.104 +    /**
   1.105 +     * Set the {@code accessible} flag for this object to
   1.106 +     * the indicated boolean value.  A value of {@code true} indicates that
   1.107 +     * the reflected object should suppress Java language access
   1.108 +     * checking when it is used.  A value of {@code false} indicates
   1.109 +     * that the reflected object should enforce Java language access checks.
   1.110 +     *
   1.111 +     * <p>First, if there is a security manager, its
   1.112 +     * {@code checkPermission} method is called with a
   1.113 +     * {@code ReflectPermission("suppressAccessChecks")} permission.
   1.114 +     *
   1.115 +     * <p>A {@code SecurityException} is raised if {@code flag} is
   1.116 +     * {@code true} but accessibility of this object may not be changed
   1.117 +     * (for example, if this element object is a {@link Constructor} object for
   1.118 +     * the class {@link java.lang.Class}).
   1.119 +     *
   1.120 +     * <p>A {@code SecurityException} is raised if this object is a {@link
   1.121 +     * java.lang.reflect.Constructor} object for the class
   1.122 +     * {@code java.lang.Class}, and {@code flag} is true.
   1.123 +     *
   1.124 +     * @param flag the new value for the {@code accessible} flag
   1.125 +     * @throws SecurityException if the request is denied.
   1.126 +     * @see SecurityManager#checkPermission
   1.127 +     * @see java.lang.RuntimePermission
   1.128 +     */
   1.129 +    public void setAccessible(boolean flag) throws SecurityException {
   1.130 +        SecurityManager sm = System.getSecurityManager();
   1.131 +        if (sm != null) sm.checkPermission(ACCESS_PERMISSION);
   1.132 +        setAccessible0(this, flag);
   1.133 +    }
   1.134 +
   1.135 +    /* Check that you aren't exposing java.lang.Class.<init>. */
   1.136 +    private static void setAccessible0(AccessibleObject obj, boolean flag)
   1.137 +        throws SecurityException
   1.138 +    {
   1.139 +        if (obj instanceof Constructor && flag == true) {
   1.140 +            Constructor<?> c = (Constructor<?>)obj;
   1.141 +            if (c.getDeclaringClass() == Class.class) {
   1.142 +                throw new SecurityException("Can not make a java.lang.Class" +
   1.143 +                                            " constructor accessible");
   1.144 +            }
   1.145 +        }
   1.146 +        obj.override = flag;
   1.147 +    }
   1.148 +
   1.149 +    /**
   1.150 +     * Get the value of the {@code accessible} flag for this object.
   1.151 +     *
   1.152 +     * @return the value of the object's {@code accessible} flag
   1.153 +     */
   1.154 +    public boolean isAccessible() {
   1.155 +        return override;
   1.156 +    }
   1.157 +
   1.158 +    /**
   1.159 +     * Constructor: only used by the Java Virtual Machine.
   1.160 +     */
   1.161 +    protected AccessibleObject() {}
   1.162 +
   1.163 +    // Indicates whether language-level access checks are overridden
   1.164 +    // by this object. Initializes to "false". This field is used by
   1.165 +    // Field, Method, and Constructor.
   1.166 +    //
   1.167 +    // NOTE: for security purposes, this field must not be visible
   1.168 +    // outside this package.
   1.169 +    boolean override;
   1.170 +
   1.171 +    // Reflection factory used by subclasses for creating field,
   1.172 +    // method, and constructor accessors. Note that this is called
   1.173 +    // very early in the bootstrapping process.
   1.174 +    static final ReflectionFactory reflectionFactory =
   1.175 +        AccessController.doPrivileged(
   1.176 +            new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
   1.177 +
   1.178 +    /**
   1.179 +     * @throws NullPointerException {@inheritDoc}
   1.180 +     * @since 1.5
   1.181 +     */
   1.182 +    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
   1.183 +        throw new AssertionError("All subclasses should override this method");
   1.184 +    }
   1.185 +
   1.186 +    /**
   1.187 +     * @throws NullPointerException {@inheritDoc}
   1.188 +     * @since 1.5
   1.189 +     */
   1.190 +    public boolean isAnnotationPresent(
   1.191 +        Class<? extends Annotation> annotationClass) {
   1.192 +        return getAnnotation(annotationClass) != null;
   1.193 +    }
   1.194 +
   1.195 +    /**
   1.196 +     * @since 1.5
   1.197 +     */
   1.198 +    public Annotation[] getAnnotations() {
   1.199 +        return getDeclaredAnnotations();
   1.200 +    }
   1.201 +
   1.202 +    /**
   1.203 +     * @since 1.5
   1.204 +     */
   1.205 +    public Annotation[] getDeclaredAnnotations()  {
   1.206 +        throw new AssertionError("All subclasses should override this method");
   1.207 +    }
   1.208 +
   1.209 +
   1.210 +    // Shared access checking logic.
   1.211 +
   1.212 +    // For non-public members or members in package-private classes,
   1.213 +    // it is necessary to perform somewhat expensive security checks.
   1.214 +    // If the security check succeeds for a given class, it will
   1.215 +    // always succeed (it is not affected by the granting or revoking
   1.216 +    // of permissions); we speed up the check in the common case by
   1.217 +    // remembering the last Class for which the check succeeded.
   1.218 +    //
   1.219 +    // The simple security check for Constructor is to see if
   1.220 +    // the caller has already been seen, verified, and cached.
   1.221 +    // (See also Class.newInstance(), which uses a similar method.)
   1.222 +    //
   1.223 +    // A more complicated security check cache is needed for Method and Field
   1.224 +    // The cache can be either null (empty cache), a 2-array of {caller,target},
   1.225 +    // or a caller (with target implicitly equal to this.clazz).
   1.226 +    // In the 2-array case, the target is always different from the clazz.
   1.227 +    volatile Object securityCheckCache;
   1.228 +
   1.229 +    void checkAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers)
   1.230 +        throws IllegalAccessException
   1.231 +    {
   1.232 +        if (caller == clazz) {  // quick check
   1.233 +            return;             // ACCESS IS OK
   1.234 +        }
   1.235 +        Object cache = securityCheckCache;  // read volatile
   1.236 +        Class<?> targetClass = clazz;
   1.237 +        if (obj != null
   1.238 +            && Modifier.isProtected(modifiers)
   1.239 +            && ((targetClass = obj.getClass()) != clazz)) {
   1.240 +            // Must match a 2-list of { caller, targetClass }.
   1.241 +            if (cache instanceof Class[]) {
   1.242 +                Class<?>[] cache2 = (Class<?>[]) cache;
   1.243 +                if (cache2[1] == targetClass &&
   1.244 +                    cache2[0] == caller) {
   1.245 +                    return;     // ACCESS IS OK
   1.246 +                }
   1.247 +                // (Test cache[1] first since range check for [1]
   1.248 +                // subsumes range check for [0].)
   1.249 +            }
   1.250 +        } else if (cache == caller) {
   1.251 +            // Non-protected case (or obj.class == this.clazz).
   1.252 +            return;             // ACCESS IS OK
   1.253 +        }
   1.254 +
   1.255 +        // If no return, fall through to the slow path.
   1.256 +        slowCheckMemberAccess(caller, clazz, obj, modifiers, targetClass);
   1.257 +    }
   1.258 +
   1.259 +    // Keep all this slow stuff out of line:
   1.260 +    void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers,
   1.261 +                               Class<?> targetClass)
   1.262 +        throws IllegalAccessException
   1.263 +    {
   1.264 +        Reflection.ensureMemberAccess(caller, clazz, obj, modifiers);
   1.265 +
   1.266 +        // Success: Update the cache.
   1.267 +        Object cache = ((targetClass == clazz)
   1.268 +                        ? caller
   1.269 +                        : new Class<?>[] { caller, targetClass });
   1.270 +
   1.271 +        // Note:  The two cache elements are not volatile,
   1.272 +        // but they are effectively final.  The Java memory model
   1.273 +        // guarantees that the initializing stores for the cache
   1.274 +        // elements will occur before the volatile write.
   1.275 +        securityCheckCache = cache;         // write volatile
   1.276 +    }
   1.277 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/emul/src/main/java/java/lang/reflect/AnnotatedElement.java	Tue Dec 04 13:29:17 2012 +0100
     2.3 @@ -0,0 +1,112 @@
     2.4 +/*
     2.5 + * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.  Oracle designates this
    2.11 + * particular file as subject to the "Classpath" exception as provided
    2.12 + * by Oracle in the LICENSE file that accompanied this code.
    2.13 + *
    2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.17 + * version 2 for more details (a copy is included in the LICENSE file that
    2.18 + * accompanied this code).
    2.19 + *
    2.20 + * You should have received a copy of the GNU General Public License version
    2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.23 + *
    2.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.25 + * or visit www.oracle.com if you need additional information or have any
    2.26 + * questions.
    2.27 + */
    2.28 +
    2.29 +package java.lang.reflect;
    2.30 +
    2.31 +import java.lang.annotation.Annotation;
    2.32 +
    2.33 +/**
    2.34 + * Represents an annotated element of the program currently running in this
    2.35 + * VM.  This interface allows annotations to be read reflectively.  All
    2.36 + * annotations returned by methods in this interface are immutable and
    2.37 + * serializable.  It is permissible for the caller to modify the
    2.38 + * arrays returned by accessors for array-valued enum members; it will
    2.39 + * have no affect on the arrays returned to other callers.
    2.40 + *
    2.41 + * <p>If an annotation returned by a method in this interface contains
    2.42 + * (directly or indirectly) a {@link Class}-valued member referring to
    2.43 + * a class that is not accessible in this VM, attempting to read the class
    2.44 + * by calling the relevant Class-returning method on the returned annotation
    2.45 + * will result in a {@link TypeNotPresentException}.
    2.46 + *
    2.47 + * <p>Similarly, attempting to read an enum-valued member will result in
    2.48 + * a {@link EnumConstantNotPresentException} if the enum constant in the
    2.49 + * annotation is no longer present in the enum type.
    2.50 + *
    2.51 + * <p>Finally, Attempting to read a member whose definition has evolved
    2.52 + * incompatibly will result in a {@link
    2.53 + * java.lang.annotation.AnnotationTypeMismatchException} or an
    2.54 + * {@link java.lang.annotation.IncompleteAnnotationException}.
    2.55 + *
    2.56 + * @see java.lang.EnumConstantNotPresentException
    2.57 + * @see java.lang.TypeNotPresentException
    2.58 + * @see java.lang.annotation.AnnotationFormatError
    2.59 + * @see java.lang.annotation.AnnotationTypeMismatchException
    2.60 + * @see java.lang.annotation.IncompleteAnnotationException
    2.61 + * @since 1.5
    2.62 + * @author Josh Bloch
    2.63 + */
    2.64 +public interface AnnotatedElement {
    2.65 +    /**
    2.66 +     * Returns true if an annotation for the specified type
    2.67 +     * is present on this element, else false.  This method
    2.68 +     * is designed primarily for convenient access to marker annotations.
    2.69 +     *
    2.70 +     * @param annotationClass the Class object corresponding to the
    2.71 +     *        annotation type
    2.72 +     * @return true if an annotation for the specified annotation
    2.73 +     *     type is present on this element, else false
    2.74 +     * @throws NullPointerException if the given annotation class is null
    2.75 +     * @since 1.5
    2.76 +     */
    2.77 +     boolean isAnnotationPresent(Class<? extends Annotation> annotationClass);
    2.78 +
    2.79 +   /**
    2.80 +     * Returns this element's annotation for the specified type if
    2.81 +     * such an annotation is present, else null.
    2.82 +     *
    2.83 +     * @param annotationClass the Class object corresponding to the
    2.84 +     *        annotation type
    2.85 +     * @return this element's annotation for the specified annotation type if
    2.86 +     *     present on this element, else null
    2.87 +     * @throws NullPointerException if the given annotation class is null
    2.88 +     * @since 1.5
    2.89 +     */
    2.90 +    <T extends Annotation> T getAnnotation(Class<T> annotationClass);
    2.91 +
    2.92 +    /**
    2.93 +     * Returns all annotations present on this element.  (Returns an array
    2.94 +     * of length zero if this element has no annotations.)  The caller of
    2.95 +     * this method is free to modify the returned array; it will have no
    2.96 +     * effect on the arrays returned to other callers.
    2.97 +     *
    2.98 +     * @return all annotations present on this element
    2.99 +     * @since 1.5
   2.100 +     */
   2.101 +    Annotation[] getAnnotations();
   2.102 +
   2.103 +    /**
   2.104 +     * Returns all annotations that are directly present on this
   2.105 +     * element.  Unlike the other methods in this interface, this method
   2.106 +     * ignores inherited annotations.  (Returns an array of length zero if
   2.107 +     * no annotations are directly present on this element.)  The caller of
   2.108 +     * this method is free to modify the returned array; it will have no
   2.109 +     * effect on the arrays returned to other callers.
   2.110 +     *
   2.111 +     * @return All annotations directly present on this element
   2.112 +     * @since 1.5
   2.113 +     */
   2.114 +    Annotation[] getDeclaredAnnotations();
   2.115 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/emul/src/main/java/java/lang/reflect/Field.java	Tue Dec 04 13:29:17 2012 +0100
     3.3 @@ -0,0 +1,1040 @@
     3.4 +/*
     3.5 + * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + *
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.  Oracle designates this
    3.11 + * particular file as subject to the "Classpath" exception as provided
    3.12 + * by Oracle in the LICENSE file that accompanied this code.
    3.13 + *
    3.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.17 + * version 2 for more details (a copy is included in the LICENSE file that
    3.18 + * accompanied this code).
    3.19 + *
    3.20 + * You should have received a copy of the GNU General Public License version
    3.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.23 + *
    3.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    3.25 + * or visit www.oracle.com if you need additional information or have any
    3.26 + * questions.
    3.27 + */
    3.28 +
    3.29 +package java.lang.reflect;
    3.30 +
    3.31 +import sun.reflect.FieldAccessor;
    3.32 +import sun.reflect.Reflection;
    3.33 +import sun.reflect.generics.repository.FieldRepository;
    3.34 +import sun.reflect.generics.factory.CoreReflectionFactory;
    3.35 +import sun.reflect.generics.factory.GenericsFactory;
    3.36 +import sun.reflect.generics.scope.ClassScope;
    3.37 +import java.lang.annotation.Annotation;
    3.38 +import java.util.Map;
    3.39 +import sun.reflect.annotation.AnnotationParser;
    3.40 +
    3.41 +
    3.42 +/**
    3.43 + * A {@code Field} provides information about, and dynamic access to, a
    3.44 + * single field of a class or an interface.  The reflected field may
    3.45 + * be a class (static) field or an instance field.
    3.46 + *
    3.47 + * <p>A {@code Field} permits widening conversions to occur during a get or
    3.48 + * set access operation, but throws an {@code IllegalArgumentException} if a
    3.49 + * narrowing conversion would occur.
    3.50 + *
    3.51 + * @see Member
    3.52 + * @see java.lang.Class
    3.53 + * @see java.lang.Class#getFields()
    3.54 + * @see java.lang.Class#getField(String)
    3.55 + * @see java.lang.Class#getDeclaredFields()
    3.56 + * @see java.lang.Class#getDeclaredField(String)
    3.57 + *
    3.58 + * @author Kenneth Russell
    3.59 + * @author Nakul Saraiya
    3.60 + */
    3.61 +public final
    3.62 +class Field extends AccessibleObject implements Member {
    3.63 +
    3.64 +    private Class<?>            clazz;
    3.65 +    private int                 slot;
    3.66 +    // This is guaranteed to be interned by the VM in the 1.4
    3.67 +    // reflection implementation
    3.68 +    private String              name;
    3.69 +    private Class<?>            type;
    3.70 +    private int                 modifiers;
    3.71 +    // Generics and annotations support
    3.72 +    private transient String    signature;
    3.73 +    // generic info repository; lazily initialized
    3.74 +    private transient FieldRepository genericInfo;
    3.75 +    private byte[]              annotations;
    3.76 +    // Cached field accessor created without override
    3.77 +    private FieldAccessor fieldAccessor;
    3.78 +    // Cached field accessor created with override
    3.79 +    private FieldAccessor overrideFieldAccessor;
    3.80 +    // For sharing of FieldAccessors. This branching structure is
    3.81 +    // currently only two levels deep (i.e., one root Field and
    3.82 +    // potentially many Field objects pointing to it.)
    3.83 +    private Field               root;
    3.84 +
    3.85 +    // Generics infrastructure
    3.86 +
    3.87 +    private String getGenericSignature() {return signature;}
    3.88 +
    3.89 +    // Accessor for factory
    3.90 +    private GenericsFactory getFactory() {
    3.91 +        Class<?> c = getDeclaringClass();
    3.92 +        // create scope and factory
    3.93 +        return CoreReflectionFactory.make(c, ClassScope.make(c));
    3.94 +    }
    3.95 +
    3.96 +    // Accessor for generic info repository
    3.97 +    private FieldRepository getGenericInfo() {
    3.98 +        // lazily initialize repository if necessary
    3.99 +        if (genericInfo == null) {
   3.100 +            // create and cache generic info repository
   3.101 +            genericInfo = FieldRepository.make(getGenericSignature(),
   3.102 +                                               getFactory());
   3.103 +        }
   3.104 +        return genericInfo; //return cached repository
   3.105 +    }
   3.106 +
   3.107 +
   3.108 +    /**
   3.109 +     * Package-private constructor used by ReflectAccess to enable
   3.110 +     * instantiation of these objects in Java code from the java.lang
   3.111 +     * package via sun.reflect.LangReflectAccess.
   3.112 +     */
   3.113 +    Field(Class<?> declaringClass,
   3.114 +          String name,
   3.115 +          Class<?> type,
   3.116 +          int modifiers,
   3.117 +          int slot,
   3.118 +          String signature,
   3.119 +          byte[] annotations)
   3.120 +    {
   3.121 +        this.clazz = declaringClass;
   3.122 +        this.name = name;
   3.123 +        this.type = type;
   3.124 +        this.modifiers = modifiers;
   3.125 +        this.slot = slot;
   3.126 +        this.signature = signature;
   3.127 +        this.annotations = annotations;
   3.128 +    }
   3.129 +
   3.130 +    /**
   3.131 +     * Package-private routine (exposed to java.lang.Class via
   3.132 +     * ReflectAccess) which returns a copy of this Field. The copy's
   3.133 +     * "root" field points to this Field.
   3.134 +     */
   3.135 +    Field copy() {
   3.136 +        // This routine enables sharing of FieldAccessor objects
   3.137 +        // among Field objects which refer to the same underlying
   3.138 +        // method in the VM. (All of this contortion is only necessary
   3.139 +        // because of the "accessibility" bit in AccessibleObject,
   3.140 +        // which implicitly requires that new java.lang.reflect
   3.141 +        // objects be fabricated for each reflective call on Class
   3.142 +        // objects.)
   3.143 +        Field res = new Field(clazz, name, type, modifiers, slot, signature, annotations);
   3.144 +        res.root = this;
   3.145 +        // Might as well eagerly propagate this if already present
   3.146 +        res.fieldAccessor = fieldAccessor;
   3.147 +        res.overrideFieldAccessor = overrideFieldAccessor;
   3.148 +        return res;
   3.149 +    }
   3.150 +
   3.151 +    /**
   3.152 +     * Returns the {@code Class} object representing the class or interface
   3.153 +     * that declares the field represented by this {@code Field} object.
   3.154 +     */
   3.155 +    public Class<?> getDeclaringClass() {
   3.156 +        return clazz;
   3.157 +    }
   3.158 +
   3.159 +    /**
   3.160 +     * Returns the name of the field represented by this {@code Field} object.
   3.161 +     */
   3.162 +    public String getName() {
   3.163 +        return name;
   3.164 +    }
   3.165 +
   3.166 +    /**
   3.167 +     * Returns the Java language modifiers for the field represented
   3.168 +     * by this {@code Field} object, as an integer. The {@code Modifier} class should
   3.169 +     * be used to decode the modifiers.
   3.170 +     *
   3.171 +     * @see Modifier
   3.172 +     */
   3.173 +    public int getModifiers() {
   3.174 +        return modifiers;
   3.175 +    }
   3.176 +
   3.177 +    /**
   3.178 +     * Returns {@code true} if this field represents an element of
   3.179 +     * an enumerated type; returns {@code false} otherwise.
   3.180 +     *
   3.181 +     * @return {@code true} if and only if this field represents an element of
   3.182 +     * an enumerated type.
   3.183 +     * @since 1.5
   3.184 +     */
   3.185 +    public boolean isEnumConstant() {
   3.186 +        return (getModifiers() & Modifier.ENUM) != 0;
   3.187 +    }
   3.188 +
   3.189 +    /**
   3.190 +     * Returns {@code true} if this field is a synthetic
   3.191 +     * field; returns {@code false} otherwise.
   3.192 +     *
   3.193 +     * @return true if and only if this field is a synthetic
   3.194 +     * field as defined by the Java Language Specification.
   3.195 +     * @since 1.5
   3.196 +     */
   3.197 +    public boolean isSynthetic() {
   3.198 +        return Modifier.isSynthetic(getModifiers());
   3.199 +    }
   3.200 +
   3.201 +    /**
   3.202 +     * Returns a {@code Class} object that identifies the
   3.203 +     * declared type for the field represented by this
   3.204 +     * {@code Field} object.
   3.205 +     *
   3.206 +     * @return a {@code Class} object identifying the declared
   3.207 +     * type of the field represented by this object
   3.208 +     */
   3.209 +    public Class<?> getType() {
   3.210 +        return type;
   3.211 +    }
   3.212 +
   3.213 +    /**
   3.214 +     * Returns a {@code Type} object that represents the declared type for
   3.215 +     * the field represented by this {@code Field} object.
   3.216 +     *
   3.217 +     * <p>If the {@code Type} is a parameterized type, the
   3.218 +     * {@code Type} object returned must accurately reflect the
   3.219 +     * actual type parameters used in the source code.
   3.220 +     *
   3.221 +     * <p>If the type of the underlying field is a type variable or a
   3.222 +     * parameterized type, it is created. Otherwise, it is resolved.
   3.223 +     *
   3.224 +     * @return a {@code Type} object that represents the declared type for
   3.225 +     *     the field represented by this {@code Field} object
   3.226 +     * @throws GenericSignatureFormatError if the generic field
   3.227 +     *     signature does not conform to the format specified in
   3.228 +     *     <cite>The Java&trade; Virtual Machine Specification</cite>
   3.229 +     * @throws TypeNotPresentException if the generic type
   3.230 +     *     signature of the underlying field refers to a non-existent
   3.231 +     *     type declaration
   3.232 +     * @throws MalformedParameterizedTypeException if the generic
   3.233 +     *     signature of the underlying field refers to a parameterized type
   3.234 +     *     that cannot be instantiated for any reason
   3.235 +     * @since 1.5
   3.236 +     */
   3.237 +    public Type getGenericType() {
   3.238 +        if (getGenericSignature() != null)
   3.239 +            return getGenericInfo().getGenericType();
   3.240 +        else
   3.241 +            return getType();
   3.242 +    }
   3.243 +
   3.244 +
   3.245 +    /**
   3.246 +     * Compares this {@code Field} against the specified object.  Returns
   3.247 +     * true if the objects are the same.  Two {@code Field} objects are the same if
   3.248 +     * they were declared by the same class and have the same name
   3.249 +     * and type.
   3.250 +     */
   3.251 +    public boolean equals(Object obj) {
   3.252 +        if (obj != null && obj instanceof Field) {
   3.253 +            Field other = (Field)obj;
   3.254 +            return (getDeclaringClass() == other.getDeclaringClass())
   3.255 +                && (getName() == other.getName())
   3.256 +                && (getType() == other.getType());
   3.257 +        }
   3.258 +        return false;
   3.259 +    }
   3.260 +
   3.261 +    /**
   3.262 +     * Returns a hashcode for this {@code Field}.  This is computed as the
   3.263 +     * exclusive-or of the hashcodes for the underlying field's
   3.264 +     * declaring class name and its name.
   3.265 +     */
   3.266 +    public int hashCode() {
   3.267 +        return getDeclaringClass().getName().hashCode() ^ getName().hashCode();
   3.268 +    }
   3.269 +
   3.270 +    /**
   3.271 +     * Returns a string describing this {@code Field}.  The format is
   3.272 +     * the access modifiers for the field, if any, followed
   3.273 +     * by the field type, followed by a space, followed by
   3.274 +     * the fully-qualified name of the class declaring the field,
   3.275 +     * followed by a period, followed by the name of the field.
   3.276 +     * For example:
   3.277 +     * <pre>
   3.278 +     *    public static final int java.lang.Thread.MIN_PRIORITY
   3.279 +     *    private int java.io.FileDescriptor.fd
   3.280 +     * </pre>
   3.281 +     *
   3.282 +     * <p>The modifiers are placed in canonical order as specified by
   3.283 +     * "The Java Language Specification".  This is {@code public},
   3.284 +     * {@code protected} or {@code private} first, and then other
   3.285 +     * modifiers in the following order: {@code static}, {@code final},
   3.286 +     * {@code transient}, {@code volatile}.
   3.287 +     */
   3.288 +    public String toString() {
   3.289 +        int mod = getModifiers();
   3.290 +        return (((mod == 0) ? "" : (Modifier.toString(mod) + " "))
   3.291 +            + getTypeName(getType()) + " "
   3.292 +            + getTypeName(getDeclaringClass()) + "."
   3.293 +            + getName());
   3.294 +    }
   3.295 +
   3.296 +    /**
   3.297 +     * Returns a string describing this {@code Field}, including
   3.298 +     * its generic type.  The format is the access modifiers for the
   3.299 +     * field, if any, followed by the generic field type, followed by
   3.300 +     * a space, followed by the fully-qualified name of the class
   3.301 +     * declaring the field, followed by a period, followed by the name
   3.302 +     * of the field.
   3.303 +     *
   3.304 +     * <p>The modifiers are placed in canonical order as specified by
   3.305 +     * "The Java Language Specification".  This is {@code public},
   3.306 +     * {@code protected} or {@code private} first, and then other
   3.307 +     * modifiers in the following order: {@code static}, {@code final},
   3.308 +     * {@code transient}, {@code volatile}.
   3.309 +     *
   3.310 +     * @return a string describing this {@code Field}, including
   3.311 +     * its generic type
   3.312 +     *
   3.313 +     * @since 1.5
   3.314 +     */
   3.315 +    public String toGenericString() {
   3.316 +        int mod = getModifiers();
   3.317 +        Type fieldType = getGenericType();
   3.318 +        return (((mod == 0) ? "" : (Modifier.toString(mod) + " "))
   3.319 +            +  ((fieldType instanceof Class) ?
   3.320 +                getTypeName((Class)fieldType): fieldType.toString())+ " "
   3.321 +            + getTypeName(getDeclaringClass()) + "."
   3.322 +            + getName());
   3.323 +    }
   3.324 +
   3.325 +    /**
   3.326 +     * Returns the value of the field represented by this {@code Field}, on
   3.327 +     * the specified object. The value is automatically wrapped in an
   3.328 +     * object if it has a primitive type.
   3.329 +     *
   3.330 +     * <p>The underlying field's value is obtained as follows:
   3.331 +     *
   3.332 +     * <p>If the underlying field is a static field, the {@code obj} argument
   3.333 +     * is ignored; it may be null.
   3.334 +     *
   3.335 +     * <p>Otherwise, the underlying field is an instance field.  If the
   3.336 +     * specified {@code obj} argument is null, the method throws a
   3.337 +     * {@code NullPointerException}. If the specified object is not an
   3.338 +     * instance of the class or interface declaring the underlying
   3.339 +     * field, the method throws an {@code IllegalArgumentException}.
   3.340 +     *
   3.341 +     * <p>If this {@code Field} object is enforcing Java language access control, and
   3.342 +     * the underlying field is inaccessible, the method throws an
   3.343 +     * {@code IllegalAccessException}.
   3.344 +     * If the underlying field is static, the class that declared the
   3.345 +     * field is initialized if it has not already been initialized.
   3.346 +     *
   3.347 +     * <p>Otherwise, the value is retrieved from the underlying instance
   3.348 +     * or static field.  If the field has a primitive type, the value
   3.349 +     * is wrapped in an object before being returned, otherwise it is
   3.350 +     * returned as is.
   3.351 +     *
   3.352 +     * <p>If the field is hidden in the type of {@code obj},
   3.353 +     * the field's value is obtained according to the preceding rules.
   3.354 +     *
   3.355 +     * @param obj object from which the represented field's value is
   3.356 +     * to be extracted
   3.357 +     * @return the value of the represented field in object
   3.358 +     * {@code obj}; primitive values are wrapped in an appropriate
   3.359 +     * object before being returned
   3.360 +     *
   3.361 +     * @exception IllegalAccessException    if this {@code Field} object
   3.362 +     *              is enforcing Java language access control and the underlying
   3.363 +     *              field is inaccessible.
   3.364 +     * @exception IllegalArgumentException  if the specified object is not an
   3.365 +     *              instance of the class or interface declaring the underlying
   3.366 +     *              field (or a subclass or implementor thereof).
   3.367 +     * @exception NullPointerException      if the specified object is null
   3.368 +     *              and the field is an instance field.
   3.369 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.370 +     *              by this method fails.
   3.371 +     */
   3.372 +    public Object get(Object obj)
   3.373 +        throws IllegalArgumentException, IllegalAccessException
   3.374 +    {
   3.375 +        return getFieldAccessor(obj).get(obj);
   3.376 +    }
   3.377 +
   3.378 +    /**
   3.379 +     * Gets the value of a static or instance {@code boolean} field.
   3.380 +     *
   3.381 +     * @param obj the object to extract the {@code boolean} value
   3.382 +     * from
   3.383 +     * @return the value of the {@code boolean} field
   3.384 +     *
   3.385 +     * @exception IllegalAccessException    if this {@code Field} object
   3.386 +     *              is enforcing Java language access control and the underlying
   3.387 +     *              field is inaccessible.
   3.388 +     * @exception IllegalArgumentException  if the specified object is not
   3.389 +     *              an instance of the class or interface declaring the
   3.390 +     *              underlying field (or a subclass or implementor
   3.391 +     *              thereof), or if the field value cannot be
   3.392 +     *              converted to the type {@code boolean} by a
   3.393 +     *              widening conversion.
   3.394 +     * @exception NullPointerException      if the specified object is null
   3.395 +     *              and the field is an instance field.
   3.396 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.397 +     *              by this method fails.
   3.398 +     * @see       Field#get
   3.399 +     */
   3.400 +    public boolean getBoolean(Object obj)
   3.401 +        throws IllegalArgumentException, IllegalAccessException
   3.402 +    {
   3.403 +        return getFieldAccessor(obj).getBoolean(obj);
   3.404 +    }
   3.405 +
   3.406 +    /**
   3.407 +     * Gets the value of a static or instance {@code byte} field.
   3.408 +     *
   3.409 +     * @param obj the object to extract the {@code byte} value
   3.410 +     * from
   3.411 +     * @return the value of the {@code byte} field
   3.412 +     *
   3.413 +     * @exception IllegalAccessException    if this {@code Field} object
   3.414 +     *              is enforcing Java language access control and the underlying
   3.415 +     *              field is inaccessible.
   3.416 +     * @exception IllegalArgumentException  if the specified object is not
   3.417 +     *              an instance of the class or interface declaring the
   3.418 +     *              underlying field (or a subclass or implementor
   3.419 +     *              thereof), or if the field value cannot be
   3.420 +     *              converted to the type {@code byte} by a
   3.421 +     *              widening conversion.
   3.422 +     * @exception NullPointerException      if the specified object is null
   3.423 +     *              and the field is an instance field.
   3.424 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.425 +     *              by this method fails.
   3.426 +     * @see       Field#get
   3.427 +     */
   3.428 +    public byte getByte(Object obj)
   3.429 +        throws IllegalArgumentException, IllegalAccessException
   3.430 +    {
   3.431 +        return getFieldAccessor(obj).getByte(obj);
   3.432 +    }
   3.433 +
   3.434 +    /**
   3.435 +     * Gets the value of a static or instance field of type
   3.436 +     * {@code char} or of another primitive type convertible to
   3.437 +     * type {@code char} via a widening conversion.
   3.438 +     *
   3.439 +     * @param obj the object to extract the {@code char} value
   3.440 +     * from
   3.441 +     * @return the value of the field converted to type {@code char}
   3.442 +     *
   3.443 +     * @exception IllegalAccessException    if this {@code Field} object
   3.444 +     *              is enforcing Java language access control and the underlying
   3.445 +     *              field is inaccessible.
   3.446 +     * @exception IllegalArgumentException  if the specified object is not
   3.447 +     *              an instance of the class or interface declaring the
   3.448 +     *              underlying field (or a subclass or implementor
   3.449 +     *              thereof), or if the field value cannot be
   3.450 +     *              converted to the type {@code char} by a
   3.451 +     *              widening conversion.
   3.452 +     * @exception NullPointerException      if the specified object is null
   3.453 +     *              and the field is an instance field.
   3.454 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.455 +     *              by this method fails.
   3.456 +     * @see Field#get
   3.457 +     */
   3.458 +    public char getChar(Object obj)
   3.459 +        throws IllegalArgumentException, IllegalAccessException
   3.460 +    {
   3.461 +        return getFieldAccessor(obj).getChar(obj);
   3.462 +    }
   3.463 +
   3.464 +    /**
   3.465 +     * Gets the value of a static or instance field of type
   3.466 +     * {@code short} or of another primitive type convertible to
   3.467 +     * type {@code short} via a widening conversion.
   3.468 +     *
   3.469 +     * @param obj the object to extract the {@code short} value
   3.470 +     * from
   3.471 +     * @return the value of the field converted to type {@code short}
   3.472 +     *
   3.473 +     * @exception IllegalAccessException    if this {@code Field} object
   3.474 +     *              is enforcing Java language access control and the underlying
   3.475 +     *              field is inaccessible.
   3.476 +     * @exception IllegalArgumentException  if the specified object is not
   3.477 +     *              an instance of the class or interface declaring the
   3.478 +     *              underlying field (or a subclass or implementor
   3.479 +     *              thereof), or if the field value cannot be
   3.480 +     *              converted to the type {@code short} by a
   3.481 +     *              widening conversion.
   3.482 +     * @exception NullPointerException      if the specified object is null
   3.483 +     *              and the field is an instance field.
   3.484 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.485 +     *              by this method fails.
   3.486 +     * @see       Field#get
   3.487 +     */
   3.488 +    public short getShort(Object obj)
   3.489 +        throws IllegalArgumentException, IllegalAccessException
   3.490 +    {
   3.491 +        return getFieldAccessor(obj).getShort(obj);
   3.492 +    }
   3.493 +
   3.494 +    /**
   3.495 +     * Gets the value of a static or instance field of type
   3.496 +     * {@code int} or of another primitive type convertible to
   3.497 +     * type {@code int} via a widening conversion.
   3.498 +     *
   3.499 +     * @param obj the object to extract the {@code int} value
   3.500 +     * from
   3.501 +     * @return the value of the field converted to type {@code int}
   3.502 +     *
   3.503 +     * @exception IllegalAccessException    if this {@code Field} object
   3.504 +     *              is enforcing Java language access control and the underlying
   3.505 +     *              field is inaccessible.
   3.506 +     * @exception IllegalArgumentException  if the specified object is not
   3.507 +     *              an instance of the class or interface declaring the
   3.508 +     *              underlying field (or a subclass or implementor
   3.509 +     *              thereof), or if the field value cannot be
   3.510 +     *              converted to the type {@code int} by a
   3.511 +     *              widening conversion.
   3.512 +     * @exception NullPointerException      if the specified object is null
   3.513 +     *              and the field is an instance field.
   3.514 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.515 +     *              by this method fails.
   3.516 +     * @see       Field#get
   3.517 +     */
   3.518 +    public int getInt(Object obj)
   3.519 +        throws IllegalArgumentException, IllegalAccessException
   3.520 +    {
   3.521 +        return getFieldAccessor(obj).getInt(obj);
   3.522 +    }
   3.523 +
   3.524 +    /**
   3.525 +     * Gets the value of a static or instance field of type
   3.526 +     * {@code long} or of another primitive type convertible to
   3.527 +     * type {@code long} via a widening conversion.
   3.528 +     *
   3.529 +     * @param obj the object to extract the {@code long} value
   3.530 +     * from
   3.531 +     * @return the value of the field converted to type {@code long}
   3.532 +     *
   3.533 +     * @exception IllegalAccessException    if this {@code Field} object
   3.534 +     *              is enforcing Java language access control and the underlying
   3.535 +     *              field is inaccessible.
   3.536 +     * @exception IllegalArgumentException  if the specified object is not
   3.537 +     *              an instance of the class or interface declaring the
   3.538 +     *              underlying field (or a subclass or implementor
   3.539 +     *              thereof), or if the field value cannot be
   3.540 +     *              converted to the type {@code long} by a
   3.541 +     *              widening conversion.
   3.542 +     * @exception NullPointerException      if the specified object is null
   3.543 +     *              and the field is an instance field.
   3.544 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.545 +     *              by this method fails.
   3.546 +     * @see       Field#get
   3.547 +     */
   3.548 +    public long getLong(Object obj)
   3.549 +        throws IllegalArgumentException, IllegalAccessException
   3.550 +    {
   3.551 +        return getFieldAccessor(obj).getLong(obj);
   3.552 +    }
   3.553 +
   3.554 +    /**
   3.555 +     * Gets the value of a static or instance field of type
   3.556 +     * {@code float} or of another primitive type convertible to
   3.557 +     * type {@code float} via a widening conversion.
   3.558 +     *
   3.559 +     * @param obj the object to extract the {@code float} value
   3.560 +     * from
   3.561 +     * @return the value of the field converted to type {@code float}
   3.562 +     *
   3.563 +     * @exception IllegalAccessException    if this {@code Field} object
   3.564 +     *              is enforcing Java language access control and the underlying
   3.565 +     *              field is inaccessible.
   3.566 +     * @exception IllegalArgumentException  if the specified object is not
   3.567 +     *              an instance of the class or interface declaring the
   3.568 +     *              underlying field (or a subclass or implementor
   3.569 +     *              thereof), or if the field value cannot be
   3.570 +     *              converted to the type {@code float} by a
   3.571 +     *              widening conversion.
   3.572 +     * @exception NullPointerException      if the specified object is null
   3.573 +     *              and the field is an instance field.
   3.574 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.575 +     *              by this method fails.
   3.576 +     * @see Field#get
   3.577 +     */
   3.578 +    public float getFloat(Object obj)
   3.579 +        throws IllegalArgumentException, IllegalAccessException
   3.580 +    {
   3.581 +        return getFieldAccessor(obj).getFloat(obj);
   3.582 +    }
   3.583 +
   3.584 +    /**
   3.585 +     * Gets the value of a static or instance field of type
   3.586 +     * {@code double} or of another primitive type convertible to
   3.587 +     * type {@code double} via a widening conversion.
   3.588 +     *
   3.589 +     * @param obj the object to extract the {@code double} value
   3.590 +     * from
   3.591 +     * @return the value of the field converted to type {@code double}
   3.592 +     *
   3.593 +     * @exception IllegalAccessException    if this {@code Field} object
   3.594 +     *              is enforcing Java language access control and the underlying
   3.595 +     *              field is inaccessible.
   3.596 +     * @exception IllegalArgumentException  if the specified object is not
   3.597 +     *              an instance of the class or interface declaring the
   3.598 +     *              underlying field (or a subclass or implementor
   3.599 +     *              thereof), or if the field value cannot be
   3.600 +     *              converted to the type {@code double} by a
   3.601 +     *              widening conversion.
   3.602 +     * @exception NullPointerException      if the specified object is null
   3.603 +     *              and the field is an instance field.
   3.604 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.605 +     *              by this method fails.
   3.606 +     * @see       Field#get
   3.607 +     */
   3.608 +    public double getDouble(Object obj)
   3.609 +        throws IllegalArgumentException, IllegalAccessException
   3.610 +    {
   3.611 +        return getFieldAccessor(obj).getDouble(obj);
   3.612 +    }
   3.613 +
   3.614 +    /**
   3.615 +     * Sets the field represented by this {@code Field} object on the
   3.616 +     * specified object argument to the specified new value. The new
   3.617 +     * value is automatically unwrapped if the underlying field has a
   3.618 +     * primitive type.
   3.619 +     *
   3.620 +     * <p>The operation proceeds as follows:
   3.621 +     *
   3.622 +     * <p>If the underlying field is static, the {@code obj} argument is
   3.623 +     * ignored; it may be null.
   3.624 +     *
   3.625 +     * <p>Otherwise the underlying field is an instance field.  If the
   3.626 +     * specified object argument is null, the method throws a
   3.627 +     * {@code NullPointerException}.  If the specified object argument is not
   3.628 +     * an instance of the class or interface declaring the underlying
   3.629 +     * field, the method throws an {@code IllegalArgumentException}.
   3.630 +     *
   3.631 +     * <p>If this {@code Field} object is enforcing Java language access control, and
   3.632 +     * the underlying field is inaccessible, the method throws an
   3.633 +     * {@code IllegalAccessException}.
   3.634 +     *
   3.635 +     * <p>If the underlying field is final, the method throws an
   3.636 +     * {@code IllegalAccessException} unless {@code setAccessible(true)}
   3.637 +     * has succeeded for this {@code Field} object
   3.638 +     * and the field is non-static. Setting a final field in this way
   3.639 +     * is meaningful only during deserialization or reconstruction of
   3.640 +     * instances of classes with blank final fields, before they are
   3.641 +     * made available for access by other parts of a program. Use in
   3.642 +     * any other context may have unpredictable effects, including cases
   3.643 +     * in which other parts of a program continue to use the original
   3.644 +     * value of this field.
   3.645 +     *
   3.646 +     * <p>If the underlying field is of a primitive type, an unwrapping
   3.647 +     * conversion is attempted to convert the new value to a value of
   3.648 +     * a primitive type.  If this attempt fails, the method throws an
   3.649 +     * {@code IllegalArgumentException}.
   3.650 +     *
   3.651 +     * <p>If, after possible unwrapping, the new value cannot be
   3.652 +     * converted to the type of the underlying field by an identity or
   3.653 +     * widening conversion, the method throws an
   3.654 +     * {@code IllegalArgumentException}.
   3.655 +     *
   3.656 +     * <p>If the underlying field is static, the class that declared the
   3.657 +     * field is initialized if it has not already been initialized.
   3.658 +     *
   3.659 +     * <p>The field is set to the possibly unwrapped and widened new value.
   3.660 +     *
   3.661 +     * <p>If the field is hidden in the type of {@code obj},
   3.662 +     * the field's value is set according to the preceding rules.
   3.663 +     *
   3.664 +     * @param obj the object whose field should be modified
   3.665 +     * @param value the new value for the field of {@code obj}
   3.666 +     * being modified
   3.667 +     *
   3.668 +     * @exception IllegalAccessException    if this {@code Field} object
   3.669 +     *              is enforcing Java language access control and the underlying
   3.670 +     *              field is either inaccessible or final.
   3.671 +     * @exception IllegalArgumentException  if the specified object is not an
   3.672 +     *              instance of the class or interface declaring the underlying
   3.673 +     *              field (or a subclass or implementor thereof),
   3.674 +     *              or if an unwrapping conversion fails.
   3.675 +     * @exception NullPointerException      if the specified object is null
   3.676 +     *              and the field is an instance field.
   3.677 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.678 +     *              by this method fails.
   3.679 +     */
   3.680 +    public void set(Object obj, Object value)
   3.681 +        throws IllegalArgumentException, IllegalAccessException
   3.682 +    {
   3.683 +        getFieldAccessor(obj).set(obj, value);
   3.684 +    }
   3.685 +
   3.686 +    /**
   3.687 +     * Sets the value of a field as a {@code boolean} on the specified object.
   3.688 +     * This method is equivalent to
   3.689 +     * {@code set(obj, zObj)},
   3.690 +     * where {@code zObj} is a {@code Boolean} object and
   3.691 +     * {@code zObj.booleanValue() == z}.
   3.692 +     *
   3.693 +     * @param obj the object whose field should be modified
   3.694 +     * @param z   the new value for the field of {@code obj}
   3.695 +     * being modified
   3.696 +     *
   3.697 +     * @exception IllegalAccessException    if this {@code Field} object
   3.698 +     *              is enforcing Java language access control and the underlying
   3.699 +     *              field is either inaccessible or final.
   3.700 +     * @exception IllegalArgumentException  if the specified object is not an
   3.701 +     *              instance of the class or interface declaring the underlying
   3.702 +     *              field (or a subclass or implementor thereof),
   3.703 +     *              or if an unwrapping conversion fails.
   3.704 +     * @exception NullPointerException      if the specified object is null
   3.705 +     *              and the field is an instance field.
   3.706 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.707 +     *              by this method fails.
   3.708 +     * @see       Field#set
   3.709 +     */
   3.710 +    public void setBoolean(Object obj, boolean z)
   3.711 +        throws IllegalArgumentException, IllegalAccessException
   3.712 +    {
   3.713 +        getFieldAccessor(obj).setBoolean(obj, z);
   3.714 +    }
   3.715 +
   3.716 +    /**
   3.717 +     * Sets the value of a field as a {@code byte} on the specified object.
   3.718 +     * This method is equivalent to
   3.719 +     * {@code set(obj, bObj)},
   3.720 +     * where {@code bObj} is a {@code Byte} object and
   3.721 +     * {@code bObj.byteValue() == b}.
   3.722 +     *
   3.723 +     * @param obj the object whose field should be modified
   3.724 +     * @param b   the new value for the field of {@code obj}
   3.725 +     * being modified
   3.726 +     *
   3.727 +     * @exception IllegalAccessException    if this {@code Field} object
   3.728 +     *              is enforcing Java language access control and the underlying
   3.729 +     *              field is either inaccessible or final.
   3.730 +     * @exception IllegalArgumentException  if the specified object is not an
   3.731 +     *              instance of the class or interface declaring the underlying
   3.732 +     *              field (or a subclass or implementor thereof),
   3.733 +     *              or if an unwrapping conversion fails.
   3.734 +     * @exception NullPointerException      if the specified object is null
   3.735 +     *              and the field is an instance field.
   3.736 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.737 +     *              by this method fails.
   3.738 +     * @see       Field#set
   3.739 +     */
   3.740 +    public void setByte(Object obj, byte b)
   3.741 +        throws IllegalArgumentException, IllegalAccessException
   3.742 +    {
   3.743 +        getFieldAccessor(obj).setByte(obj, b);
   3.744 +    }
   3.745 +
   3.746 +    /**
   3.747 +     * Sets the value of a field as a {@code char} on the specified object.
   3.748 +     * This method is equivalent to
   3.749 +     * {@code set(obj, cObj)},
   3.750 +     * where {@code cObj} is a {@code Character} object and
   3.751 +     * {@code cObj.charValue() == c}.
   3.752 +     *
   3.753 +     * @param obj the object whose field should be modified
   3.754 +     * @param c   the new value for the field of {@code obj}
   3.755 +     * being modified
   3.756 +     *
   3.757 +     * @exception IllegalAccessException    if this {@code Field} object
   3.758 +     *              is enforcing Java language access control and the underlying
   3.759 +     *              field is either inaccessible or final.
   3.760 +     * @exception IllegalArgumentException  if the specified object is not an
   3.761 +     *              instance of the class or interface declaring the underlying
   3.762 +     *              field (or a subclass or implementor thereof),
   3.763 +     *              or if an unwrapping conversion fails.
   3.764 +     * @exception NullPointerException      if the specified object is null
   3.765 +     *              and the field is an instance field.
   3.766 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.767 +     *              by this method fails.
   3.768 +     * @see       Field#set
   3.769 +     */
   3.770 +    public void setChar(Object obj, char c)
   3.771 +        throws IllegalArgumentException, IllegalAccessException
   3.772 +    {
   3.773 +        getFieldAccessor(obj).setChar(obj, c);
   3.774 +    }
   3.775 +
   3.776 +    /**
   3.777 +     * Sets the value of a field as a {@code short} on the specified object.
   3.778 +     * This method is equivalent to
   3.779 +     * {@code set(obj, sObj)},
   3.780 +     * where {@code sObj} is a {@code Short} object and
   3.781 +     * {@code sObj.shortValue() == s}.
   3.782 +     *
   3.783 +     * @param obj the object whose field should be modified
   3.784 +     * @param s   the new value for the field of {@code obj}
   3.785 +     * being modified
   3.786 +     *
   3.787 +     * @exception IllegalAccessException    if this {@code Field} object
   3.788 +     *              is enforcing Java language access control and the underlying
   3.789 +     *              field is either inaccessible or final.
   3.790 +     * @exception IllegalArgumentException  if the specified object is not an
   3.791 +     *              instance of the class or interface declaring the underlying
   3.792 +     *              field (or a subclass or implementor thereof),
   3.793 +     *              or if an unwrapping conversion fails.
   3.794 +     * @exception NullPointerException      if the specified object is null
   3.795 +     *              and the field is an instance field.
   3.796 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.797 +     *              by this method fails.
   3.798 +     * @see       Field#set
   3.799 +     */
   3.800 +    public void setShort(Object obj, short s)
   3.801 +        throws IllegalArgumentException, IllegalAccessException
   3.802 +    {
   3.803 +        getFieldAccessor(obj).setShort(obj, s);
   3.804 +    }
   3.805 +
   3.806 +    /**
   3.807 +     * Sets the value of a field as an {@code int} on the specified object.
   3.808 +     * This method is equivalent to
   3.809 +     * {@code set(obj, iObj)},
   3.810 +     * where {@code iObj} is a {@code Integer} object and
   3.811 +     * {@code iObj.intValue() == i}.
   3.812 +     *
   3.813 +     * @param obj the object whose field should be modified
   3.814 +     * @param i   the new value for the field of {@code obj}
   3.815 +     * being modified
   3.816 +     *
   3.817 +     * @exception IllegalAccessException    if this {@code Field} object
   3.818 +     *              is enforcing Java language access control and the underlying
   3.819 +     *              field is either inaccessible or final.
   3.820 +     * @exception IllegalArgumentException  if the specified object is not an
   3.821 +     *              instance of the class or interface declaring the underlying
   3.822 +     *              field (or a subclass or implementor thereof),
   3.823 +     *              or if an unwrapping conversion fails.
   3.824 +     * @exception NullPointerException      if the specified object is null
   3.825 +     *              and the field is an instance field.
   3.826 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.827 +     *              by this method fails.
   3.828 +     * @see       Field#set
   3.829 +     */
   3.830 +    public void setInt(Object obj, int i)
   3.831 +        throws IllegalArgumentException, IllegalAccessException
   3.832 +    {
   3.833 +        getFieldAccessor(obj).setInt(obj, i);
   3.834 +    }
   3.835 +
   3.836 +    /**
   3.837 +     * Sets the value of a field as a {@code long} on the specified object.
   3.838 +     * This method is equivalent to
   3.839 +     * {@code set(obj, lObj)},
   3.840 +     * where {@code lObj} is a {@code Long} object and
   3.841 +     * {@code lObj.longValue() == l}.
   3.842 +     *
   3.843 +     * @param obj the object whose field should be modified
   3.844 +     * @param l   the new value for the field of {@code obj}
   3.845 +     * being modified
   3.846 +     *
   3.847 +     * @exception IllegalAccessException    if this {@code Field} object
   3.848 +     *              is enforcing Java language access control and the underlying
   3.849 +     *              field is either inaccessible or final.
   3.850 +     * @exception IllegalArgumentException  if the specified object is not an
   3.851 +     *              instance of the class or interface declaring the underlying
   3.852 +     *              field (or a subclass or implementor thereof),
   3.853 +     *              or if an unwrapping conversion fails.
   3.854 +     * @exception NullPointerException      if the specified object is null
   3.855 +     *              and the field is an instance field.
   3.856 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.857 +     *              by this method fails.
   3.858 +     * @see       Field#set
   3.859 +     */
   3.860 +    public void setLong(Object obj, long l)
   3.861 +        throws IllegalArgumentException, IllegalAccessException
   3.862 +    {
   3.863 +        getFieldAccessor(obj).setLong(obj, l);
   3.864 +    }
   3.865 +
   3.866 +    /**
   3.867 +     * Sets the value of a field as a {@code float} on the specified object.
   3.868 +     * This method is equivalent to
   3.869 +     * {@code set(obj, fObj)},
   3.870 +     * where {@code fObj} is a {@code Float} object and
   3.871 +     * {@code fObj.floatValue() == f}.
   3.872 +     *
   3.873 +     * @param obj the object whose field should be modified
   3.874 +     * @param f   the new value for the field of {@code obj}
   3.875 +     * being modified
   3.876 +     *
   3.877 +     * @exception IllegalAccessException    if this {@code Field} object
   3.878 +     *              is enforcing Java language access control and the underlying
   3.879 +     *              field is either inaccessible or final.
   3.880 +     * @exception IllegalArgumentException  if the specified object is not an
   3.881 +     *              instance of the class or interface declaring the underlying
   3.882 +     *              field (or a subclass or implementor thereof),
   3.883 +     *              or if an unwrapping conversion fails.
   3.884 +     * @exception NullPointerException      if the specified object is null
   3.885 +     *              and the field is an instance field.
   3.886 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.887 +     *              by this method fails.
   3.888 +     * @see       Field#set
   3.889 +     */
   3.890 +    public void setFloat(Object obj, float f)
   3.891 +        throws IllegalArgumentException, IllegalAccessException
   3.892 +    {
   3.893 +        getFieldAccessor(obj).setFloat(obj, f);
   3.894 +    }
   3.895 +
   3.896 +    /**
   3.897 +     * Sets the value of a field as a {@code double} on the specified object.
   3.898 +     * This method is equivalent to
   3.899 +     * {@code set(obj, dObj)},
   3.900 +     * where {@code dObj} is a {@code Double} object and
   3.901 +     * {@code dObj.doubleValue() == d}.
   3.902 +     *
   3.903 +     * @param obj the object whose field should be modified
   3.904 +     * @param d   the new value for the field of {@code obj}
   3.905 +     * being modified
   3.906 +     *
   3.907 +     * @exception IllegalAccessException    if this {@code Field} object
   3.908 +     *              is enforcing Java language access control and the underlying
   3.909 +     *              field is either inaccessible or final.
   3.910 +     * @exception IllegalArgumentException  if the specified object is not an
   3.911 +     *              instance of the class or interface declaring the underlying
   3.912 +     *              field (or a subclass or implementor thereof),
   3.913 +     *              or if an unwrapping conversion fails.
   3.914 +     * @exception NullPointerException      if the specified object is null
   3.915 +     *              and the field is an instance field.
   3.916 +     * @exception ExceptionInInitializerError if the initialization provoked
   3.917 +     *              by this method fails.
   3.918 +     * @see       Field#set
   3.919 +     */
   3.920 +    public void setDouble(Object obj, double d)
   3.921 +        throws IllegalArgumentException, IllegalAccessException
   3.922 +    {
   3.923 +        getFieldAccessor(obj).setDouble(obj, d);
   3.924 +    }
   3.925 +
   3.926 +    // Convenience routine which performs security checks
   3.927 +    private FieldAccessor getFieldAccessor(Object obj)
   3.928 +        throws IllegalAccessException
   3.929 +    {
   3.930 +        doSecurityCheck(obj);
   3.931 +        boolean ov = override;
   3.932 +        FieldAccessor a = (ov)? overrideFieldAccessor : fieldAccessor;
   3.933 +        return (a != null)? a : acquireFieldAccessor(ov);
   3.934 +    }
   3.935 +
   3.936 +    // NOTE that there is no synchronization used here. It is correct
   3.937 +    // (though not efficient) to generate more than one FieldAccessor
   3.938 +    // for a given Field. However, avoiding synchronization will
   3.939 +    // probably make the implementation more scalable.
   3.940 +    private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
   3.941 +        // First check to see if one has been created yet, and take it
   3.942 +        // if so
   3.943 +        FieldAccessor tmp = null;
   3.944 +        if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
   3.945 +        if (tmp != null) {
   3.946 +            if (overrideFinalCheck)
   3.947 +                overrideFieldAccessor = tmp;
   3.948 +            else
   3.949 +                fieldAccessor = tmp;
   3.950 +        } else {
   3.951 +            // Otherwise fabricate one and propagate it up to the root
   3.952 +            tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
   3.953 +            setFieldAccessor(tmp, overrideFinalCheck);
   3.954 +        }
   3.955 +
   3.956 +        return tmp;
   3.957 +    }
   3.958 +
   3.959 +    // Returns FieldAccessor for this Field object, not looking up
   3.960 +    // the chain to the root
   3.961 +    private FieldAccessor getFieldAccessor(boolean overrideFinalCheck) {
   3.962 +        return (overrideFinalCheck)? overrideFieldAccessor : fieldAccessor;
   3.963 +    }
   3.964 +
   3.965 +    // Sets the FieldAccessor for this Field object and
   3.966 +    // (recursively) its root
   3.967 +    private void setFieldAccessor(FieldAccessor accessor, boolean overrideFinalCheck) {
   3.968 +        if (overrideFinalCheck)
   3.969 +            overrideFieldAccessor = accessor;
   3.970 +        else
   3.971 +            fieldAccessor = accessor;
   3.972 +        // Propagate up
   3.973 +        if (root != null) {
   3.974 +            root.setFieldAccessor(accessor, overrideFinalCheck);
   3.975 +        }
   3.976 +    }
   3.977 +
   3.978 +    // NOTE: be very careful if you change the stack depth of this
   3.979 +    // routine. The depth of the "getCallerClass" call is hardwired so
   3.980 +    // that the compiler can have an easier time if this gets inlined.
   3.981 +    private void doSecurityCheck(Object obj) throws IllegalAccessException {
   3.982 +        if (!override) {
   3.983 +            if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
   3.984 +                Class<?> caller = Reflection.getCallerClass(4);
   3.985 +
   3.986 +                checkAccess(caller, clazz, obj, modifiers);
   3.987 +            }
   3.988 +        }
   3.989 +    }
   3.990 +
   3.991 +    /*
   3.992 +     * Utility routine to paper over array type names
   3.993 +     */
   3.994 +    static String getTypeName(Class<?> type) {
   3.995 +        if (type.isArray()) {
   3.996 +            try {
   3.997 +                Class<?> cl = type;
   3.998 +                int dimensions = 0;
   3.999 +                while (cl.isArray()) {
  3.1000 +                    dimensions++;
  3.1001 +                    cl = cl.getComponentType();
  3.1002 +                }
  3.1003 +                StringBuffer sb = new StringBuffer();
  3.1004 +                sb.append(cl.getName());
  3.1005 +                for (int i = 0; i < dimensions; i++) {
  3.1006 +                    sb.append("[]");
  3.1007 +                }
  3.1008 +                return sb.toString();
  3.1009 +            } catch (Throwable e) { /*FALLTHRU*/ }
  3.1010 +        }
  3.1011 +        return type.getName();
  3.1012 +    }
  3.1013 +
  3.1014 +    /**
  3.1015 +     * @throws NullPointerException {@inheritDoc}
  3.1016 +     * @since 1.5
  3.1017 +     */
  3.1018 +    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
  3.1019 +        if (annotationClass == null)
  3.1020 +            throw new NullPointerException();
  3.1021 +
  3.1022 +        return (T) declaredAnnotations().get(annotationClass);
  3.1023 +    }
  3.1024 +
  3.1025 +    /**
  3.1026 +     * @since 1.5
  3.1027 +     */
  3.1028 +    public Annotation[] getDeclaredAnnotations()  {
  3.1029 +        return AnnotationParser.toArray(declaredAnnotations());
  3.1030 +    }
  3.1031 +
  3.1032 +    private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
  3.1033 +
  3.1034 +    private synchronized  Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
  3.1035 +        if (declaredAnnotations == null) {
  3.1036 +            declaredAnnotations = AnnotationParser.parseAnnotations(
  3.1037 +                annotations, sun.misc.SharedSecrets.getJavaLangAccess().
  3.1038 +                getConstantPool(getDeclaringClass()),
  3.1039 +                getDeclaringClass());
  3.1040 +        }
  3.1041 +        return declaredAnnotations;
  3.1042 +    }
  3.1043 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/emul/src/main/java/java/lang/reflect/GenericDeclaration.java	Tue Dec 04 13:29:17 2012 +0100
     4.3 @@ -0,0 +1,49 @@
     4.4 +/*
     4.5 + * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
     4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 + *
     4.8 + * This code is free software; you can redistribute it and/or modify it
     4.9 + * under the terms of the GNU General Public License version 2 only, as
    4.10 + * published by the Free Software Foundation.  Oracle designates this
    4.11 + * particular file as subject to the "Classpath" exception as provided
    4.12 + * by Oracle in the LICENSE file that accompanied this code.
    4.13 + *
    4.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    4.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.17 + * version 2 for more details (a copy is included in the LICENSE file that
    4.18 + * accompanied this code).
    4.19 + *
    4.20 + * You should have received a copy of the GNU General Public License version
    4.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    4.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.23 + *
    4.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.25 + * or visit www.oracle.com if you need additional information or have any
    4.26 + * questions.
    4.27 + */
    4.28 +
    4.29 +package java.lang.reflect;
    4.30 +
    4.31 +/**
    4.32 + * A common interface for all entities that declare type variables.
    4.33 + *
    4.34 + * @since 1.5
    4.35 + */
    4.36 +public interface GenericDeclaration {
    4.37 +    /**
    4.38 +     * Returns an array of {@code TypeVariable} objects that
    4.39 +     * represent the type variables declared by the generic
    4.40 +     * declaration represented by this {@code GenericDeclaration}
    4.41 +     * object, in declaration order.  Returns an array of length 0 if
    4.42 +     * the underlying generic declaration declares no type variables.
    4.43 +     *
    4.44 +     * @return an array of {@code TypeVariable} objects that represent
    4.45 +     *     the type variables declared by this generic declaration
    4.46 +     * @throws GenericSignatureFormatError if the generic
    4.47 +     *     signature of this generic declaration does not conform to
    4.48 +     *     the format specified in
    4.49 +     *     <cite>The Java&trade; Virtual Machine Specification</cite>
    4.50 +     */
    4.51 +    public TypeVariable<?>[] getTypeParameters();
    4.52 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/emul/src/main/java/java/lang/reflect/InvocationTargetException.java	Tue Dec 04 13:29:17 2012 +0100
     5.3 @@ -0,0 +1,111 @@
     5.4 +/*
     5.5 + * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
     5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.7 + *
     5.8 + * This code is free software; you can redistribute it and/or modify it
     5.9 + * under the terms of the GNU General Public License version 2 only, as
    5.10 + * published by the Free Software Foundation.  Oracle designates this
    5.11 + * particular file as subject to the "Classpath" exception as provided
    5.12 + * by Oracle in the LICENSE file that accompanied this code.
    5.13 + *
    5.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    5.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.17 + * version 2 for more details (a copy is included in the LICENSE file that
    5.18 + * accompanied this code).
    5.19 + *
    5.20 + * You should have received a copy of the GNU General Public License version
    5.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    5.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.23 + *
    5.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    5.25 + * or visit www.oracle.com if you need additional information or have any
    5.26 + * questions.
    5.27 + */
    5.28 +
    5.29 +package java.lang.reflect;
    5.30 +
    5.31 +/**
    5.32 + * InvocationTargetException is a checked exception that wraps
    5.33 + * an exception thrown by an invoked method or constructor.
    5.34 + *
    5.35 + * <p>As of release 1.4, this exception has been retrofitted to conform to
    5.36 + * the general purpose exception-chaining mechanism.  The "target exception"
    5.37 + * that is provided at construction time and accessed via the
    5.38 + * {@link #getTargetException()} method is now known as the <i>cause</i>,
    5.39 + * and may be accessed via the {@link Throwable#getCause()} method,
    5.40 + * as well as the aforementioned "legacy method."
    5.41 + *
    5.42 + * @see Method
    5.43 + * @see Constructor
    5.44 + */
    5.45 +public class InvocationTargetException extends ReflectiveOperationException {
    5.46 +    /**
    5.47 +     * Use serialVersionUID from JDK 1.1.X for interoperability
    5.48 +     */
    5.49 +    private static final long serialVersionUID = 4085088731926701167L;
    5.50 +
    5.51 +     /**
    5.52 +     * This field holds the target if the
    5.53 +     * InvocationTargetException(Throwable target) constructor was
    5.54 +     * used to instantiate the object
    5.55 +     *
    5.56 +     * @serial
    5.57 +     *
    5.58 +     */
    5.59 +    private Throwable target;
    5.60 +
    5.61 +    /**
    5.62 +     * Constructs an {@code InvocationTargetException} with
    5.63 +     * {@code null} as the target exception.
    5.64 +     */
    5.65 +    protected InvocationTargetException() {
    5.66 +        super((Throwable)null);  // Disallow initCause
    5.67 +    }
    5.68 +
    5.69 +    /**
    5.70 +     * Constructs a InvocationTargetException with a target exception.
    5.71 +     *
    5.72 +     * @param target the target exception
    5.73 +     */
    5.74 +    public InvocationTargetException(Throwable target) {
    5.75 +        super((Throwable)null);  // Disallow initCause
    5.76 +        this.target = target;
    5.77 +    }
    5.78 +
    5.79 +    /**
    5.80 +     * Constructs a InvocationTargetException with a target exception
    5.81 +     * and a detail message.
    5.82 +     *
    5.83 +     * @param target the target exception
    5.84 +     * @param s      the detail message
    5.85 +     */
    5.86 +    public InvocationTargetException(Throwable target, String s) {
    5.87 +        super(s, null);  // Disallow initCause
    5.88 +        this.target = target;
    5.89 +    }
    5.90 +
    5.91 +    /**
    5.92 +     * Get the thrown target exception.
    5.93 +     *
    5.94 +     * <p>This method predates the general-purpose exception chaining facility.
    5.95 +     * The {@link Throwable#getCause()} method is now the preferred means of
    5.96 +     * obtaining this information.
    5.97 +     *
    5.98 +     * @return the thrown target exception (cause of this exception).
    5.99 +     */
   5.100 +    public Throwable getTargetException() {
   5.101 +        return target;
   5.102 +    }
   5.103 +
   5.104 +    /**
   5.105 +     * Returns the cause of this exception (the thrown target exception,
   5.106 +     * which may be {@code null}).
   5.107 +     *
   5.108 +     * @return  the cause of this exception.
   5.109 +     * @since   1.4
   5.110 +     */
   5.111 +    public Throwable getCause() {
   5.112 +        return target;
   5.113 +    }
   5.114 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/emul/src/main/java/java/lang/reflect/Member.java	Tue Dec 04 13:29:17 2012 +0100
     6.3 @@ -0,0 +1,93 @@
     6.4 +/*
     6.5 + * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
     6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.7 + *
     6.8 + * This code is free software; you can redistribute it and/or modify it
     6.9 + * under the terms of the GNU General Public License version 2 only, as
    6.10 + * published by the Free Software Foundation.  Oracle designates this
    6.11 + * particular file as subject to the "Classpath" exception as provided
    6.12 + * by Oracle in the LICENSE file that accompanied this code.
    6.13 + *
    6.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    6.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    6.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    6.17 + * version 2 for more details (a copy is included in the LICENSE file that
    6.18 + * accompanied this code).
    6.19 + *
    6.20 + * You should have received a copy of the GNU General Public License version
    6.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    6.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    6.23 + *
    6.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    6.25 + * or visit www.oracle.com if you need additional information or have any
    6.26 + * questions.
    6.27 + */
    6.28 +
    6.29 +package java.lang.reflect;
    6.30 +
    6.31 +/**
    6.32 + * Member is an interface that reflects identifying information about
    6.33 + * a single member (a field or a method) or a constructor.
    6.34 + *
    6.35 + * @see java.lang.Class
    6.36 + * @see Field
    6.37 + * @see Method
    6.38 + * @see Constructor
    6.39 + *
    6.40 + * @author Nakul Saraiya
    6.41 + */
    6.42 +public
    6.43 +interface Member {
    6.44 +
    6.45 +    /**
    6.46 +     * Identifies the set of all public members of a class or interface,
    6.47 +     * including inherited members.
    6.48 +     * @see java.lang.SecurityManager#checkMemberAccess
    6.49 +     */
    6.50 +    public static final int PUBLIC = 0;
    6.51 +
    6.52 +    /**
    6.53 +     * Identifies the set of declared members of a class or interface.
    6.54 +     * Inherited members are not included.
    6.55 +     * @see java.lang.SecurityManager#checkMemberAccess
    6.56 +     */
    6.57 +    public static final int DECLARED = 1;
    6.58 +
    6.59 +    /**
    6.60 +     * Returns the Class object representing the class or interface
    6.61 +     * that declares the member or constructor represented by this Member.
    6.62 +     *
    6.63 +     * @return an object representing the declaring class of the
    6.64 +     * underlying member
    6.65 +     */
    6.66 +    public Class<?> getDeclaringClass();
    6.67 +
    6.68 +    /**
    6.69 +     * Returns the simple name of the underlying member or constructor
    6.70 +     * represented by this Member.
    6.71 +     *
    6.72 +     * @return the simple name of the underlying member
    6.73 +     */
    6.74 +    public String getName();
    6.75 +
    6.76 +    /**
    6.77 +     * Returns the Java language modifiers for the member or
    6.78 +     * constructor represented by this Member, as an integer.  The
    6.79 +     * Modifier class should be used to decode the modifiers in
    6.80 +     * the integer.
    6.81 +     *
    6.82 +     * @return the Java language modifiers for the underlying member
    6.83 +     * @see Modifier
    6.84 +     */
    6.85 +    public int getModifiers();
    6.86 +
    6.87 +    /**
    6.88 +     * Returns {@code true} if this member was introduced by
    6.89 +     * the compiler; returns {@code false} otherwise.
    6.90 +     *
    6.91 +     * @return true if and only if this member was introduced by
    6.92 +     * the compiler.
    6.93 +     * @since 1.5
    6.94 +     */
    6.95 +    public boolean isSynthetic();
    6.96 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/emul/src/main/java/java/lang/reflect/Method.java	Tue Dec 04 13:29:17 2012 +0100
     7.3 @@ -0,0 +1,767 @@
     7.4 +/*
     7.5 + * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.  Oracle designates this
    7.11 + * particular file as subject to the "Classpath" exception as provided
    7.12 + * by Oracle in the LICENSE file that accompanied this code.
    7.13 + *
    7.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.17 + * version 2 for more details (a copy is included in the LICENSE file that
    7.18 + * accompanied this code).
    7.19 + *
    7.20 + * You should have received a copy of the GNU General Public License version
    7.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.23 + *
    7.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.25 + * or visit www.oracle.com if you need additional information or have any
    7.26 + * questions.
    7.27 + */
    7.28 +
    7.29 +package java.lang.reflect;
    7.30 +
    7.31 +import sun.reflect.MethodAccessor;
    7.32 +import sun.reflect.Reflection;
    7.33 +import sun.reflect.generics.repository.MethodRepository;
    7.34 +import sun.reflect.generics.factory.CoreReflectionFactory;
    7.35 +import sun.reflect.generics.factory.GenericsFactory;
    7.36 +import sun.reflect.generics.scope.MethodScope;
    7.37 +import sun.reflect.annotation.AnnotationType;
    7.38 +import sun.reflect.annotation.AnnotationParser;
    7.39 +import java.lang.annotation.Annotation;
    7.40 +import java.lang.annotation.AnnotationFormatError;
    7.41 +import java.nio.ByteBuffer;
    7.42 +import java.util.Map;
    7.43 +
    7.44 +/**
    7.45 + * A {@code Method} provides information about, and access to, a single method
    7.46 + * on a class or interface.  The reflected method may be a class method
    7.47 + * or an instance method (including an abstract method).
    7.48 + *
    7.49 + * <p>A {@code Method} permits widening conversions to occur when matching the
    7.50 + * actual parameters to invoke with the underlying method's formal
    7.51 + * parameters, but it throws an {@code IllegalArgumentException} if a
    7.52 + * narrowing conversion would occur.
    7.53 + *
    7.54 + * @see Member
    7.55 + * @see java.lang.Class
    7.56 + * @see java.lang.Class#getMethods()
    7.57 + * @see java.lang.Class#getMethod(String, Class[])
    7.58 + * @see java.lang.Class#getDeclaredMethods()
    7.59 + * @see java.lang.Class#getDeclaredMethod(String, Class[])
    7.60 + *
    7.61 + * @author Kenneth Russell
    7.62 + * @author Nakul Saraiya
    7.63 + */
    7.64 +public final
    7.65 +    class Method extends AccessibleObject implements GenericDeclaration,
    7.66 +                                                     Member {
    7.67 +    private Class<?>            clazz;
    7.68 +    private int                 slot;
    7.69 +    // This is guaranteed to be interned by the VM in the 1.4
    7.70 +    // reflection implementation
    7.71 +    private String              name;
    7.72 +    private Class<?>            returnType;
    7.73 +    private Class<?>[]          parameterTypes;
    7.74 +    private Class<?>[]          exceptionTypes;
    7.75 +    private int                 modifiers;
    7.76 +    // Generics and annotations support
    7.77 +    private transient String              signature;
    7.78 +    // generic info repository; lazily initialized
    7.79 +    private transient MethodRepository genericInfo;
    7.80 +    private byte[]              annotations;
    7.81 +    private byte[]              parameterAnnotations;
    7.82 +    private byte[]              annotationDefault;
    7.83 +    private volatile MethodAccessor methodAccessor;
    7.84 +    // For sharing of MethodAccessors. This branching structure is
    7.85 +    // currently only two levels deep (i.e., one root Method and
    7.86 +    // potentially many Method objects pointing to it.)
    7.87 +    private Method              root;
    7.88 +
    7.89 +   // Generics infrastructure
    7.90 +
    7.91 +    private String getGenericSignature() {return signature;}
    7.92 +
    7.93 +    // Accessor for factory
    7.94 +    private GenericsFactory getFactory() {
    7.95 +        // create scope and factory
    7.96 +        return CoreReflectionFactory.make(this, MethodScope.make(this));
    7.97 +    }
    7.98 +
    7.99 +    // Accessor for generic info repository
   7.100 +    private MethodRepository getGenericInfo() {
   7.101 +        // lazily initialize repository if necessary
   7.102 +        if (genericInfo == null) {
   7.103 +            // create and cache generic info repository
   7.104 +            genericInfo = MethodRepository.make(getGenericSignature(),
   7.105 +                                                getFactory());
   7.106 +        }
   7.107 +        return genericInfo; //return cached repository
   7.108 +    }
   7.109 +
   7.110 +    /**
   7.111 +     * Package-private constructor used by ReflectAccess to enable
   7.112 +     * instantiation of these objects in Java code from the java.lang
   7.113 +     * package via sun.reflect.LangReflectAccess.
   7.114 +     */
   7.115 +    Method(Class<?> declaringClass,
   7.116 +           String name,
   7.117 +           Class<?>[] parameterTypes,
   7.118 +           Class<?> returnType,
   7.119 +           Class<?>[] checkedExceptions,
   7.120 +           int modifiers,
   7.121 +           int slot,
   7.122 +           String signature,
   7.123 +           byte[] annotations,
   7.124 +           byte[] parameterAnnotations,
   7.125 +           byte[] annotationDefault)
   7.126 +    {
   7.127 +        this.clazz = declaringClass;
   7.128 +        this.name = name;
   7.129 +        this.parameterTypes = parameterTypes;
   7.130 +        this.returnType = returnType;
   7.131 +        this.exceptionTypes = checkedExceptions;
   7.132 +        this.modifiers = modifiers;
   7.133 +        this.slot = slot;
   7.134 +        this.signature = signature;
   7.135 +        this.annotations = annotations;
   7.136 +        this.parameterAnnotations = parameterAnnotations;
   7.137 +        this.annotationDefault = annotationDefault;
   7.138 +    }
   7.139 +
   7.140 +    /**
   7.141 +     * Package-private routine (exposed to java.lang.Class via
   7.142 +     * ReflectAccess) which returns a copy of this Method. The copy's
   7.143 +     * "root" field points to this Method.
   7.144 +     */
   7.145 +    Method copy() {
   7.146 +        // This routine enables sharing of MethodAccessor objects
   7.147 +        // among Method objects which refer to the same underlying
   7.148 +        // method in the VM. (All of this contortion is only necessary
   7.149 +        // because of the "accessibility" bit in AccessibleObject,
   7.150 +        // which implicitly requires that new java.lang.reflect
   7.151 +        // objects be fabricated for each reflective call on Class
   7.152 +        // objects.)
   7.153 +        Method res = new Method(clazz, name, parameterTypes, returnType,
   7.154 +                                exceptionTypes, modifiers, slot, signature,
   7.155 +                                annotations, parameterAnnotations, annotationDefault);
   7.156 +        res.root = this;
   7.157 +        // Might as well eagerly propagate this if already present
   7.158 +        res.methodAccessor = methodAccessor;
   7.159 +        return res;
   7.160 +    }
   7.161 +
   7.162 +    /**
   7.163 +     * Returns the {@code Class} object representing the class or interface
   7.164 +     * that declares the method represented by this {@code Method} object.
   7.165 +     */
   7.166 +    public Class<?> getDeclaringClass() {
   7.167 +        return clazz;
   7.168 +    }
   7.169 +
   7.170 +    /**
   7.171 +     * Returns the name of the method represented by this {@code Method}
   7.172 +     * object, as a {@code String}.
   7.173 +     */
   7.174 +    public String getName() {
   7.175 +        return name;
   7.176 +    }
   7.177 +
   7.178 +    /**
   7.179 +     * Returns the Java language modifiers for the method represented
   7.180 +     * by this {@code Method} object, as an integer. The {@code Modifier} class should
   7.181 +     * be used to decode the modifiers.
   7.182 +     *
   7.183 +     * @see Modifier
   7.184 +     */
   7.185 +    public int getModifiers() {
   7.186 +        return modifiers;
   7.187 +    }
   7.188 +
   7.189 +    /**
   7.190 +     * Returns an array of {@code TypeVariable} objects that represent the
   7.191 +     * type variables declared by the generic declaration represented by this
   7.192 +     * {@code GenericDeclaration} object, in declaration order.  Returns an
   7.193 +     * array of length 0 if the underlying generic declaration declares no type
   7.194 +     * variables.
   7.195 +     *
   7.196 +     * @return an array of {@code TypeVariable} objects that represent
   7.197 +     *     the type variables declared by this generic declaration
   7.198 +     * @throws GenericSignatureFormatError if the generic
   7.199 +     *     signature of this generic declaration does not conform to
   7.200 +     *     the format specified in
   7.201 +     *     <cite>The Java&trade; Virtual Machine Specification</cite>
   7.202 +     * @since 1.5
   7.203 +     */
   7.204 +    public TypeVariable<Method>[] getTypeParameters() {
   7.205 +        if (getGenericSignature() != null)
   7.206 +            return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
   7.207 +        else
   7.208 +            return (TypeVariable<Method>[])new TypeVariable[0];
   7.209 +    }
   7.210 +
   7.211 +    /**
   7.212 +     * Returns a {@code Class} object that represents the formal return type
   7.213 +     * of the method represented by this {@code Method} object.
   7.214 +     *
   7.215 +     * @return the return type for the method this object represents
   7.216 +     */
   7.217 +    public Class<?> getReturnType() {
   7.218 +        return returnType;
   7.219 +    }
   7.220 +
   7.221 +    /**
   7.222 +     * Returns a {@code Type} object that represents the formal return
   7.223 +     * type of the method represented by this {@code Method} object.
   7.224 +     *
   7.225 +     * <p>If the return type is a parameterized type,
   7.226 +     * the {@code Type} object returned must accurately reflect
   7.227 +     * the actual type parameters used in the source code.
   7.228 +     *
   7.229 +     * <p>If the return type is a type variable or a parameterized type, it
   7.230 +     * is created. Otherwise, it is resolved.
   7.231 +     *
   7.232 +     * @return  a {@code Type} object that represents the formal return
   7.233 +     *     type of the underlying  method
   7.234 +     * @throws GenericSignatureFormatError
   7.235 +     *     if the generic method signature does not conform to the format
   7.236 +     *     specified in
   7.237 +     *     <cite>The Java&trade; Virtual Machine Specification</cite>
   7.238 +     * @throws TypeNotPresentException if the underlying method's
   7.239 +     *     return type refers to a non-existent type declaration
   7.240 +     * @throws MalformedParameterizedTypeException if the
   7.241 +     *     underlying method's return typed refers to a parameterized
   7.242 +     *     type that cannot be instantiated for any reason
   7.243 +     * @since 1.5
   7.244 +     */
   7.245 +    public Type getGenericReturnType() {
   7.246 +      if (getGenericSignature() != null) {
   7.247 +        return getGenericInfo().getReturnType();
   7.248 +      } else { return getReturnType();}
   7.249 +    }
   7.250 +
   7.251 +
   7.252 +    /**
   7.253 +     * Returns an array of {@code Class} objects that represent the formal
   7.254 +     * parameter types, in declaration order, of the method
   7.255 +     * represented by this {@code Method} object.  Returns an array of length
   7.256 +     * 0 if the underlying method takes no parameters.
   7.257 +     *
   7.258 +     * @return the parameter types for the method this object
   7.259 +     * represents
   7.260 +     */
   7.261 +    public Class<?>[] getParameterTypes() {
   7.262 +        return (Class<?>[]) parameterTypes.clone();
   7.263 +    }
   7.264 +
   7.265 +    /**
   7.266 +     * Returns an array of {@code Type} objects that represent the formal
   7.267 +     * parameter types, in declaration order, of the method represented by
   7.268 +     * this {@code Method} object. Returns an array of length 0 if the
   7.269 +     * underlying method takes no parameters.
   7.270 +     *
   7.271 +     * <p>If a formal parameter type is a parameterized type,
   7.272 +     * the {@code Type} object returned for it must accurately reflect
   7.273 +     * the actual type parameters used in the source code.
   7.274 +     *
   7.275 +     * <p>If a formal parameter type is a type variable or a parameterized
   7.276 +     * type, it is created. Otherwise, it is resolved.
   7.277 +     *
   7.278 +     * @return an array of Types that represent the formal
   7.279 +     *     parameter types of the underlying method, in declaration order
   7.280 +     * @throws GenericSignatureFormatError
   7.281 +     *     if the generic method signature does not conform to the format
   7.282 +     *     specified in
   7.283 +     *     <cite>The Java&trade; Virtual Machine Specification</cite>
   7.284 +     * @throws TypeNotPresentException if any of the parameter
   7.285 +     *     types of the underlying method refers to a non-existent type
   7.286 +     *     declaration
   7.287 +     * @throws MalformedParameterizedTypeException if any of
   7.288 +     *     the underlying method's parameter types refer to a parameterized
   7.289 +     *     type that cannot be instantiated for any reason
   7.290 +     * @since 1.5
   7.291 +     */
   7.292 +    public Type[] getGenericParameterTypes() {
   7.293 +        if (getGenericSignature() != null)
   7.294 +            return getGenericInfo().getParameterTypes();
   7.295 +        else
   7.296 +            return getParameterTypes();
   7.297 +    }
   7.298 +
   7.299 +
   7.300 +    /**
   7.301 +     * Returns an array of {@code Class} objects that represent
   7.302 +     * the types of the exceptions declared to be thrown
   7.303 +     * by the underlying method
   7.304 +     * represented by this {@code Method} object.  Returns an array of length
   7.305 +     * 0 if the method declares no exceptions in its {@code throws} clause.
   7.306 +     *
   7.307 +     * @return the exception types declared as being thrown by the
   7.308 +     * method this object represents
   7.309 +     */
   7.310 +    public Class<?>[] getExceptionTypes() {
   7.311 +        return (Class<?>[]) exceptionTypes.clone();
   7.312 +    }
   7.313 +
   7.314 +    /**
   7.315 +     * Returns an array of {@code Type} objects that represent the
   7.316 +     * exceptions declared to be thrown by this {@code Method} object.
   7.317 +     * Returns an array of length 0 if the underlying method declares
   7.318 +     * no exceptions in its {@code throws} clause.
   7.319 +     *
   7.320 +     * <p>If an exception type is a type variable or a parameterized
   7.321 +     * type, it is created. Otherwise, it is resolved.
   7.322 +     *
   7.323 +     * @return an array of Types that represent the exception types
   7.324 +     *     thrown by the underlying method
   7.325 +     * @throws GenericSignatureFormatError
   7.326 +     *     if the generic method signature does not conform to the format
   7.327 +     *     specified in
   7.328 +     *     <cite>The Java&trade; Virtual Machine Specification</cite>
   7.329 +     * @throws TypeNotPresentException if the underlying method's
   7.330 +     *     {@code throws} clause refers to a non-existent type declaration
   7.331 +     * @throws MalformedParameterizedTypeException if
   7.332 +     *     the underlying method's {@code throws} clause refers to a
   7.333 +     *     parameterized type that cannot be instantiated for any reason
   7.334 +     * @since 1.5
   7.335 +     */
   7.336 +      public Type[] getGenericExceptionTypes() {
   7.337 +          Type[] result;
   7.338 +          if (getGenericSignature() != null &&
   7.339 +              ((result = getGenericInfo().getExceptionTypes()).length > 0))
   7.340 +              return result;
   7.341 +          else
   7.342 +              return getExceptionTypes();
   7.343 +      }
   7.344 +
   7.345 +    /**
   7.346 +     * Compares this {@code Method} against the specified object.  Returns
   7.347 +     * true if the objects are the same.  Two {@code Methods} are the same if
   7.348 +     * they were declared by the same class and have the same name
   7.349 +     * and formal parameter types and return type.
   7.350 +     */
   7.351 +    public boolean equals(Object obj) {
   7.352 +        if (obj != null && obj instanceof Method) {
   7.353 +            Method other = (Method)obj;
   7.354 +            if ((getDeclaringClass() == other.getDeclaringClass())
   7.355 +                && (getName() == other.getName())) {
   7.356 +                if (!returnType.equals(other.getReturnType()))
   7.357 +                    return false;
   7.358 +                /* Avoid unnecessary cloning */
   7.359 +                Class<?>[] params1 = parameterTypes;
   7.360 +                Class<?>[] params2 = other.parameterTypes;
   7.361 +                if (params1.length == params2.length) {
   7.362 +                    for (int i = 0; i < params1.length; i++) {
   7.363 +                        if (params1[i] != params2[i])
   7.364 +                            return false;
   7.365 +                    }
   7.366 +                    return true;
   7.367 +                }
   7.368 +            }
   7.369 +        }
   7.370 +        return false;
   7.371 +    }
   7.372 +
   7.373 +    /**
   7.374 +     * Returns a hashcode for this {@code Method}.  The hashcode is computed
   7.375 +     * as the exclusive-or of the hashcodes for the underlying
   7.376 +     * method's declaring class name and the method's name.
   7.377 +     */
   7.378 +    public int hashCode() {
   7.379 +        return getDeclaringClass().getName().hashCode() ^ getName().hashCode();
   7.380 +    }
   7.381 +
   7.382 +    /**
   7.383 +     * Returns a string describing this {@code Method}.  The string is
   7.384 +     * formatted as the method access modifiers, if any, followed by
   7.385 +     * the method return type, followed by a space, followed by the
   7.386 +     * class declaring the method, followed by a period, followed by
   7.387 +     * the method name, followed by a parenthesized, comma-separated
   7.388 +     * list of the method's formal parameter types. If the method
   7.389 +     * throws checked exceptions, the parameter list is followed by a
   7.390 +     * space, followed by the word throws followed by a
   7.391 +     * comma-separated list of the thrown exception types.
   7.392 +     * For example:
   7.393 +     * <pre>
   7.394 +     *    public boolean java.lang.Object.equals(java.lang.Object)
   7.395 +     * </pre>
   7.396 +     *
   7.397 +     * <p>The access modifiers are placed in canonical order as
   7.398 +     * specified by "The Java Language Specification".  This is
   7.399 +     * {@code public}, {@code protected} or {@code private} first,
   7.400 +     * and then other modifiers in the following order:
   7.401 +     * {@code abstract}, {@code static}, {@code final},
   7.402 +     * {@code synchronized}, {@code native}, {@code strictfp}.
   7.403 +     */
   7.404 +    public String toString() {
   7.405 +        try {
   7.406 +            StringBuilder sb = new StringBuilder();
   7.407 +            int mod = getModifiers() & Modifier.methodModifiers();
   7.408 +            if (mod != 0) {
   7.409 +                sb.append(Modifier.toString(mod)).append(' ');
   7.410 +            }
   7.411 +            sb.append(Field.getTypeName(getReturnType())).append(' ');
   7.412 +            sb.append(Field.getTypeName(getDeclaringClass())).append('.');
   7.413 +            sb.append(getName()).append('(');
   7.414 +            Class<?>[] params = parameterTypes; // avoid clone
   7.415 +            for (int j = 0; j < params.length; j++) {
   7.416 +                sb.append(Field.getTypeName(params[j]));
   7.417 +                if (j < (params.length - 1))
   7.418 +                    sb.append(',');
   7.419 +            }
   7.420 +            sb.append(')');
   7.421 +            Class<?>[] exceptions = exceptionTypes; // avoid clone
   7.422 +            if (exceptions.length > 0) {
   7.423 +                sb.append(" throws ");
   7.424 +                for (int k = 0; k < exceptions.length; k++) {
   7.425 +                    sb.append(exceptions[k].getName());
   7.426 +                    if (k < (exceptions.length - 1))
   7.427 +                        sb.append(',');
   7.428 +                }
   7.429 +            }
   7.430 +            return sb.toString();
   7.431 +        } catch (Exception e) {
   7.432 +            return "<" + e + ">";
   7.433 +        }
   7.434 +    }
   7.435 +
   7.436 +    /**
   7.437 +     * Returns a string describing this {@code Method}, including
   7.438 +     * type parameters.  The string is formatted as the method access
   7.439 +     * modifiers, if any, followed by an angle-bracketed
   7.440 +     * comma-separated list of the method's type parameters, if any,
   7.441 +     * followed by the method's generic return type, followed by a
   7.442 +     * space, followed by the class declaring the method, followed by
   7.443 +     * a period, followed by the method name, followed by a
   7.444 +     * parenthesized, comma-separated list of the method's generic
   7.445 +     * formal parameter types.
   7.446 +     *
   7.447 +     * If this method was declared to take a variable number of
   7.448 +     * arguments, instead of denoting the last parameter as
   7.449 +     * "<tt><i>Type</i>[]</tt>", it is denoted as
   7.450 +     * "<tt><i>Type</i>...</tt>".
   7.451 +     *
   7.452 +     * A space is used to separate access modifiers from one another
   7.453 +     * and from the type parameters or return type.  If there are no
   7.454 +     * type parameters, the type parameter list is elided; if the type
   7.455 +     * parameter list is present, a space separates the list from the
   7.456 +     * class name.  If the method is declared to throw exceptions, the
   7.457 +     * parameter list is followed by a space, followed by the word
   7.458 +     * throws followed by a comma-separated list of the generic thrown
   7.459 +     * exception types.  If there are no type parameters, the type
   7.460 +     * parameter list is elided.
   7.461 +     *
   7.462 +     * <p>The access modifiers are placed in canonical order as
   7.463 +     * specified by "The Java Language Specification".  This is
   7.464 +     * {@code public}, {@code protected} or {@code private} first,
   7.465 +     * and then other modifiers in the following order:
   7.466 +     * {@code abstract}, {@code static}, {@code final},
   7.467 +     * {@code synchronized}, {@code native}, {@code strictfp}.
   7.468 +     *
   7.469 +     * @return a string describing this {@code Method},
   7.470 +     * include type parameters
   7.471 +     *
   7.472 +     * @since 1.5
   7.473 +     */
   7.474 +    public String toGenericString() {
   7.475 +        try {
   7.476 +            StringBuilder sb = new StringBuilder();
   7.477 +            int mod = getModifiers() & Modifier.methodModifiers();
   7.478 +            if (mod != 0) {
   7.479 +                sb.append(Modifier.toString(mod)).append(' ');
   7.480 +            }
   7.481 +            TypeVariable<?>[] typeparms = getTypeParameters();
   7.482 +            if (typeparms.length > 0) {
   7.483 +                boolean first = true;
   7.484 +                sb.append('<');
   7.485 +                for(TypeVariable<?> typeparm: typeparms) {
   7.486 +                    if (!first)
   7.487 +                        sb.append(',');
   7.488 +                    // Class objects can't occur here; no need to test
   7.489 +                    // and call Class.getName().
   7.490 +                    sb.append(typeparm.toString());
   7.491 +                    first = false;
   7.492 +                }
   7.493 +                sb.append("> ");
   7.494 +            }
   7.495 +
   7.496 +            Type genRetType = getGenericReturnType();
   7.497 +            sb.append( ((genRetType instanceof Class<?>)?
   7.498 +                        Field.getTypeName((Class<?>)genRetType):genRetType.toString()))
   7.499 +                    .append(' ');
   7.500 +
   7.501 +            sb.append(Field.getTypeName(getDeclaringClass())).append('.');
   7.502 +            sb.append(getName()).append('(');
   7.503 +            Type[] params = getGenericParameterTypes();
   7.504 +            for (int j = 0; j < params.length; j++) {
   7.505 +                String param = (params[j] instanceof Class)?
   7.506 +                    Field.getTypeName((Class)params[j]):
   7.507 +                    (params[j].toString());
   7.508 +                if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
   7.509 +                    param = param.replaceFirst("\\[\\]$", "...");
   7.510 +                sb.append(param);
   7.511 +                if (j < (params.length - 1))
   7.512 +                    sb.append(',');
   7.513 +            }
   7.514 +            sb.append(')');
   7.515 +            Type[] exceptions = getGenericExceptionTypes();
   7.516 +            if (exceptions.length > 0) {
   7.517 +                sb.append(" throws ");
   7.518 +                for (int k = 0; k < exceptions.length; k++) {
   7.519 +                    sb.append((exceptions[k] instanceof Class)?
   7.520 +                              ((Class)exceptions[k]).getName():
   7.521 +                              exceptions[k].toString());
   7.522 +                    if (k < (exceptions.length - 1))
   7.523 +                        sb.append(',');
   7.524 +                }
   7.525 +            }
   7.526 +            return sb.toString();
   7.527 +        } catch (Exception e) {
   7.528 +            return "<" + e + ">";
   7.529 +        }
   7.530 +    }
   7.531 +
   7.532 +    /**
   7.533 +     * Invokes the underlying method represented by this {@code Method}
   7.534 +     * object, on the specified object with the specified parameters.
   7.535 +     * Individual parameters are automatically unwrapped to match
   7.536 +     * primitive formal parameters, and both primitive and reference
   7.537 +     * parameters are subject to method invocation conversions as
   7.538 +     * necessary.
   7.539 +     *
   7.540 +     * <p>If the underlying method is static, then the specified {@code obj}
   7.541 +     * argument is ignored. It may be null.
   7.542 +     *
   7.543 +     * <p>If the number of formal parameters required by the underlying method is
   7.544 +     * 0, the supplied {@code args} array may be of length 0 or null.
   7.545 +     *
   7.546 +     * <p>If the underlying method is an instance method, it is invoked
   7.547 +     * using dynamic method lookup as documented in The Java Language
   7.548 +     * Specification, Second Edition, section 15.12.4.4; in particular,
   7.549 +     * overriding based on the runtime type of the target object will occur.
   7.550 +     *
   7.551 +     * <p>If the underlying method is static, the class that declared
   7.552 +     * the method is initialized if it has not already been initialized.
   7.553 +     *
   7.554 +     * <p>If the method completes normally, the value it returns is
   7.555 +     * returned to the caller of invoke; if the value has a primitive
   7.556 +     * type, it is first appropriately wrapped in an object. However,
   7.557 +     * if the value has the type of an array of a primitive type, the
   7.558 +     * elements of the array are <i>not</i> wrapped in objects; in
   7.559 +     * other words, an array of primitive type is returned.  If the
   7.560 +     * underlying method return type is void, the invocation returns
   7.561 +     * null.
   7.562 +     *
   7.563 +     * @param obj  the object the underlying method is invoked from
   7.564 +     * @param args the arguments used for the method call
   7.565 +     * @return the result of dispatching the method represented by
   7.566 +     * this object on {@code obj} with parameters
   7.567 +     * {@code args}
   7.568 +     *
   7.569 +     * @exception IllegalAccessException    if this {@code Method} object
   7.570 +     *              is enforcing Java language access control and the underlying
   7.571 +     *              method is inaccessible.
   7.572 +     * @exception IllegalArgumentException  if the method is an
   7.573 +     *              instance method and the specified object argument
   7.574 +     *              is not an instance of the class or interface
   7.575 +     *              declaring the underlying method (or of a subclass
   7.576 +     *              or implementor thereof); if the number of actual
   7.577 +     *              and formal parameters differ; if an unwrapping
   7.578 +     *              conversion for primitive arguments fails; or if,
   7.579 +     *              after possible unwrapping, a parameter value
   7.580 +     *              cannot be converted to the corresponding formal
   7.581 +     *              parameter type by a method invocation conversion.
   7.582 +     * @exception InvocationTargetException if the underlying method
   7.583 +     *              throws an exception.
   7.584 +     * @exception NullPointerException      if the specified object is null
   7.585 +     *              and the method is an instance method.
   7.586 +     * @exception ExceptionInInitializerError if the initialization
   7.587 +     * provoked by this method fails.
   7.588 +     */
   7.589 +    public Object invoke(Object obj, Object... args)
   7.590 +        throws IllegalAccessException, IllegalArgumentException,
   7.591 +           InvocationTargetException
   7.592 +    {
   7.593 +        if (!override) {
   7.594 +            if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
   7.595 +                Class<?> caller = Reflection.getCallerClass(1);
   7.596 +
   7.597 +                checkAccess(caller, clazz, obj, modifiers);
   7.598 +            }
   7.599 +        }
   7.600 +        MethodAccessor ma = methodAccessor;             // read volatile
   7.601 +        if (ma == null) {
   7.602 +            ma = acquireMethodAccessor();
   7.603 +        }
   7.604 +        return ma.invoke(obj, args);
   7.605 +    }
   7.606 +
   7.607 +    /**
   7.608 +     * Returns {@code true} if this method is a bridge
   7.609 +     * method; returns {@code false} otherwise.
   7.610 +     *
   7.611 +     * @return true if and only if this method is a bridge
   7.612 +     * method as defined by the Java Language Specification.
   7.613 +     * @since 1.5
   7.614 +     */
   7.615 +    public boolean isBridge() {
   7.616 +        return (getModifiers() & Modifier.BRIDGE) != 0;
   7.617 +    }
   7.618 +
   7.619 +    /**
   7.620 +     * Returns {@code true} if this method was declared to take
   7.621 +     * a variable number of arguments; returns {@code false}
   7.622 +     * otherwise.
   7.623 +     *
   7.624 +     * @return {@code true} if an only if this method was declared to
   7.625 +     * take a variable number of arguments.
   7.626 +     * @since 1.5
   7.627 +     */
   7.628 +    public boolean isVarArgs() {
   7.629 +        return (getModifiers() & Modifier.VARARGS) != 0;
   7.630 +    }
   7.631 +
   7.632 +    /**
   7.633 +     * Returns {@code true} if this method is a synthetic
   7.634 +     * method; returns {@code false} otherwise.
   7.635 +     *
   7.636 +     * @return true if and only if this method is a synthetic
   7.637 +     * method as defined by the Java Language Specification.
   7.638 +     * @since 1.5
   7.639 +     */
   7.640 +    public boolean isSynthetic() {
   7.641 +        return Modifier.isSynthetic(getModifiers());
   7.642 +    }
   7.643 +
   7.644 +    // NOTE that there is no synchronization used here. It is correct
   7.645 +    // (though not efficient) to generate more than one MethodAccessor
   7.646 +    // for a given Method. However, avoiding synchronization will
   7.647 +    // probably make the implementation more scalable.
   7.648 +    private MethodAccessor acquireMethodAccessor() {
   7.649 +        // First check to see if one has been created yet, and take it
   7.650 +        // if so
   7.651 +        MethodAccessor tmp = null;
   7.652 +        if (root != null) tmp = root.getMethodAccessor();
   7.653 +        if (tmp != null) {
   7.654 +            methodAccessor = tmp;
   7.655 +        } else {
   7.656 +            // Otherwise fabricate one and propagate it up to the root
   7.657 +            tmp = reflectionFactory.newMethodAccessor(this);
   7.658 +            setMethodAccessor(tmp);
   7.659 +        }
   7.660 +
   7.661 +        return tmp;
   7.662 +    }
   7.663 +
   7.664 +    // Returns MethodAccessor for this Method object, not looking up
   7.665 +    // the chain to the root
   7.666 +    MethodAccessor getMethodAccessor() {
   7.667 +        return methodAccessor;
   7.668 +    }
   7.669 +
   7.670 +    // Sets the MethodAccessor for this Method object and
   7.671 +    // (recursively) its root
   7.672 +    void setMethodAccessor(MethodAccessor accessor) {
   7.673 +        methodAccessor = accessor;
   7.674 +        // Propagate up
   7.675 +        if (root != null) {
   7.676 +            root.setMethodAccessor(accessor);
   7.677 +        }
   7.678 +    }
   7.679 +
   7.680 +    /**
   7.681 +     * @throws NullPointerException {@inheritDoc}
   7.682 +     * @since 1.5
   7.683 +     */
   7.684 +    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
   7.685 +        if (annotationClass == null)
   7.686 +            throw new NullPointerException();
   7.687 +
   7.688 +        return (T) declaredAnnotations().get(annotationClass);
   7.689 +    }
   7.690 +
   7.691 +    /**
   7.692 +     * @since 1.5
   7.693 +     */
   7.694 +    public Annotation[] getDeclaredAnnotations()  {
   7.695 +        return AnnotationParser.toArray(declaredAnnotations());
   7.696 +    }
   7.697 +
   7.698 +    private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
   7.699 +
   7.700 +    private synchronized  Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
   7.701 +        if (declaredAnnotations == null) {
   7.702 +            declaredAnnotations = AnnotationParser.parseAnnotations(
   7.703 +                annotations, sun.misc.SharedSecrets.getJavaLangAccess().
   7.704 +                getConstantPool(getDeclaringClass()),
   7.705 +                getDeclaringClass());
   7.706 +        }
   7.707 +        return declaredAnnotations;
   7.708 +    }
   7.709 +
   7.710 +    /**
   7.711 +     * Returns the default value for the annotation member represented by
   7.712 +     * this {@code Method} instance.  If the member is of a primitive type,
   7.713 +     * an instance of the corresponding wrapper type is returned. Returns
   7.714 +     * null if no default is associated with the member, or if the method
   7.715 +     * instance does not represent a declared member of an annotation type.
   7.716 +     *
   7.717 +     * @return the default value for the annotation member represented
   7.718 +     *     by this {@code Method} instance.
   7.719 +     * @throws TypeNotPresentException if the annotation is of type
   7.720 +     *     {@link Class} and no definition can be found for the
   7.721 +     *     default class value.
   7.722 +     * @since  1.5
   7.723 +     */
   7.724 +    public Object getDefaultValue() {
   7.725 +        if  (annotationDefault == null)
   7.726 +            return null;
   7.727 +        Class<?> memberType = AnnotationType.invocationHandlerReturnType(
   7.728 +            getReturnType());
   7.729 +        Object result = AnnotationParser.parseMemberValue(
   7.730 +            memberType, ByteBuffer.wrap(annotationDefault),
   7.731 +            sun.misc.SharedSecrets.getJavaLangAccess().
   7.732 +                getConstantPool(getDeclaringClass()),
   7.733 +            getDeclaringClass());
   7.734 +        if (result instanceof sun.reflect.annotation.ExceptionProxy)
   7.735 +            throw new AnnotationFormatError("Invalid default: " + this);
   7.736 +        return result;
   7.737 +    }
   7.738 +
   7.739 +    /**
   7.740 +     * Returns an array of arrays that represent the annotations on the formal
   7.741 +     * parameters, in declaration order, of the method represented by
   7.742 +     * this {@code Method} object. (Returns an array of length zero if the
   7.743 +     * underlying method is parameterless.  If the method has one or more
   7.744 +     * parameters, a nested array of length zero is returned for each parameter
   7.745 +     * with no annotations.) The annotation objects contained in the returned
   7.746 +     * arrays are serializable.  The caller of this method is free to modify
   7.747 +     * the returned arrays; it will have no effect on the arrays returned to
   7.748 +     * other callers.
   7.749 +     *
   7.750 +     * @return an array of arrays that represent the annotations on the formal
   7.751 +     *    parameters, in declaration order, of the method represented by this
   7.752 +     *    Method object
   7.753 +     * @since 1.5
   7.754 +     */
   7.755 +    public Annotation[][] getParameterAnnotations() {
   7.756 +        int numParameters = parameterTypes.length;
   7.757 +        if (parameterAnnotations == null)
   7.758 +            return new Annotation[numParameters][0];
   7.759 +
   7.760 +        Annotation[][] result = AnnotationParser.parseParameterAnnotations(
   7.761 +            parameterAnnotations,
   7.762 +            sun.misc.SharedSecrets.getJavaLangAccess().
   7.763 +                getConstantPool(getDeclaringClass()),
   7.764 +            getDeclaringClass());
   7.765 +        if (result.length != numParameters)
   7.766 +            throw new java.lang.annotation.AnnotationFormatError(
   7.767 +                "Parameter annotations don't match number of parameters");
   7.768 +        return result;
   7.769 +    }
   7.770 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/emul/src/main/java/java/lang/reflect/Modifier.java	Tue Dec 04 13:29:17 2012 +0100
     8.3 @@ -0,0 +1,452 @@
     8.4 +/*
     8.5 + * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
     8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.7 + *
     8.8 + * This code is free software; you can redistribute it and/or modify it
     8.9 + * under the terms of the GNU General Public License version 2 only, as
    8.10 + * published by the Free Software Foundation.  Oracle designates this
    8.11 + * particular file as subject to the "Classpath" exception as provided
    8.12 + * by Oracle in the LICENSE file that accompanied this code.
    8.13 + *
    8.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    8.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    8.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    8.17 + * version 2 for more details (a copy is included in the LICENSE file that
    8.18 + * accompanied this code).
    8.19 + *
    8.20 + * You should have received a copy of the GNU General Public License version
    8.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    8.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    8.23 + *
    8.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    8.25 + * or visit www.oracle.com if you need additional information or have any
    8.26 + * questions.
    8.27 + */
    8.28 +
    8.29 +package java.lang.reflect;
    8.30 +
    8.31 +import java.security.AccessController;
    8.32 +import sun.reflect.LangReflectAccess;
    8.33 +import sun.reflect.ReflectionFactory;
    8.34 +
    8.35 +/**
    8.36 + * The Modifier class provides {@code static} methods and
    8.37 + * constants to decode class and member access modifiers.  The sets of
    8.38 + * modifiers are represented as integers with distinct bit positions
    8.39 + * representing different modifiers.  The values for the constants
    8.40 + * representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of
    8.41 + * <cite>The Java&trade; Virtual Machine Specification</cite>.
    8.42 + *
    8.43 + * @see Class#getModifiers()
    8.44 + * @see Member#getModifiers()
    8.45 + *
    8.46 + * @author Nakul Saraiya
    8.47 + * @author Kenneth Russell
    8.48 + */
    8.49 +public
    8.50 +class Modifier {
    8.51 +
    8.52 +    /*
    8.53 +     * Bootstrapping protocol between java.lang and java.lang.reflect
    8.54 +     *  packages
    8.55 +     */
    8.56 +    static {
    8.57 +        sun.reflect.ReflectionFactory factory =
    8.58 +            AccessController.doPrivileged(
    8.59 +                new ReflectionFactory.GetReflectionFactoryAction());
    8.60 +        factory.setLangReflectAccess(new java.lang.reflect.ReflectAccess());
    8.61 +    }
    8.62 +
    8.63 +    /**
    8.64 +     * Return {@code true} if the integer argument includes the
    8.65 +     * {@code public} modifier, {@code false} otherwise.
    8.66 +     *
    8.67 +     * @param   mod a set of modifiers
    8.68 +     * @return {@code true} if {@code mod} includes the
    8.69 +     * {@code public} modifier; {@code false} otherwise.
    8.70 +     */
    8.71 +    public static boolean isPublic(int mod) {
    8.72 +        return (mod & PUBLIC) != 0;
    8.73 +    }
    8.74 +
    8.75 +    /**
    8.76 +     * Return {@code true} if the integer argument includes the
    8.77 +     * {@code private} modifier, {@code false} otherwise.
    8.78 +     *
    8.79 +     * @param   mod a set of modifiers
    8.80 +     * @return {@code true} if {@code mod} includes the
    8.81 +     * {@code private} modifier; {@code false} otherwise.
    8.82 +     */
    8.83 +    public static boolean isPrivate(int mod) {
    8.84 +        return (mod & PRIVATE) != 0;
    8.85 +    }
    8.86 +
    8.87 +    /**
    8.88 +     * Return {@code true} if the integer argument includes the
    8.89 +     * {@code protected} modifier, {@code false} otherwise.
    8.90 +     *
    8.91 +     * @param   mod a set of modifiers
    8.92 +     * @return {@code true} if {@code mod} includes the
    8.93 +     * {@code protected} modifier; {@code false} otherwise.
    8.94 +     */
    8.95 +    public static boolean isProtected(int mod) {
    8.96 +        return (mod & PROTECTED) != 0;
    8.97 +    }
    8.98 +
    8.99 +    /**
   8.100 +     * Return {@code true} if the integer argument includes the
   8.101 +     * {@code static} modifier, {@code false} otherwise.
   8.102 +     *
   8.103 +     * @param   mod a set of modifiers
   8.104 +     * @return {@code true} if {@code mod} includes the
   8.105 +     * {@code static} modifier; {@code false} otherwise.
   8.106 +     */
   8.107 +    public static boolean isStatic(int mod) {
   8.108 +        return (mod & STATIC) != 0;
   8.109 +    }
   8.110 +
   8.111 +    /**
   8.112 +     * Return {@code true} if the integer argument includes the
   8.113 +     * {@code final} modifier, {@code false} otherwise.
   8.114 +     *
   8.115 +     * @param   mod a set of modifiers
   8.116 +     * @return {@code true} if {@code mod} includes the
   8.117 +     * {@code final} modifier; {@code false} otherwise.
   8.118 +     */
   8.119 +    public static boolean isFinal(int mod) {
   8.120 +        return (mod & FINAL) != 0;
   8.121 +    }
   8.122 +
   8.123 +    /**
   8.124 +     * Return {@code true} if the integer argument includes the
   8.125 +     * {@code synchronized} modifier, {@code false} otherwise.
   8.126 +     *
   8.127 +     * @param   mod a set of modifiers
   8.128 +     * @return {@code true} if {@code mod} includes the
   8.129 +     * {@code synchronized} modifier; {@code false} otherwise.
   8.130 +     */
   8.131 +    public static boolean isSynchronized(int mod) {
   8.132 +        return (mod & SYNCHRONIZED) != 0;
   8.133 +    }
   8.134 +
   8.135 +    /**
   8.136 +     * Return {@code true} if the integer argument includes the
   8.137 +     * {@code volatile} modifier, {@code false} otherwise.
   8.138 +     *
   8.139 +     * @param   mod a set of modifiers
   8.140 +     * @return {@code true} if {@code mod} includes the
   8.141 +     * {@code volatile} modifier; {@code false} otherwise.
   8.142 +     */
   8.143 +    public static boolean isVolatile(int mod) {
   8.144 +        return (mod & VOLATILE) != 0;
   8.145 +    }
   8.146 +
   8.147 +    /**
   8.148 +     * Return {@code true} if the integer argument includes the
   8.149 +     * {@code transient} modifier, {@code false} otherwise.
   8.150 +     *
   8.151 +     * @param   mod a set of modifiers
   8.152 +     * @return {@code true} if {@code mod} includes the
   8.153 +     * {@code transient} modifier; {@code false} otherwise.
   8.154 +     */
   8.155 +    public static boolean isTransient(int mod) {
   8.156 +        return (mod & TRANSIENT) != 0;
   8.157 +    }
   8.158 +
   8.159 +    /**
   8.160 +     * Return {@code true} if the integer argument includes the
   8.161 +     * {@code native} modifier, {@code false} otherwise.
   8.162 +     *
   8.163 +     * @param   mod a set of modifiers
   8.164 +     * @return {@code true} if {@code mod} includes the
   8.165 +     * {@code native} modifier; {@code false} otherwise.
   8.166 +     */
   8.167 +    public static boolean isNative(int mod) {
   8.168 +        return (mod & NATIVE) != 0;
   8.169 +    }
   8.170 +
   8.171 +    /**
   8.172 +     * Return {@code true} if the integer argument includes the
   8.173 +     * {@code interface} modifier, {@code false} otherwise.
   8.174 +     *
   8.175 +     * @param   mod a set of modifiers
   8.176 +     * @return {@code true} if {@code mod} includes the
   8.177 +     * {@code interface} modifier; {@code false} otherwise.
   8.178 +     */
   8.179 +    public static boolean isInterface(int mod) {
   8.180 +        return (mod & INTERFACE) != 0;
   8.181 +    }
   8.182 +
   8.183 +    /**
   8.184 +     * Return {@code true} if the integer argument includes the
   8.185 +     * {@code abstract} modifier, {@code false} otherwise.
   8.186 +     *
   8.187 +     * @param   mod a set of modifiers
   8.188 +     * @return {@code true} if {@code mod} includes the
   8.189 +     * {@code abstract} modifier; {@code false} otherwise.
   8.190 +     */
   8.191 +    public static boolean isAbstract(int mod) {
   8.192 +        return (mod & ABSTRACT) != 0;
   8.193 +    }
   8.194 +
   8.195 +    /**
   8.196 +     * Return {@code true} if the integer argument includes the
   8.197 +     * {@code strictfp} modifier, {@code false} otherwise.
   8.198 +     *
   8.199 +     * @param   mod a set of modifiers
   8.200 +     * @return {@code true} if {@code mod} includes the
   8.201 +     * {@code strictfp} modifier; {@code false} otherwise.
   8.202 +     */
   8.203 +    public static boolean isStrict(int mod) {
   8.204 +        return (mod & STRICT) != 0;
   8.205 +    }
   8.206 +
   8.207 +    /**
   8.208 +     * Return a string describing the access modifier flags in
   8.209 +     * the specified modifier. For example:
   8.210 +     * <blockquote><pre>
   8.211 +     *    public final synchronized strictfp
   8.212 +     * </pre></blockquote>
   8.213 +     * The modifier names are returned in an order consistent with the
   8.214 +     * suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of
   8.215 +     * <cite>The Java&trade; Language Specification</cite>.
   8.216 +     * The full modifier ordering used by this method is:
   8.217 +     * <blockquote> {@code
   8.218 +     * public protected private abstract static final transient
   8.219 +     * volatile synchronized native strictfp
   8.220 +     * interface } </blockquote>
   8.221 +     * The {@code interface} modifier discussed in this class is
   8.222 +     * not a true modifier in the Java language and it appears after
   8.223 +     * all other modifiers listed by this method.  This method may
   8.224 +     * return a string of modifiers that are not valid modifiers of a
   8.225 +     * Java entity; in other words, no checking is done on the
   8.226 +     * possible validity of the combination of modifiers represented
   8.227 +     * by the input.
   8.228 +     *
   8.229 +     * Note that to perform such checking for a known kind of entity,
   8.230 +     * such as a constructor or method, first AND the argument of
   8.231 +     * {@code toString} with the appropriate mask from a method like
   8.232 +     * {@link #constructorModifiers} or {@link #methodModifiers}.
   8.233 +     *
   8.234 +     * @param   mod a set of modifiers
   8.235 +     * @return  a string representation of the set of modifiers
   8.236 +     * represented by {@code mod}
   8.237 +     */
   8.238 +    public static String toString(int mod) {
   8.239 +        StringBuffer sb = new StringBuffer();
   8.240 +        int len;
   8.241 +
   8.242 +        if ((mod & PUBLIC) != 0)        sb.append("public ");
   8.243 +        if ((mod & PROTECTED) != 0)     sb.append("protected ");
   8.244 +        if ((mod & PRIVATE) != 0)       sb.append("private ");
   8.245 +
   8.246 +        /* Canonical order */
   8.247 +        if ((mod & ABSTRACT) != 0)      sb.append("abstract ");
   8.248 +        if ((mod & STATIC) != 0)        sb.append("static ");
   8.249 +        if ((mod & FINAL) != 0)         sb.append("final ");
   8.250 +        if ((mod & TRANSIENT) != 0)     sb.append("transient ");
   8.251 +        if ((mod & VOLATILE) != 0)      sb.append("volatile ");
   8.252 +        if ((mod & SYNCHRONIZED) != 0)  sb.append("synchronized ");
   8.253 +        if ((mod & NATIVE) != 0)        sb.append("native ");
   8.254 +        if ((mod & STRICT) != 0)        sb.append("strictfp ");
   8.255 +        if ((mod & INTERFACE) != 0)     sb.append("interface ");
   8.256 +
   8.257 +        if ((len = sb.length()) > 0)    /* trim trailing space */
   8.258 +            return sb.toString().substring(0, len-1);
   8.259 +        return "";
   8.260 +    }
   8.261 +
   8.262 +    /*
   8.263 +     * Access modifier flag constants from tables 4.1, 4.4, 4.5, and 4.7 of
   8.264 +     * <cite>The Java&trade; Virtual Machine Specification</cite>
   8.265 +     */
   8.266 +
   8.267 +    /**
   8.268 +     * The {@code int} value representing the {@code public}
   8.269 +     * modifier.
   8.270 +     */
   8.271 +    public static final int PUBLIC           = 0x00000001;
   8.272 +
   8.273 +    /**
   8.274 +     * The {@code int} value representing the {@code private}
   8.275 +     * modifier.
   8.276 +     */
   8.277 +    public static final int PRIVATE          = 0x00000002;
   8.278 +
   8.279 +    /**
   8.280 +     * The {@code int} value representing the {@code protected}
   8.281 +     * modifier.
   8.282 +     */
   8.283 +    public static final int PROTECTED        = 0x00000004;
   8.284 +
   8.285 +    /**
   8.286 +     * The {@code int} value representing the {@code static}
   8.287 +     * modifier.
   8.288 +     */
   8.289 +    public static final int STATIC           = 0x00000008;
   8.290 +
   8.291 +    /**
   8.292 +     * The {@code int} value representing the {@code final}
   8.293 +     * modifier.
   8.294 +     */
   8.295 +    public static final int FINAL            = 0x00000010;
   8.296 +
   8.297 +    /**
   8.298 +     * The {@code int} value representing the {@code synchronized}
   8.299 +     * modifier.
   8.300 +     */
   8.301 +    public static final int SYNCHRONIZED     = 0x00000020;
   8.302 +
   8.303 +    /**
   8.304 +     * The {@code int} value representing the {@code volatile}
   8.305 +     * modifier.
   8.306 +     */
   8.307 +    public static final int VOLATILE         = 0x00000040;
   8.308 +
   8.309 +    /**
   8.310 +     * The {@code int} value representing the {@code transient}
   8.311 +     * modifier.
   8.312 +     */
   8.313 +    public static final int TRANSIENT        = 0x00000080;
   8.314 +
   8.315 +    /**
   8.316 +     * The {@code int} value representing the {@code native}
   8.317 +     * modifier.
   8.318 +     */
   8.319 +    public static final int NATIVE           = 0x00000100;
   8.320 +
   8.321 +    /**
   8.322 +     * The {@code int} value representing the {@code interface}
   8.323 +     * modifier.
   8.324 +     */
   8.325 +    public static final int INTERFACE        = 0x00000200;
   8.326 +
   8.327 +    /**
   8.328 +     * The {@code int} value representing the {@code abstract}
   8.329 +     * modifier.
   8.330 +     */
   8.331 +    public static final int ABSTRACT         = 0x00000400;
   8.332 +
   8.333 +    /**
   8.334 +     * The {@code int} value representing the {@code strictfp}
   8.335 +     * modifier.
   8.336 +     */
   8.337 +    public static final int STRICT           = 0x00000800;
   8.338 +
   8.339 +    // Bits not (yet) exposed in the public API either because they
   8.340 +    // have different meanings for fields and methods and there is no
   8.341 +    // way to distinguish between the two in this class, or because
   8.342 +    // they are not Java programming language keywords
   8.343 +    static final int BRIDGE    = 0x00000040;
   8.344 +    static final int VARARGS   = 0x00000080;
   8.345 +    static final int SYNTHETIC = 0x00001000;
   8.346 +    static final int ANNOTATION= 0x00002000;
   8.347 +    static final int ENUM      = 0x00004000;
   8.348 +    static boolean isSynthetic(int mod) {
   8.349 +      return (mod & SYNTHETIC) != 0;
   8.350 +    }
   8.351 +
   8.352 +    /**
   8.353 +     * See JLSv3 section 8.1.1.
   8.354 +     */
   8.355 +    private static final int CLASS_MODIFIERS =
   8.356 +        Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE |
   8.357 +        Modifier.ABSTRACT       | Modifier.STATIC       | Modifier.FINAL   |
   8.358 +        Modifier.STRICT;
   8.359 +
   8.360 +    /**
   8.361 +     * See JLSv3 section 9.1.1.
   8.362 +     */
   8.363 +    private static final int INTERFACE_MODIFIERS =
   8.364 +        Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE |
   8.365 +        Modifier.ABSTRACT       | Modifier.STATIC       | Modifier.STRICT;
   8.366 +
   8.367 +
   8.368 +    /**
   8.369 +     * See JLSv3 section 8.8.3.
   8.370 +     */
   8.371 +    private static final int CONSTRUCTOR_MODIFIERS =
   8.372 +        Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE;
   8.373 +
   8.374 +    /**
   8.375 +     * See JLSv3 section 8.4.3.
   8.376 +     */
   8.377 +    private static final int METHOD_MODIFIERS =
   8.378 +        Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE |
   8.379 +        Modifier.ABSTRACT       | Modifier.STATIC       | Modifier.FINAL   |
   8.380 +        Modifier.SYNCHRONIZED   | Modifier.NATIVE       | Modifier.STRICT;
   8.381 +
   8.382 +    /**
   8.383 +     * See JLSv3 section 8.3.1.
   8.384 +     */
   8.385 +    private static final int FIELD_MODIFIERS =
   8.386 +        Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE |
   8.387 +        Modifier.STATIC         | Modifier.FINAL        | Modifier.TRANSIENT |
   8.388 +        Modifier.VOLATILE;
   8.389 +
   8.390 +    /**
   8.391 +     * Return an {@code int} value OR-ing together the source language
   8.392 +     * modifiers that can be applied to a class.
   8.393 +     * @return an {@code int} value OR-ing together the source language
   8.394 +     * modifiers that can be applied to a class.
   8.395 +     *
   8.396 +     * @jls 8.1.1 Class Modifiers
   8.397 +     * @since 1.7
   8.398 +     */
   8.399 +    public static int classModifiers() {
   8.400 +        return CLASS_MODIFIERS;
   8.401 +    }
   8.402 +
   8.403 +    /**
   8.404 +     * Return an {@code int} value OR-ing together the source language
   8.405 +     * modifiers that can be applied to an interface.
   8.406 +     * @return an {@code int} value OR-ing together the source language
   8.407 +     * modifiers that can be applied to an inteface.
   8.408 +     *
   8.409 +     * @jls 9.1.1 Interface Modifiers
   8.410 +     * @since 1.7
   8.411 +     */
   8.412 +    public static int interfaceModifiers() {
   8.413 +        return INTERFACE_MODIFIERS;
   8.414 +    }
   8.415 +
   8.416 +    /**
   8.417 +     * Return an {@code int} value OR-ing together the source language
   8.418 +     * modifiers that can be applied to a constructor.
   8.419 +     * @return an {@code int} value OR-ing together the source language
   8.420 +     * modifiers that can be applied to a constructor.
   8.421 +     *
   8.422 +     * @jls 8.8.3 Constructor Modifiers
   8.423 +     * @since 1.7
   8.424 +     */
   8.425 +    public static int constructorModifiers() {
   8.426 +        return CONSTRUCTOR_MODIFIERS;
   8.427 +    }
   8.428 +
   8.429 +    /**
   8.430 +     * Return an {@code int} value OR-ing together the source language
   8.431 +     * modifiers that can be applied to a method.
   8.432 +     * @return an {@code int} value OR-ing together the source language
   8.433 +     * modifiers that can be applied to a method.
   8.434 +     *
   8.435 +     * @jls 8.4.3 Method Modifiers
   8.436 +     * @since 1.7
   8.437 +     */
   8.438 +    public static int methodModifiers() {
   8.439 +        return METHOD_MODIFIERS;
   8.440 +    }
   8.441 +
   8.442 +
   8.443 +    /**
   8.444 +     * Return an {@code int} value OR-ing together the source language
   8.445 +     * modifiers that can be applied to a field.
   8.446 +     * @return an {@code int} value OR-ing together the source language
   8.447 +     * modifiers that can be applied to a field.
   8.448 +     *
   8.449 +     * @jls 8.3.1 Field Modifiers
   8.450 +     * @since 1.7
   8.451 +     */
   8.452 +    public static int fieldModifiers() {
   8.453 +        return FIELD_MODIFIERS;
   8.454 +    }
   8.455 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/emul/src/main/java/java/lang/reflect/Type.java	Tue Dec 04 13:29:17 2012 +0100
     9.3 @@ -0,0 +1,37 @@
     9.4 +/*
     9.5 + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + *
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.  Oracle designates this
    9.11 + * particular file as subject to the "Classpath" exception as provided
    9.12 + * by Oracle in the LICENSE file that accompanied this code.
    9.13 + *
    9.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.17 + * version 2 for more details (a copy is included in the LICENSE file that
    9.18 + * accompanied this code).
    9.19 + *
    9.20 + * You should have received a copy of the GNU General Public License version
    9.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.23 + *
    9.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    9.25 + * or visit www.oracle.com if you need additional information or have any
    9.26 + * questions.
    9.27 + */
    9.28 +
    9.29 +package java.lang.reflect;
    9.30 +
    9.31 +/**
    9.32 + * Type is the common superinterface for all types in the Java
    9.33 + * programming language. These include raw types, parameterized types,
    9.34 + * array types, type variables and primitive types.
    9.35 + *
    9.36 + * @since 1.5
    9.37 + */
    9.38 +
    9.39 +public interface Type {
    9.40 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/emul/src/main/java/java/lang/reflect/TypeVariable.java	Tue Dec 04 13:29:17 2012 +0100
    10.3 @@ -0,0 +1,89 @@
    10.4 +/*
    10.5 + * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
    10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.7 + *
    10.8 + * This code is free software; you can redistribute it and/or modify it
    10.9 + * under the terms of the GNU General Public License version 2 only, as
   10.10 + * published by the Free Software Foundation.  Oracle designates this
   10.11 + * particular file as subject to the "Classpath" exception as provided
   10.12 + * by Oracle in the LICENSE file that accompanied this code.
   10.13 + *
   10.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   10.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   10.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   10.17 + * version 2 for more details (a copy is included in the LICENSE file that
   10.18 + * accompanied this code).
   10.19 + *
   10.20 + * You should have received a copy of the GNU General Public License version
   10.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   10.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   10.23 + *
   10.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   10.25 + * or visit www.oracle.com if you need additional information or have any
   10.26 + * questions.
   10.27 + */
   10.28 +
   10.29 +package java.lang.reflect;
   10.30 +
   10.31 +/**
   10.32 + * TypeVariable is the common superinterface for type variables of kinds.
   10.33 + * A type variable is created the first time it is needed by a reflective
   10.34 + * method, as specified in this package.  If a type variable t is referenced
   10.35 + * by a type (i.e, class, interface or annotation type) T, and T is declared
   10.36 + * by the nth enclosing class of T (see JLS 8.1.2), then the creation of t
   10.37 + * requires the resolution (see JVMS 5) of the ith enclosing class of T,
   10.38 + * for i = 0 to n, inclusive. Creating a type variable must not cause the
   10.39 + * creation of its bounds. Repeated creation of a type variable has no effect.
   10.40 + *
   10.41 + * <p>Multiple objects may be instantiated at run-time to
   10.42 + * represent a given type variable. Even though a type variable is
   10.43 + * created only once, this does not imply any requirement to cache
   10.44 + * instances representing the type variable. However, all instances
   10.45 + * representing a type variable must be equal() to each other.
   10.46 + * As a consequence, users of type variables must not rely on the identity
   10.47 + * of instances of classes implementing this interface.
   10.48 + *
   10.49 + * @param <D> the type of generic declaration that declared the
   10.50 + * underlying type variable.
   10.51 + *
   10.52 + * @since 1.5
   10.53 + */
   10.54 +public interface TypeVariable<D extends GenericDeclaration> extends Type {
   10.55 +    /**
   10.56 +     * Returns an array of {@code Type} objects representing the
   10.57 +     * upper bound(s) of this type variable.  Note that if no upper bound is
   10.58 +     * explicitly declared, the upper bound is {@code Object}.
   10.59 +     *
   10.60 +     * <p>For each upper bound B: <ul> <li>if B is a parameterized
   10.61 +     * type or a type variable, it is created, (see {@link
   10.62 +     * java.lang.reflect.ParameterizedType ParameterizedType} for the
   10.63 +     * details of the creation process for parameterized types).
   10.64 +     * <li>Otherwise, B is resolved.  </ul>
   10.65 +     *
   10.66 +     * @throws TypeNotPresentException  if any of the
   10.67 +     *     bounds refers to a non-existent type declaration
   10.68 +     * @throws MalformedParameterizedTypeException if any of the
   10.69 +     *     bounds refer to a parameterized type that cannot be instantiated
   10.70 +     *     for any reason
   10.71 +     * @return an array of {@code Type}s representing the upper
   10.72 +     *     bound(s) of this type variable
   10.73 +    */
   10.74 +    Type[] getBounds();
   10.75 +
   10.76 +    /**
   10.77 +     * Returns the {@code GenericDeclaration} object representing the
   10.78 +     * generic declaration declared this type variable.
   10.79 +     *
   10.80 +     * @return the generic declaration declared for this type variable.
   10.81 +     *
   10.82 +     * @since 1.5
   10.83 +     */
   10.84 +    D getGenericDeclaration();
   10.85 +
   10.86 +    /**
   10.87 +     * Returns the name of this type variable, as it occurs in the source code.
   10.88 +     *
   10.89 +     * @return the name of this type variable, as it appears in the source code
   10.90 +     */
   10.91 +    String getName();
   10.92 +}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/emul/src/main/java/java/lang/reflect/package-info.java	Tue Dec 04 13:29:17 2012 +0100
    11.3 @@ -0,0 +1,49 @@
    11.4 +/*
    11.5 + * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
    11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 + *
    11.8 + * This code is free software; you can redistribute it and/or modify it
    11.9 + * under the terms of the GNU General Public License version 2 only, as
   11.10 + * published by the Free Software Foundation.  Oracle designates this
   11.11 + * particular file as subject to the "Classpath" exception as provided
   11.12 + * by Oracle in the LICENSE file that accompanied this code.
   11.13 + *
   11.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   11.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.17 + * version 2 for more details (a copy is included in the LICENSE file that
   11.18 + * accompanied this code).
   11.19 + *
   11.20 + * You should have received a copy of the GNU General Public License version
   11.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   11.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.23 + *
   11.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   11.25 + * or visit www.oracle.com if you need additional information or have any
   11.26 + * questions.
   11.27 + */
   11.28 +
   11.29 +/**
   11.30 + * Provides classes and interfaces for obtaining reflective
   11.31 + * information about classes and objects.  Reflection allows
   11.32 + * programmatic access to information about the fields, methods and
   11.33 + * constructors of loaded classes, and the use of reflected fields,
   11.34 + * methods, and constructors to operate on their underlying
   11.35 + * counterparts, within security restrictions.
   11.36 + *
   11.37 + * <p>{@code AccessibleObject} allows suppression of access checks if
   11.38 + * the necessary {@code ReflectPermission} is available.
   11.39 + *
   11.40 + * <p>{@code Array} provides static methods to dynamically create and
   11.41 + * access arrays.
   11.42 + *
   11.43 + * <p>Classes in this package, along with {@code java.lang.Class}
   11.44 + * accommodate applications such as debuggers, interpreters, object
   11.45 + * inspectors, class browsers, and services such as Object
   11.46 + * Serialization and JavaBeans that need access to either the public
   11.47 + * members of a target object (based on its runtime class) or the
   11.48 + * members declared by a given class.
   11.49 + *
   11.50 + * @since JDK1.1
   11.51 + */
   11.52 +package java.lang.reflect;