Java Reference
In-Depth Information
low a violation of the type system. A cast may be used (§ 5.5 , § 15.16 ) to en-
sure that pvec references a ColoredPoint[] :
Click here to view code image
cpvec = (ColoredPoint[])pvec; // OK, but may throw an
// exception at run time
5.3. Method Invocation Conversion
Method invocation conversion is applied to each argument value in a method or constructor
invocation (§ 8.8.7.1 , § 15.9 , § 15.12 ): the type of the argument expression must be conver-
ted to the type of the corresponding parameter.
Method invocation contexts allow the use of one of the following:
• an identity conversion (§ 5.1.1 )
• a widening primitive conversion (§ 5.1.2 )
• a widening reference conversion (§ 5.1.5 )
• a boxing conversion (§ 5.1.7 ) optionally followed by widening reference conver-
sion
• an unboxing conversion (§ 5.1.8 ) optionally followed by a widening primitive con-
version.
If, after the conversions listed above have been applied, the resulting type is a raw type
4.8 ) , an unchecked conversion (§ 5.1.9 ) may then be applied.
It is a compile-time error if the chain of conversions contains two parameterized types that
are not in the subtype relation.
A value of the null type (the null reference is the only such value) may be converted to any
reference type.
If the type of the expression cannot be converted to the type of the parameter by a conver-
sion permitted in a method invocation context, then a compile-time error occurs.
If the type of an argument expression is either float or double , then value set conversion
5.1.13 ) is applied after the type conversion:
• If an argument value of type float is an element of the float-extended-exponent
value set, then the implementation must map the value to the nearest element of
the float value set. This conversion may result in overflow or underflow.
Search WWH ::




Custom Search