1.1 --- a/rt/emul/mini/src/main/java/java/lang/Class.java Thu Aug 29 08:00:42 2013 +0000
1.2 +++ b/rt/emul/mini/src/main/java/java/lang/Class.java Sat Sep 28 01:32:59 2013 +0200
1.3 @@ -975,6 +975,137 @@
1.4 }
1.5
1.6 /**
1.7 + * Returns an array of {@code Field} objects reflecting all the fields
1.8 + * declared by the class or interface represented by this
1.9 + * {@code Class} object. This includes public, protected, default
1.10 + * (package) access, and private fields, but excludes inherited fields.
1.11 + * The elements in the array returned are not sorted and are not in any
1.12 + * particular order. This method returns an array of length 0 if the class
1.13 + * or interface declares no fields, or if this {@code Class} object
1.14 + * represents a primitive type, an array class, or void.
1.15 + *
1.16 + * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.3.
1.17 + *
1.18 + * @return the array of {@code Field} objects representing all the
1.19 + * declared fields of this class
1.20 + * @exception SecurityException
1.21 + * If a security manager, <i>s</i>, is present and any of the
1.22 + * following conditions is met:
1.23 + *
1.24 + * <ul>
1.25 + *
1.26 + * <li> invocation of
1.27 + * {@link SecurityManager#checkMemberAccess
1.28 + * s.checkMemberAccess(this, Member.DECLARED)} denies
1.29 + * access to the declared fields within this class
1.30 + *
1.31 + * <li> the caller's class loader is not the same as or an
1.32 + * ancestor of the class loader for the current class and
1.33 + * invocation of {@link SecurityManager#checkPackageAccess
1.34 + * s.checkPackageAccess()} denies access to the package
1.35 + * of this class
1.36 + *
1.37 + * </ul>
1.38 + *
1.39 + * @since JDK1.1
1.40 + */
1.41 + public Field[] getDeclaredFields() throws SecurityException {
1.42 + throw new SecurityException();
1.43 + }
1.44 +
1.45 + /**
1.46 + * <b>Bck2Brwsr</b> emulation can only seek public methods, otherwise it
1.47 + * throws a {@code SecurityException}.
1.48 + * <p>
1.49 + * Returns a {@code Method} object that reflects the specified
1.50 + * declared method of the class or interface represented by this
1.51 + * {@code Class} object. The {@code name} parameter is a
1.52 + * {@code String} that specifies the simple name of the desired
1.53 + * method, and the {@code parameterTypes} parameter is an array of
1.54 + * {@code Class} objects that identify the method's formal parameter
1.55 + * types, in declared order. If more than one method with the same
1.56 + * parameter types is declared in a class, and one of these methods has a
1.57 + * return type that is more specific than any of the others, that method is
1.58 + * returned; otherwise one of the methods is chosen arbitrarily. If the
1.59 + * name is "<init>"or "<clinit>" a {@code NoSuchMethodException}
1.60 + * is raised.
1.61 + *
1.62 + * @param name the name of the method
1.63 + * @param parameterTypes the parameter array
1.64 + * @return the {@code Method} object for the method of this class
1.65 + * matching the specified name and parameters
1.66 + * @exception NoSuchMethodException if a matching method is not found.
1.67 + * @exception NullPointerException if {@code name} is {@code null}
1.68 + * @exception SecurityException
1.69 + * If a security manager, <i>s</i>, is present and any of the
1.70 + * following conditions is met:
1.71 + *
1.72 + * <ul>
1.73 + *
1.74 + * <li> invocation of
1.75 + * {@link SecurityManager#checkMemberAccess
1.76 + * s.checkMemberAccess(this, Member.DECLARED)} denies
1.77 + * access to the declared method
1.78 + *
1.79 + * <li> the caller's class loader is not the same as or an
1.80 + * ancestor of the class loader for the current class and
1.81 + * invocation of {@link SecurityManager#checkPackageAccess
1.82 + * s.checkPackageAccess()} denies access to the package
1.83 + * of this class
1.84 + *
1.85 + * </ul>
1.86 + *
1.87 + * @since JDK1.1
1.88 + */
1.89 + public Method getDeclaredMethod(String name, Class<?>... parameterTypes)
1.90 + throws NoSuchMethodException, SecurityException {
1.91 + try {
1.92 + return getMethod(name, parameterTypes);
1.93 + } catch (NoSuchMethodException ex) {
1.94 + throw new SecurityException();
1.95 + }
1.96 + }
1.97 +
1.98 + /**
1.99 + * Returns a {@code Field} object that reflects the specified declared
1.100 + * field of the class or interface represented by this {@code Class}
1.101 + * object. The {@code name} parameter is a {@code String} that
1.102 + * specifies the simple name of the desired field. Note that this method
1.103 + * will not reflect the {@code length} field of an array class.
1.104 + *
1.105 + * @param name the name of the field
1.106 + * @return the {@code Field} object for the specified field in this
1.107 + * class
1.108 + * @exception NoSuchFieldException if a field with the specified name is
1.109 + * not found.
1.110 + * @exception NullPointerException if {@code name} is {@code null}
1.111 + * @exception SecurityException
1.112 + * If a security manager, <i>s</i>, is present and any of the
1.113 + * following conditions is met:
1.114 + *
1.115 + * <ul>
1.116 + *
1.117 + * <li> invocation of
1.118 + * {@link SecurityManager#checkMemberAccess
1.119 + * s.checkMemberAccess(this, Member.DECLARED)} denies
1.120 + * access to the declared field
1.121 + *
1.122 + * <li> the caller's class loader is not the same as or an
1.123 + * ancestor of the class loader for the current class and
1.124 + * invocation of {@link SecurityManager#checkPackageAccess
1.125 + * s.checkPackageAccess()} denies access to the package
1.126 + * of this class
1.127 + *
1.128 + * </ul>
1.129 + *
1.130 + * @since JDK1.1
1.131 + */
1.132 + public Field getDeclaredField(String name)
1.133 + throws SecurityException {
1.134 + throw new SecurityException();
1.135 + }
1.136 +
1.137 + /**
1.138 * Character.isDigit answers {@code true} to some non-ascii
1.139 * digits. This one does not.
1.140 */