Skip to content

Commit

Permalink
Recommend the JDK compareUnsigned methods over our equivalents.
Browse files Browse the repository at this point in the history
This is a followup to cl/655152611. As noted in the description of that CL, I didn't migrate the _implementations_ because of GWT+J2CL constraints. Those constraints bind very few users, so I don't think we need to acknowledge them in the Javadoc.

(If we start to think that an implementation migration might actually pay off in performance improvements, we could arrange for it by setting up GWT+J2CL supersource.)

Also, note that the methods are [available under Android even without opting in to library desugaring](https://r8.googlesource.com/r8/+/5c88be7bffa502cddc989f80beffc0dd5402a057/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java#961).

RELNOTES=n/a
PiperOrigin-RevId: 662217380
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Aug 12, 2024
1 parent e232035 commit a4a7f6b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ static int flip(int value) {
* Compares the two specified {@code int} values, treating them as unsigned values between {@code
* 0} and {@code 2^32 - 1} inclusive.
*
* <p><b>Java 8+ users:</b> use {@link Integer#compareUnsigned(int, int)} instead.
* <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use the
* equivalent {@link Integer#compareUnsigned(int, int)} method instead.
*
* @param a the first unsigned {@code int} to compare
* @param b the second unsigned {@code int} to compare
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ private static long flip(long a) {
* Compares the two specified {@code long} values, treating them as unsigned values between {@code
* 0} and {@code 2^64 - 1} inclusive.
*
* <p><b>Java 8+ users:</b> use {@link Long#compareUnsigned(long, long)} instead.
* <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use the
* equivalent {@link Long#compareUnsigned(long, long)} method instead.
*
* @param a the first unsigned {@code long} to compare
* @param b the second unsigned {@code long} to compare
Expand Down
3 changes: 2 additions & 1 deletion guava/src/com/google/common/primitives/UnsignedInts.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ static int flip(int value) {
* Compares the two specified {@code int} values, treating them as unsigned values between {@code
* 0} and {@code 2^32 - 1} inclusive.
*
* <p><b>Java 8+ users:</b> use {@link Integer#compareUnsigned(int, int)} instead.
* <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use the
* equivalent {@link Integer#compareUnsigned(int, int)} method instead.
*
* @param a the first unsigned {@code int} to compare
* @param b the second unsigned {@code int} to compare
Expand Down
3 changes: 2 additions & 1 deletion guava/src/com/google/common/primitives/UnsignedLongs.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ private static long flip(long a) {
* Compares the two specified {@code long} values, treating them as unsigned values between {@code
* 0} and {@code 2^64 - 1} inclusive.
*
* <p><b>Java 8+ users:</b> use {@link Long#compareUnsigned(long, long)} instead.
* <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use the
* equivalent {@link Long#compareUnsigned(long, long)} method instead.
*
* @param a the first unsigned {@code long} to compare
* @param b the second unsigned {@code long} to compare
Expand Down

0 comments on commit a4a7f6b

Please sign in to comment.