# HG changeset patch # User jrose # Date 1297757816 28800 # Node ID 2479a9688a39f56c577db5fe93b55230cfea0110 # Parent e1ba54c4360948b4a4a3f78e9c900b9e08917b60 7016520: JSR 292 rules for polymorphic signature processing must be in package-info Summary: insert rules for bytecode processors to recognize signature polymorphic names Reviewed-by: twisti diff -r e1ba54c43609 -r 2479a9688a39 jdk/src/share/classes/java/dyn/MethodHandle.java --- a/jdk/src/share/classes/java/dyn/MethodHandle.java Tue Feb 15 00:16:53 2011 -0800 +++ b/jdk/src/share/classes/java/dyn/MethodHandle.java Tue Feb 15 00:16:56 2011 -0800 @@ -93,7 +93,7 @@ * and their result can be cast to any return type. * Formally this is accomplished by giving the invoker methods * {@code Object} return types and variable-arity {@code Object} arguments, - * but they have an additional quality called "signature polymorphism" + * but they have an additional quality called signature polymorphism * which connects this freedom of invocation directly to the JVM execution stack. *
* As is usual with virtual methods, source-level calls to {@code invokeExact} @@ -297,7 +297,7 @@ * throwables locally, rethrowing only those which are legal in the context, * and wrapping ones which are illegal. * - *
+ * For the sake of tools (but not as a programming API), the signature polymorphic + * methods are marked with a private yet standard annotation, + * {@code @java.dyn.MethodHandle.PolymorphicSignature}. + * The annotation's retention is {@code RUNTIME}, so that all tools can see it. + * + *
+ * The following methods (and no others) are signature polymorphic: + *
+ * A signature polymorphic method will be declared with the following properties: + *
+ * When a call to a signature polymorphic method is compiled, the associated linkage information for + * its arguments is not array of {@code Object} (as for other similar varargs methods) + * but rather the erasure of the static types of all the arguments. + *
+ * In an argument position of a method invocation on a signature polymorphic method, + * a null literal has type {@code java.lang.Void}, unless cast to a reference type. + * (Note: This typing rule allows the null type to have its own encoding in linkage information + * distinct from other types. + *
+ * The linkage information for the return type is derived from a context-dependent target typing convention. + * The return type for a signature polymorphic method invocation is determined as follows: + *
+ * The linkage information for argument and return types is stored in the descriptor for the + * compiled (bytecode) call site. As for any invocation instruction, the arguments and return value + * will be passed directly on the JVM stack, in accordance with the descriptor, + * and without implicit boxing or unboxing. * *