Java Reference
In-Depth Information
the implementation (stack pointer, program counter, reference to previous activation frame,
and the like). If there is not sufficient memory available to create such an activation frame,
a StackOverflowError is thrown.
The newly created activation frame becomes the current activation frame. The effect of this
is to assign the argument values to corresponding freshly created parameter variables of the
method, and to make the target reference available as this , if there is a target reference. Be-
fore each argument value is assigned to its corresponding parameter variable, it is subjected
to method invocation conversion (§ 5.3 ), which includes any required value set conversion
5.1.13 ) .
If the erasure (§ 4.6 ) of the type of the method being invoked differs in its signature from the
erasure of the type of the compile-time declaration for the method invocation (§ 15.12.3 ) ,
then if any of the argument values is an object which is not an instance of a subclass or
subinterface of the erasure of the corresponding formal parameter type in the compile-time
declaration for the method invocation, then a ClassCastException is thrown.
If the method m is a native method but the necessary native, implementation-dependent bin-
ary code has not been loaded or otherwise cannot be dynamically linked, then an Unsatis-
fiedLinkError is thrown.
If the method m is not synchronized , control is transferred to the body of the method m to be
invoked.
If the method m is synchronized , then an object must be locked before the transfer of control.
No further progress can be made until the current thread can obtain the lock. If there is a
target reference, then the target object must be locked; otherwise the Class object for class
S , the class of the method m , must be locked. Control is then transferred to the body of the
method m to be invoked. The object is automatically unlocked when execution of the body
of the method has completed, whether normally or abruptly. The locking and unlocking be-
havior is exactly as if the body of the method were embedded in a synchronized statement
14.19 ) .
Example 15.12.4.5-1. Invoked Method Signature Has Different Erasure Than
Compile-Time Method Signature
Consider the declarations:
abstract class C<T> {
abstract T id(T x);
}
class D extends C<String> {
Search WWH ::




Custom Search