Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 17565 Details for
Bug 83965
[1.5][compiler] Widening conversion is possible when unboxing in a cast expression
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Test case
X.java (text/plain), 3.33 KB, created by
Olivier Thomann
on 2005-01-28 15:02:14 EST
(
hide
)
Description:
Test case
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2005-01-28 15:02:14 EST
Size:
3.33 KB
patch
obsolete
>public class X { > > private static void checkByteConversions(Byte _byte) { > short s = (short) _byte; > int i = (int) _byte; > long l = (long) _byte; > float f = (float) _byte; > double d = (double) _byte; > if ( _byte.byteValue() != s ) { > System.err.println("Must be equal 0"); > } > if ( _byte.byteValue() != i ) { > System.err.println("Must be equal 1"); > } > if ( _byte.byteValue() != l ) { > System.err.println("Must be equal 2"); > } > if ( _byte.byteValue() != f ) { > System.err.println("Must be equal 3"); > } > if ( _byte.byteValue() != d ) { > System.err.println("Must be equal 4"); > } > } > > private static void checkCharacterConversions(Character _character) { > int i = (int) _character; > long l = (long) _character; > float f = (float) _character; > double d = (double) _character; > if ( _character.charValue() != i ) { > System.err.println("Must be equal 9"); > } > if ( _character.charValue() != l ) { > System.err.println("Must be equal 10"); > } > if ( _character.charValue() != f ) { > System.err.println("Must be equal 11"); > } > if ( _character.charValue() != d ) { > System.err.println("Must be equal 12"); > } > } > > private static void checkFloatConversions(Float _float) { > double d = (double) _float; > if ( _float.floatValue() != d ) { > System.err.println("Must be equal 18"); > } > } > > private static void checkIntegerConversions(Integer _integer) { > long l = (long) _integer; > float f = (float) _integer; > double d = (double) _integer; > if ( _integer.intValue() != l ) { > System.err.println("Must be equal 13"); > } > if ( _integer.intValue() != f ) { > System.err.println("Must be equal 14"); > } > if ( _integer.intValue() != d ) { > System.err.println("Must be equal 15"); > } > } > > private static void checkIntegerConversions(Short _short) { > int i = (int) _short; > long l = (long) _short; > float f = (float) _short; > double d = (double) _short; > if ( _short.shortValue() != i ) { > System.err.println("Must be equal 5"); > } > if ( _short.shortValue() != l ) { > System.err.println("Must be equal 6"); > } > if ( _short.shortValue() != f ) { > System.err.println("Must be equal 7"); > } > if ( _short.shortValue() != d ) { > System.err.println("Must be equal 8"); > } > } > > private static void checkLongConversions(Long _long) { > float f = (float) _long; > double d = (double) _long; > if ( _long.longValue() != f ) { > System.err.println("Must be equal 16"); > } > if ( _long.longValue() != d ) { > System.err.println("Must be equal 17"); > } > } > > public static void main(String args[]) { > Byte _byte = new Byte((byte)2); > Character _character = new Character('@'); > Short _short = new Short((short)255); > Integer _integer = new Integer(12345678); > Long _long = new Long(1234567890); > Float _float = new Float(-0.0); > > checkByteConversions(_byte); > checkIntegerConversions(_short); > checkCharacterConversions(_character); > checkIntegerConversions(_integer); > checkLongConversions(_long); > checkFloatConversions(_float); > > System.out.println("OK"); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 83965
: 17565 |
17569