Hi,
I think I got it...
JLS 15.12.2.2 Choose the Most Specific Method
quote:
================================================================
... The
Java programming language uses the rule that the most specific method is chosen ...
Let m be a name and suppose that there are two declarations of methods named m, each having n parameters. Suppose that one declaration appears within a class or interface T and the types of the parameters are T1, ..., Tn; suppose moreover than the other declaration appears within a class or interface U and that the types of the parameters are U1, ..., Un. Then the method m declared in T is more specific than the method m declared in U if and only if both of the following are true:
a) T can be converted to U by method invocation conversion
b) Tj can be converted to Uj by method invocation conversion, for all j from 1 to n.
================================================================
so, for the 1st version:
T = Scope
Tj = int
U = Base
Uj = long
method invocation = m(int)
so, the method m declared in T is more specific than the method m declared in U, 'cause there's no problem in converting int to long.
but, for the 2nd version:
T = Scope
Tj = long
U = Base
Uj = int
method invocation = m(long)
there'll be a method invocation convertion problem (possible loss of precision) when converting long to int (rule b)
correct me if i'm wrong..
- eric