diff options
Diffstat (limited to 'libjava/java/lang/reflect')
-rw-r--r-- | libjava/java/lang/reflect/InvocationHandler.java | 43 | ||||
-rw-r--r-- | libjava/java/lang/reflect/Proxy.java | 53 |
2 files changed, 49 insertions, 47 deletions
diff --git a/libjava/java/lang/reflect/InvocationHandler.java b/libjava/java/lang/reflect/InvocationHandler.java index 91907e2..514d943 100644 --- a/libjava/java/lang/reflect/InvocationHandler.java +++ b/libjava/java/lang/reflect/InvocationHandler.java @@ -49,37 +49,38 @@ package java.lang.reflect; * interface. But in order for the proxy instance to do any good, it * needs to know what to do when interface methods are invoked! So, * this interface is basically a cool wrapper that provides runtime - * code generation needed by proxy instances.<p> + * code generation needed by proxy instances. * - * While this interface was designed for use by Proxy, it will also - * work on any object in general.<p> + * <p>While this interface was designed for use by Proxy, it will also + * work on any object in general.</p> * - * Hints for implementing this class:<br> + * <p>Hints for implementing this class:</p> + * * <ul> - * <li>Don't forget that Object.equals, Object.hashCode, and - * Object.toString will call this handler. In particular, - * a naive call to proxy.equals, proxy.hashCode, or proxy.toString - * will put you in an infinite loop. And remember that string - * concatenation also invokes toString.</li> - * <li>Obey the contract of the Method object you are handling, or - * the proxy instance will be forced to throw a - * {@link NullPointerException}, {@link ClassCastException}, - * or {@link UndeclaredThrowableException}.</li> - * <li>Be prepared to wrap/unwrap primitives as necessary.</li> - * <li>The Method object may be owned by a different interface than - * what was actually used as the qualifying type of the method - * invocation in the Java source code. This means that it might - * not always be safe to throw an exception listed as belonging - * to the method's throws clause.</li> + * <li>Don't forget that Object.equals, Object.hashCode, and + * Object.toString will call this handler. In particular, + * a naive call to proxy.equals, proxy.hashCode, or proxy.toString + * will put you in an infinite loop. And remember that string + * concatenation also invokes toString.</li> + * <li>Obey the contract of the Method object you are handling, or + * the proxy instance will be forced to throw a + * {@link NullPointerException}, {@link ClassCastException}, + * or {@link UndeclaredThrowableException}.</li> + * <li>Be prepared to wrap/unwrap primitives as necessary.</li> + * <li>The Method object may be owned by a different interface than + * what was actually used as the qualifying type of the method + * invocation in the Java source code. This means that it might + * not always be safe to throw an exception listed as belonging + * to the method's throws clause.</li> * </ul> * * <p><small>For a fun time, create an InvocationHandler that handles the - * methods of a proxy instance of the InvocationHandler interface!</small> + * methods of a proxy instance of the InvocationHandler interface!</small></p> * * @see Proxy * @see UndeclaredThrowableException * - * @author Eric Blake <ebb9@email.byu.edu> + * @author Eric Blake (ebb9@email.byu.edu) * @since 1.3 * @status updated to 1.4 */ diff --git a/libjava/java/lang/reflect/Proxy.java b/libjava/java/lang/reflect/Proxy.java index 03b2a45..56d7aeb 100644 --- a/libjava/java/lang/reflect/Proxy.java +++ b/libjava/java/lang/reflect/Proxy.java @@ -211,35 +211,36 @@ public class Proxy implements Serializable * Returns the proxy {@link Class} for the given ClassLoader and array * of interfaces, dynamically generating it if necessary. * - * There are several restrictions on this method, the violation of + * <p>There are several restrictions on this method, the violation of * which will result in an IllegalArgumentException or - * NullPointerException: + * NullPointerException:</p> + * * <ul> - * <li>All objects in `interfaces' must represent distinct interfaces. - * Classes, primitive types, null, and duplicates are forbidden.</li> - * <li>The interfaces must be visible in the specified ClassLoader. - * In other words, for each interface i: - * <code>Class.forName(i.getName(), false, loader) == i</code> - * must be true.</li> - * <li>All non-public interfaces (if any) must reside in the same - * package, or the proxy class would be non-instantiable. If - * there are no non-public interfaces, the package of the proxy - * class is unspecified.</li> - * <li>All interfaces must be compatible - if two declare a method - * with the same name and parameters, the return type must be - * the same and the throws clause of the proxy class will be - * the maximal subset of subclasses of the throws clauses for - * each method that is overridden.</li> - * <li>VM constraints limit the number of interfaces a proxy class - * may directly implement (however, the indirect inheritance - * of {@link Serializable} does not count against this limit). - * Even though most VMs can theoretically have 65535 - * superinterfaces for a class, the actual limit is smaller - * because a class's constant pool is limited to 65535 entries, - * and not all entries can be interfaces.</li> - * </ul><p> + * <li>All objects in `interfaces' must represent distinct interfaces. + * Classes, primitive types, null, and duplicates are forbidden.</li> + * <li>The interfaces must be visible in the specified ClassLoader. + * In other words, for each interface i: + * <code>Class.forName(i.getName(), false, loader) == i</code> + * must be true.</li> + * <li>All non-public interfaces (if any) must reside in the same + * package, or the proxy class would be non-instantiable. If + * there are no non-public interfaces, the package of the proxy + * class is unspecified.</li> + * <li>All interfaces must be compatible - if two declare a method + * with the same name and parameters, the return type must be + * the same and the throws clause of the proxy class will be + * the maximal subset of subclasses of the throws clauses for + * each method that is overridden.</li> + * <li>VM constraints limit the number of interfaces a proxy class + * may directly implement (however, the indirect inheritance + * of {@link Serializable} does not count against this limit). + * Even though most VMs can theoretically have 65535 + * superinterfaces for a class, the actual limit is smaller + * because a class's constant pool is limited to 65535 entries, + * and not all entries can be interfaces.</li> + * </ul> * - * Note that different orders of interfaces produce distinct classes. + * <p>Note that different orders of interfaces produce distinct classes.</p> * * @param loader the class loader to define the proxy class in; null * implies the bootstrap class loader |