EXPRESSIONS
Runtime Evaluation of Method Invocation
15.11.4
15.11.4.6
Implementation Note: Combining Frames
In order to allow certain kinds of code optimization, implementations are permit
ted some freedom to combine activation frames. Suppose that a method invocation
within class
C
is to invoke a method
m
within class
S
. Then the current activation
frame may be used to provide space for
S
instead of creating a new activation
frame only if one of the following conditions is true:
Class
C
and class
S
have the same class loader ( 20.14) and class
S
is not
SecurityManager
or a subclass of
SecurityManager
.
Class
S
has no class loader (this fact indicates that it is a system class); class
S
is not
SecurityManager
or a subclass of
SecurityManager
; and method
m
is known not to call, directly or indirectly, any method of
SecurityManager
( 20.17) or any of its subclasses.
15.11.4.7
Example: Target Reference and Static Methods
When a target reference is computed and then discarded because the invocation
mode is
static
, the reference is not examined to see whether it is
null
:
class Test {
static void mountain() {
System.out.println("Monadnock");
}
static Test favorite(){
System.out.print("Mount ");
return null;
}
public static void main(String[] args) {
favorite().mountain();
}
}
which prints:
Mount Monadnock
Here
favorite
returns
null
, yet no
NullPointerException
is thrown.
15.11.4.8
Example: Evaluation Order
As part of an instance method invocation ( 15.11), there is an expression that
denotes the object to be invoked. This expression appears to be fully evaluated
before any part of any argument expression to the method invocation is evaluated.
337
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved