Java Reference
In-Depth Information
function
more
S
pecific
( de f 1
, de f 2) returns Boolean
38
if bindable
( de f 1
. classDe f inedIn , de f 2
. classDe f inedIn )
then
arg 1
de f 1
. argTypes
arg 2
de f 2
. argTypes
while arg 1
null do
if
bindable
(
head
( arg 1)
,head
( arg 2))
then
arg 1
← tail
( arg 1)
( arg 2)
else return false
return ( true )
else return false
arg 2
← tail
end
function
filter
D
efs
( methodDe f Set ) returns Boolean
39
changes true
while changes do
changes false
foreach de f 1
methodDe f Set do
foreach de f 2
methodDe f Set do
if de f 1
de f 2 and
more
S
pecific
( de f 1
, de f 2)
then
methodDe f Set methodDe f Set −{ de f 1
}
changes true
return methodDe f Set
end
Figure 9.33: Utility Semantic Methods for Method Calls (Part 2)
return type. The method
extracts a list of parameter types from the
method signature. This list is comparedwith the list of actual parameter types.
But what exactly defines a match between formal and actual parameters?
First, both argument lists must have the same length—this is easy to check.
Next, each actual parameter must be ”bindable” to its corresponding formal
parameter.
Bindable means that it is legal to use an actual parameter whenever the
corresponding formal parameter is referenced. In Java, bindable is almost
the same as assignable. When interfaces are considered, a class object may
sometimes be bound even if it may not be directly assigned.
Now checking the feasibility of using a particular method definition in a
call is straightforward (we check that the number of parameters is correct and
that each parameter is bindable). This is detailed in Figure 9.32, Marker 37 ,
which defines the method
get
A
rgs
applicable
( f ormalParms , actualParms ). If
applicable
 
Search WWH ::




Custom Search