Skip to content

Commit

Permalink
8230074: Improve specification for {Math, StrictMath}.negateExact
Browse files Browse the repository at this point in the history
Reviewed-by: bpb
  • Loading branch information
jddarcy committed Aug 29, 2019
1 parent bc1c0ae commit 9b0cfaf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/java.base/share/classes/java/lang/Math.java
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ public static long multiplyExact(long x, long y) {
/**
* 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
Expand All @@ -970,6 +971,7 @@ public static int incrementExact(int a) {
/**
* 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
Expand All @@ -988,6 +990,7 @@ public static long incrementExact(long a) {
/**
* 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
Expand All @@ -1006,6 +1009,7 @@ public static int decrementExact(int a) {
/**
* 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
Expand All @@ -1024,6 +1028,7 @@ public static long decrementExact(long a) {
/**
* 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
Expand All @@ -1042,6 +1047,7 @@ public static int negateExact(int a) {
/**
* 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
Expand Down
6 changes: 6 additions & 0 deletions src/java.base/share/classes/java/lang/StrictMath.java
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ public static long multiplyExact(long x, long y) {
/**
* 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
Expand All @@ -851,6 +852,7 @@ public static int incrementExact(int a) {
/**
* 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
Expand All @@ -865,6 +867,7 @@ public static long incrementExact(long a) {
/**
* 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
Expand All @@ -879,6 +882,7 @@ public static int decrementExact(int a) {
/**
* 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
Expand All @@ -893,6 +897,7 @@ public static long decrementExact(long a) {
/**
* 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
Expand All @@ -907,6 +912,7 @@ public static int negateExact(int a) {
/**
* 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
Expand Down

0 comments on commit 9b0cfaf

Please sign in to comment.