Java Reference
In-Depth Information
If the compile-time declaration is
void
, then the method invocation must be a top level ex-
The reason is that such a method invocation produces no value and so must be
used only in a situation where a value is not needed.
A method is
signature polymorphic
if and only if all of the following conditions hold:
• It is declared in the
java.lang.invoke.MethodHandle
class.
• It has a return type of
Object
.
• It is
native
.
In Java SE 7, the only signature polymorphic methods are the
invoke
and
invokeExact
methods of the class
java.lang.invoke.MethodHandle
.
If the compile-time declaration for the method invocation is
not
a signature polymorphic
method, then the types of its parameters are the types of its formal parameters, and the res-
ult type is its chosen result type.
Otherwise, if the compile-time declaration for the method invocation is a signature poly-
morphic method, then:
• The types of its parameters are the static types of the actual argument expressions.
the static type
Void
.
• The result type is determined as follows:
♦ If the method invocation expression is an expression statement, the method is
void
.
♦ Otherwise, if the method invocation expression is the operand of a cast expres-
pression.
♦ Otherwise, the return type is the method's declared return type,
Object
.
The following compile-time information is then associated with the method invocation for
use at run time:
• The name of the method.
• The qualifying type of the method invocation (§
13.1
).