PrimitiveRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

Disable all rules by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$).* as compiler argument.

Table of contents
  1. LessThan
  2. LessThanOrEqualTo
  3. GreaterThan
  4. GreaterThanOrEqualTo
  5. MathClampInt
  6. MathClampLong
  7. MathClampFloat
  8. MathClampDouble
  9. MathToIntExact
  10. CharacterBytes
  11. ShortBytes
  12. IntegerBytes
  13. LongBytes
  14. FloatBytes
  15. DoubleBytes
  16. IntegerSignumIsPositive
  17. IntegerSignumIsNegative
  18. LongSignumIsPositive
  19. LongSignumIsNegative
  20. IntegerCompareUnsigned
  21. LongCompareUnsigned
  22. IntegerDivideUnsigned
  23. LongDivideUnsigned
  24. IntegerRemainderUnsigned
  25. LongRemainderUnsigned
  26. IntegerParseUnsignedInt
  27. LongParseUnsignedLong
  28. IntegerParseUnsignedIntWithInt
  29. LongParseUnsignedLongWithInt
  30. IntegerToUnsignedString
  31. LongToUnsignedString
  32. IntegerToUnsignedStringWithInt
  33. LongToUnsignedStringWithInt
  34. ArraysCompareUnsignedByte
  35. ArraysCompareUnsignedInt
  36. ArraysCompareUnsignedLong

LessThan

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LessThan") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LessThan).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testLessThan() {
   return ImmutableSet.of(
-      !((byte) 3 >= (byte) 4),
-      !((char) 3 >= (char) 4),
-      !((short) 3 >= (short) 4),
-      !(3 >= 4),
-      !(3L >= 4L),
-      !(3f >= 4f),
-      !(3.0 >= 4.0));
+      (byte) 3 < (byte) 4,
+      (char) 3 < (char) 4,
+      (short) 3 < (short) 4,
+      3 < 4,
+      3L < 4L,
+      3f < 4f,
+      3.0 < 4.0);
 }

LessThanOrEqualTo

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LessThanOrEqualTo") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LessThanOrEqualTo).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testLessThanOrEqualTo() {
   return ImmutableSet.of(
-      !((byte) 3 > (byte) 4),
-      !((char) 3 > (char) 4),
-      !((short) 3 > (short) 4),
-      !(3 > 4),
-      !(3L > 4L),
-      !(3f > 4f),
-      !(3.0 > 4.0));
+      (byte) 3 <= (byte) 4,
+      (char) 3 <= (char) 4,
+      (short) 3 <= (short) 4,
+      3 <= 4,
+      3L <= 4L,
+      3f <= 4f,
+      3.0 <= 4.0);
 }

GreaterThan

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("GreaterThan") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$GreaterThan).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testGreaterThan() {
   return ImmutableSet.of(
-      !((byte) 3 <= (byte) 4),
-      !((char) 3 <= (char) 4),
-      !((short) 3 <= (short) 4),
-      !(3 <= 4),
-      !(3L <= 4L),
-      !(3f <= 4f),
-      !(3.0 <= 4.0));
+      (byte) 3 > (byte) 4,
+      (char) 3 > (char) 4,
+      (short) 3 > (short) 4,
+      3 > 4,
+      3L > 4L,
+      3f > 4f,
+      3.0 > 4.0);
 }

GreaterThanOrEqualTo

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("GreaterThanOrEqualTo") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$GreaterThanOrEqualTo).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testGreaterThanOrEqualTo() {
   return ImmutableSet.of(
-      !((byte) 3 < (byte) 4),
-      !((char) 3 < (char) 4),
-      !((short) 3 < (short) 4),
-      !(3 < 4),
-      !(3L < 4L),
-      !(3f < 4f),
-      !(3.0 < 4.0));
+      (byte) 3 >= (byte) 4,
+      (char) 3 >= (char) 4,
+      (short) 3 >= (short) 4,
+      3 >= 4,
+      3L >= 4L,
+      3f >= 4f,
+      3.0 >= 4.0);
 }

MathClampInt

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("MathClampInt") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$MathClampInt).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Integer> testMathClampInt() {
   return ImmutableSet.of(
-      Math.min(1, Math.max(2, 3)),
-      Math.min(Math.max(1, 2), 3),
-      Math.max(1, Math.min(2, 3)),
-      Math.max(Math.min(1, 2), 3),
-      Ints.constrainToRange(1, 2, 3));
+      Math.clamp(2, 3, 1),
+      Math.clamp(1, 2, 3),
+      Math.clamp(2, 1, 3),
+      Math.clamp(1, 3, 2),
+      Math.clamp(1, 2, 3));
 }

MathClampLong

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("MathClampLong") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$MathClampLong).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Long> testMathClampLong() {
   return ImmutableSet.of(
-      Math.min(1L, Math.max(2L, 3L)),
-      Math.min(Math.max(1L, 2L), 3L),
-      Math.max(1L, Math.min(2L, 3L)),
-      Math.max(Math.min(1L, 2L), 3L),
-      Longs.constrainToRange(1L, 2L, 3L));
+      Math.clamp(2L, 3L, 1L),
+      Math.clamp(1L, 2L, 3L),
+      Math.clamp(2L, 1L, 3L),
+      Math.clamp(1L, 3L, 2L),
+      Math.clamp(1L, 2L, 3L));
 }

