JDK-4770188 : byte to char a narrowing conversion?
  • Type: Bug
  • Component: specification
  • Sub-Component: language
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: generic
  • Submitted: 2002-10-29
  • Updated: 2016-09-20
  • Resolved: 2002-10-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Related Reports
Relates :  
Description
JLS 5.1.3 defines the byte to char conversion as a narrowing
conversion that simply discards bits.  That doesn't work because the
conversion adds bits, not removes bits.  Is the sign extended before
discarding bits or is the value padded with zeroes?  This is
completely unspecified in the JLS and implementations could differ.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic FIXED IN: tiger INTEGRATED IN: tiger VERIFIED IN: tiger
14-06-2004

PUBLIC COMMENTS A conversion from byte to char is both a widening and a narrowing conversion. First, the byte is widened to an int (and sign extended) and then it is narrowed to a char (and zero-extended, at the JVM level).
10-06-2004

EVALUATION True. Fixed in 3rd edition draft. ###@###.### 2002-10-29
29-10-2002