JDK-8058875 : javadoc for CharsetEncoder.maxBytesPerChar() should be made clearer
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Affected Version: 9
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2014-09-22
  • Updated: 2016-02-02
  • Resolved: 2016-02-02
Related Reports
Cloners :  
Relates :  
Description
Javadoc currently states:

--------------------------------
public final float CharsetEncoder.maxBytesPerChar()
Returns the maximum number of bytes that will be produced for each character of input. 
This value may be used to compute the worst-case size of the output buffer required for a given input sequence.
--------------------------------

This may be misinterpreted, as it may be not clear what CHARACTERs this sentence is about.
If they were Unicode code-points, UTF8Encoder.maxBytesPerChar() should return 4.0.
However, as the statement is in fact about Java characters, it correctly returns 3.0.


Comments
It's not that easy to modify the javadoc here, as it gets generated out of a template along with the java code.
01-10-2014

I'm changing this bug to an enhancement request to improve the javadoc.
23-09-2014

I assume this should be closed as not a bug or else re-purposed to clarifying any javadoc or docs that might not be clear.
23-09-2014