MathClampFloat

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("MathClampFloat") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$MathClampFloat).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Float> testMathClampFloat() {
   return ImmutableSet.of(
-      Math.min(1f, Math.max(2f, 3f)),
-      Math.min(Math.max(1f, 2f), 3f),
-      Math.max(1f, Math.min(2f, 3f)),
-      Math.max(Math.min(1f, 2f), 3f),
-      Floats.constrainToRange(1f, 2f, 3f));
+      Math.clamp(2f, 3f, 1f),
+      Math.clamp(1f, 2f, 3f),
+      Math.clamp(2f, 1f, 3f),
+      Math.clamp(1f, 3f, 2f),
+      Math.clamp(1f, 2f, 3f));
 }

MathClampDouble

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("MathClampDouble") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$MathClampDouble).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Double> testMathClampDouble() {
   return ImmutableSet.of(
-      Math.min(1.0, Math.max(2.0, 3.0)),
-      Math.min(Math.max(1.0, 2.0), 3.0),
-      Math.max(1.0, Math.min(2.0, 3.0)),
-      Math.max(Math.min(1.0, 2.0), 3.0),
-      Doubles.constrainToRange(1.0, 2.0, 3.0));
+      Math.clamp(2.0, 3.0, 1.0),
+      Math.clamp(1.0, 2.0, 3.0),
+      Math.clamp(2.0, 1.0, 3.0),
+      Math.clamp(1.0, 3.0, 2.0),
+      Math.clamp(1.0, 2.0, 3.0));
 }

MathToIntExact

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("MathToIntExact") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$MathToIntExact).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testMathToIntExact() {
-  return Ints.checkedCast(Long.MAX_VALUE);
+  return Math.toIntExact(Long.MAX_VALUE);
 }

CharacterBytes

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("CharacterBytes") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$CharacterBytes).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testCharacterBytes() {
-  return Chars.BYTES;
+  return Character.BYTES;
 }

ShortBytes

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("ShortBytes") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$ShortBytes).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testShortBytes() {
-  return Shorts.BYTES;
+  return Short.BYTES;
 }

IntegerBytes

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IntegerBytes") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$IntegerBytes).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testIntegerBytes() {
-  return Ints.BYTES;
+  return Integer.BYTES;
 }

LongBytes

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LongBytes") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LongBytes).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testLongBytes() {
-  return Longs.BYTES;
+  return Long.BYTES;
 }

FloatBytes

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("FloatBytes") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$FloatBytes).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testFloatBytes() {
-  return Floats.BYTES;
+  return Float.BYTES;
 }

DoubleBytes

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleBytes") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$DoubleBytes).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testDoubleBytes() {
-  return Doubles.BYTES;
+  return Double.BYTES;
 }

IntegerSignumIsPositive

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IntegerSignumIsPositive") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$IntegerSignumIsPositive).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testIntegerSignumIsPositive() {
   return ImmutableSet.of(
-      Integer.signum(1) == 1,
-      Integer.signum(2) >= 1,
-      Integer.signum(3) != 1,
-      Integer.signum(4) < 1);
+      Integer.signum(1) > 0,
+      Integer.signum(2) > 0,
+      Integer.signum(3) <= 0,
+      Integer.signum(4) <= 0);
 }

IntegerSignumIsNegative

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IntegerSignumIsNegative") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$IntegerSignumIsNegative).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testIntegerSignumIsNegative() {
   return ImmutableSet.of(
-      Integer.signum(1) == -1,
-      Integer.signum(2) <= -1,
-      Integer.signum(3) != -1,
-      Integer.signum(4) > -1);
+      Integer.signum(1) < 0,
+      Integer.signum(2) < 0,
+      Integer.signum(3) >= 0,
+      Integer.signum(4) >= 0);
 }

LongSignumIsPositive

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LongSignumIsPositive") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LongSignumIsPositive).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testLongSignumIsPositive() {
   return ImmutableSet.of(
-      Long.signum(1L) == 1, Long.signum(2L) >= 1, Long.signum(3L) != 1, Long.signum(4L) < 1);
+      Long.signum(1L) > 0, Long.signum(2L) > 0, Long.signum(3L) <= 0, Long.signum(4L) <= 0);
 }

LongSignumIsNegative

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LongSignumIsNegative") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LongSignumIsNegative).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testLongSignumIsNegative() {
   return ImmutableSet.of(
-      Long.signum(1L) == -1, Long.signum(2L) <= -1, Long.signum(3L) != -1, Long.signum(4L) > -1);
+      Long.signum(1L) < 0, Long.signum(2L) < 0, Long.signum(3L) >= 0, Long.signum(4L) >= 0);
 }

IntegerCompareUnsigned

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IntegerCompareUnsigned") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$IntegerCompareUnsigned).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testIntegerCompareUnsigned() {
-  return UnsignedInts.compare(1, 2);
+  return Integer.compareUnsigned(1, 2);
 }

