Hello,

Please review the small amendment to make the specifications for some of the "exact" methods in Math and StrictMath more explicit in their exceptional behavior:

    JDK-8230074: Improve specification for {Math, StrictMath}.negateExact
    http://cr.openjdk.java.net/~darcy/8230074.0/

Patch below.

Thanks,

-Joe

--- old/src/java.base/share/classes/java/lang/Math.java 2019-08-28 09:31:35.640999999 -0700 +++ new/src/java.base/share/classes/java/lang/Math.java 2019-08-28 09:31:35.500999999 -0700
@@ -952,6 +952,7 @@
     /**
      * Returns the argument incremented by one, throwing an exception if the
      * result overflows an {@code int}.
+     * The overflow only occurs for {@linkplain Integer#MAX_VALUE the maximum value}.
      *
      * @param a the value to increment
      * @return the result
@@ -970,6 +971,7 @@
     /**
      * Returns the argument incremented by one, throwing an exception if the
      * result overflows a {@code long}.
+     * The overflow only occurs for {@linkplain Long#MAX_VALUE the maximum value}.
      *
      * @param a the value to increment
      * @return the result
@@ -988,6 +990,7 @@
     /**
      * Returns the argument decremented by one, throwing an exception if the
      * result overflows an {@code int}.
+     * The overflow only occurs for {@linkplain Integer#MIN_VALUE the minimum value}.
      *
      * @param a the value to decrement
      * @return the result
@@ -1006,6 +1009,7 @@
     /**
      * Returns the argument decremented by one, throwing an exception if the
      * result overflows a {@code long}.
+     * The overflow only occurs for {@linkplain Long#MIN_VALUE the minimum value}.
      *
      * @param a the value to decrement
      * @return the result
@@ -1024,6 +1028,7 @@
     /**
      * Returns the negation of the argument, throwing an exception if the
      * result overflows an {@code int}.
+     * The overflow only occurs for {@linkplain Integer#MIN_VALUE the minimum value}.
      *
      * @param a the value to negate
      * @return the result
@@ -1042,6 +1047,7 @@
     /**
      * Returns the negation of the argument, throwing an exception if the
      * result overflows a {@code long}.
+     * The overflow only occurs for {@linkplain Long#MIN_VALUE the minimum value}.
      *
      * @param a the value to negate
      * @return the result
--- old/src/java.base/share/classes/java/lang/StrictMath.java 2019-08-28 09:31:35.996999999 -0700 +++ new/src/java.base/share/classes/java/lang/StrictMath.java 2019-08-28 09:31:35.856999999 -0700
@@ -837,6 +837,7 @@
     /**
      * Returns the argument incremented by one,
      * throwing an exception if the result overflows an {@code int}.
+     * The overflow only occurs for {@linkplain Integer#MAX_VALUE the maximum value}.
      *
      * @param a the value to increment
      * @return the result
@@ -851,6 +852,7 @@
     /**
      * Returns the argument incremented by one,
      * throwing an exception if the result overflows a {@code long}.
+     * The overflow only occurs for {@linkplain Long#MAX_VALUE the maximum value}.
      *
      * @param a the value to increment
      * @return the result
@@ -865,6 +867,7 @@
     /**
      * Returns the argument decremented by one,
      * throwing an exception if the result overflows an {@code int}.
+     * The overflow only occurs for {@linkplain Integer#MIN_VALUE the minimum value}.
      *
      * @param a the value to decrement
      * @return the result
@@ -879,6 +882,7 @@
     /**
      * Returns the argument decremented by one,
      * throwing an exception if the result overflows a {@code long}.
+     * The overflow only occurs for {@linkplain Long#MIN_VALUE the minimum value}.
      *
      * @param a the value to decrement
      * @return the result
@@ -893,6 +897,7 @@
     /**
      * Returns the negation of the argument,
      * throwing an exception if the result overflows an {@code int}.
+     * The overflow only occurs for {@linkplain Integer#MIN_VALUE the minimum value}.
      *
      * @param a the value to negate
      * @return the result
@@ -907,6 +912,7 @@
     /**
      * Returns the negation of the argument,
      * throwing an exception if the result overflows a {@code long}.
+     * The overflow only occurs for {@linkplain Long#MIN_VALUE the minimum value}.
      *
      * @param a the value to negate
      * @return the result

Reply via email to