changeset 13899:9417e1bcded6 jdk-9+110

8151691: [Findbugs]jdk.internal.math.FormattedFloatingDecimal.getExponent() may expose internal rep Summary: The reference to the internal array is never leaked via the public API but some internal API clarification is added. Reviewed-by: rriggs
author bpb
date Fri, 11 Mar 2016 14:07:03 -0800
parents ff3eb28f63c1
children 005df9abb92e edb95a70985f
files src/java.base/share/classes/jdk/internal/math/FormattedFloatingDecimal.java
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/jdk/internal/math/FormattedFloatingDecimal.java	Fri Mar 11 11:27:12 2016 -0800
+++ b/src/java.base/share/classes/jdk/internal/math/FormattedFloatingDecimal.java	Fri Mar 11 14:07:03 2016 -0800
@@ -106,10 +106,28 @@
         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;
     }