Java Reference
In-Depth Information
• If the form is
ClassName
. super .
NonWildTypeArguments
opt
Identifier
, then the
name of the method is the
Identifier
and the class to be searched is the superclass
of the class
C
denoted by
ClassName
.
It is a compile-time error if
C
is not a lexically enclosing class of the current class.
It is a compile-time error if
C
is the class
Object
.
Let
T
be the type declaration immediately enclosing the method invocation. It is a
compile-time error if
T
is the class
Object
or
T
is an interface.
• If the form is
TypeName
.
NonWildTypeArguments Identifier
, then the name of the
method is the
Identifier
and the class to be searched is the class
C
denoted by
TypeName
.
If
TypeName
is the name of an interface rather than a class, then a compile-time er-
ror occurs, because this form can invoke only
static
methods and interfaces have no
static
methods.
15.12.2. Compile-Time Step 2: Determine Method Signature
The second step searches the type determined in the previous step for member methods.
This step uses the name of the method and the types of the argument expressions to locate
methods that are both
accessible
and
applicable
, that is, declarations that can be correctly
invoked on the given arguments.
There may be more than one such method, in which case the
most specific
one is chosen.
The descriptor (signature plus return type) of the most specific method is one used at run
time to perform the method dispatch.
method invocation conversion (§
15.12.2.3
), or it is an applicable variable arity method
The process of determining applicability begins by determining the potentially applicable
methods (§
15.12.2.1
).
The remainder of the process is split into three phases, to ensure compatibility with ver-
sions of the Java programming language prior to Java SE 5.0. The phases are:
ing or unboxing conversion, or the use of variable arity method invocation. If no
applicable method is found during this phase then processing continues to the
second phase.