8151691: [Findbugs]jdk.internal.math.FormattedFloatingDecimal.getExponent() may expose internal rep
authorbpb
Fri, 11 Mar 2016 14:07:03 -0800
changeset 36474 91e6d9d79973
parent 36473 95a8dbae68c9
child 36475 c96c0ae61961
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
jdk/src/java.base/share/classes/jdk/internal/math/FormattedFloatingDecimal.java
--- a/jdk/src/java.base/share/classes/jdk/internal/math/FormattedFloatingDecimal.java	Fri Mar 11 11:27:12 2016 -0800
+++ b/jdk/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;
     }