LongCompareUnsigned

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LongCompareUnsigned") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LongCompareUnsigned).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testLongCompareUnsigned() {
-  return UnsignedLongs.compare(1, 2);
+  return Long.compareUnsigned(1, 2);
 }

IntegerDivideUnsigned

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IntegerDivideUnsigned") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$IntegerDivideUnsigned).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testIntegerDivideUnsigned() {
-  return UnsignedInts.divide(1, 2);
+  return Integer.divideUnsigned(1, 2);
 }

LongDivideUnsigned

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LongDivideUnsigned") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LongDivideUnsigned).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 long testLongDivideUnsigned() {
-  return UnsignedLongs.divide(1, 2);
+  return Long.divideUnsigned(1, 2);
 }

IntegerRemainderUnsigned

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IntegerRemainderUnsigned") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$IntegerRemainderUnsigned).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testIntegerRemainderUnsigned() {
-  return UnsignedInts.remainder(1, 2);
+  return Integer.remainderUnsigned(1, 2);
 }

LongRemainderUnsigned

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LongRemainderUnsigned") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LongRemainderUnsigned).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 long testLongRemainderUnsigned() {
-  return UnsignedLongs.remainder(1, 2);
+  return Long.remainderUnsigned(1, 2);
 }

IntegerParseUnsignedInt

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IntegerParseUnsignedInt") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$IntegerParseUnsignedInt).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Integer> testIntegerParseUnsignedInt() {
-  return ImmutableSet.of(UnsignedInts.parseUnsignedInt("1"), Integer.parseUnsignedInt("2", 10));
+  return ImmutableSet.of(Integer.parseUnsignedInt("1"), Integer.parseUnsignedInt("2"));
 }

LongParseUnsignedLong

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LongParseUnsignedLong") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LongParseUnsignedLong).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Long> testLongParseUnsignedLong() {
-  return ImmutableSet.of(UnsignedLongs.parseUnsignedLong("1"), Long.parseUnsignedLong("2", 10));
+  return ImmutableSet.of(Long.parseUnsignedLong("1"), Long.parseUnsignedLong("2"));
 }

IntegerParseUnsignedIntWithInt

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IntegerParseUnsignedIntWithInt") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$IntegerParseUnsignedIntWithInt).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 int testIntegerParseUnsignedIntWithInt() {
-  return UnsignedInts.parseUnsignedInt("1", 2);
+  return Integer.parseUnsignedInt("1", 2);
 }

LongParseUnsignedLongWithInt

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LongParseUnsignedLongWithInt") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LongParseUnsignedLongWithInt).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 long testLongParseUnsignedLongWithInt() {
-  return UnsignedLongs.parseUnsignedLong("1", 2);
+  return Long.parseUnsignedLong("1", 2);
 }

IntegerToUnsignedString

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IntegerToUnsignedString") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$IntegerToUnsignedString).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<String> testIntegerToUnsignedString() {
-  return ImmutableSet.of(UnsignedInts.toString(1), Integer.toUnsignedString(2, 10));
+  return ImmutableSet.of(Integer.toUnsignedString(1), Integer.toUnsignedString(2));
 }

LongToUnsignedString

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LongToUnsignedString") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LongToUnsignedString).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<String> testLongToUnsignedString() {
-  return ImmutableSet.of(UnsignedLongs.toString(1), Long.toUnsignedString(2, 10));
+  return ImmutableSet.of(Long.toUnsignedString(1), Long.toUnsignedString(2));
 }

IntegerToUnsignedStringWithInt

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IntegerToUnsignedStringWithInt") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$IntegerToUnsignedStringWithInt).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 String testIntegerToUnsignedStringWithInt() {
-  return UnsignedInts.toString(1, 2);
+  return Integer.toUnsignedString(1, 2);
 }

LongToUnsignedStringWithInt

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("LongToUnsignedStringWithInt") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$LongToUnsignedStringWithInt).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 String testLongToUnsignedStringWithInt() {
-  return UnsignedLongs.toString(1, 2);
+  return Long.toUnsignedString(1, 2);
 }

ArraysCompareUnsignedByte

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("ArraysCompareUnsignedByte") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$ArraysCompareUnsignedByte).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 Comparator<byte[]> testArraysCompareUnsignedByte() {
-  return UnsignedBytes.lexicographicalComparator();
+  return Arrays::compareUnsigned;
 }

ArraysCompareUnsignedInt

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("ArraysCompareUnsignedInt") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$ArraysCompareUnsignedInt).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 Comparator<int[]> testArraysCompareUnsignedInt() {
-  return UnsignedInts.lexicographicalComparator();
+  return Arrays::compareUnsigned;
 }

ArraysCompareUnsignedLong

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("ArraysCompareUnsignedLong") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!PrimitiveRules\$ArraysCompareUnsignedLong).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 Comparator<long[]> testArraysCompareUnsignedLong() {
-  return UnsignedLongs.lexicographicalComparator();
+  return Arrays::compareUnsigned;
 }

Copyright © 2017-2026 Picnic Technologies BV