8151691: [Findbugs]jdk.internal.math.FormattedFloatingDecimal.getExponent() may expose internal rep

The reference to the internal array is never leaked via the public API but some internal API clarification is added.

Reviewed-by: rriggs
This commit is contained in:
Brian Burkhalter 2016-03-11 14:07:03 -08:00
parent 1a08d0a1d9
commit f876e4bbd2

View File

@ -106,10 +106,28 @@ public class FormattedFloatingDecimal{
return decExponentRounded - 1;
}
/**
* Returns the mantissa as a {@code char[]}. Note that the returned value
* is a reference to the internal {@code char[]} containing the mantissa,
* therefore code invoking this method should not pass the return value to
* external code but should in that case make a copy.
*
* @return a reference to the internal {@code char[]} representing the
* mantissa.
*/
public char[] getMantissa(){
return mantissa;
}
/**
* Returns the exponent as a {@code char[]}. Note that the returned value
* is a reference to the internal {@code char[]} containing the exponent,
* therefore code invoking this method should not pass the return value to
* external code but should in that case make a copy.
*
* @return a reference to the internal {@code char[]} representing the
* exponent.
*/
public char[] getExponent(){
return exponent;
}