Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Name: gm110360 Date: 02/17/2004 FULL PRODUCT VERSION : build 1.5.0-beta-b32c, mixed mode ADDITIONAL OS VERSION INFORMATION : Microsoft Windows 2000 [Version 5.00.2195] A DESCRIPTION OF THE PROBLEM : This is related to 4974939 and 4920452. But these only report about converting from literals, and don't mention the extra cast workaround. Narrowing type conversion during autoboxing requires an extra cast.: // These Long lw= (long) new Integer(7); Integer iw=(int) (long) new Long(3L); long d = (long) 6; int f = (int) 7L; // work well, while: iw=(int) new Long(3L); // doesn't compile Double dw= (double) new Float(1.2F); Float fw=(float) (double) new Double(3.2); double d = (double) 6.7F; float f = (float) 6.0; fw=(float) new Double(4.3); doesn't compile Double dw=(double) new Integer(3); Integer iw= (int) (double) new Double(3.2); double d = (double) 6; int i = (int) 7.5; iw= (int) new Double(3.2); doesn't compile EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Casting once world be great. ACTUAL - Compile time error REPRODUCIBILITY : This bug can be reproduced always. CUSTOMER SUBMITTED WORKAROUND : Adding the extra cast, since casting primitives works fine. (Incident Review ID: 239114) ======================================================================
|