TimeRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

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

Table of contents
  1. ClockInstant
  2. UtcConstant
  3. LocalDateOfInstant
  4. LocalDateTimeOfInstant
  5. LocalTimeOfInstant
  6. OffsetDateTimeOfInstant
  7. InstantAtOffset
  8. OffsetTimeOfInstant
  9. InstantAtZone
  10. UtcClock
  11. EpochInstant
  12. InstantIsBefore
  13. InstantIsAfter
  14. LocalTimeMin
  15. LocalDateAtStartOfDay
  16. ChronoLocalDateIsBefore
  17. ChronoLocalDateIsAfter
  18. ChronoLocalDateTimeIsBefore
  19. ChronoLocalDateTimeIsAfter
  20. ChronoZonedDateTimeIsBefore
  21. ChronoZonedDateTimeIsAfter
  22. OffsetDateTimeIsAfter
  23. OffsetDateTimeIsBefore
  24. ZeroDuration
  25. DurationOfDays
  26. DurationOfHours
  27. DurationOfMillis
  28. DurationOfMinutes
  29. DurationOfNanos
  30. DurationOfSeconds
  31. DurationBetweenInstants
  32. DurationBetweenOffsetDateTimes
  33. DurationIsZero
  34. ZeroPeriod
  35. LocalDatePlusDays
  36. LocalDatePlusWeeks
  37. LocalDatePlusMonths
  38. LocalDatePlusYears
  39. LocalDateMinusDays
  40. LocalDateMinusWeeks
  41. LocalDateMinusMonths
  42. LocalDateMinusYears
  43. LocalTimePlusNanos
  44. LocalTimePlusSeconds
  45. LocalTimePlusMinutes
  46. LocalTimePlusHours
  47. LocalTimeMinusNanos
  48. LocalTimeMinusSeconds
  49. LocalTimeMinusMinutes
  50. LocalTimeMinusHours
  51. OffsetTimePlusNanos
  52. OffsetTimePlusSeconds
  53. OffsetTimePlusMinutes
  54. OffsetTimePlusHours
  55. OffsetTimeMinusNanos
  56. OffsetTimeMinusSeconds
  57. OffsetTimeMinusMinutes
  58. OffsetTimeMinusHours
  59. LocalDateTimePlusNanos
  60. LocalDateTimePlusSeconds
  61. LocalDateTimePlusMinutes
  62. LocalDateTimePlusHours
  63. LocalDateTimePlusDays
  64. LocalDateTimePlusWeeks
  65. LocalDateTimePlusMonths
  66. LocalDateTimePlusYears
  67. LocalDateTimeMinusNanos
  68. LocalDateTimeMinusSeconds
  69. LocalDateTimeMinusMinutes
  70. LocalDateTimeMinusHours
  71. LocalDateTimeMinusDays
  72. LocalDateTimeMinusWeeks
  73. LocalDateTimeMinusMonths
  74. LocalDateTimeMinusYears
  75. OffsetDateTimePlusNanos
  76. OffsetDateTimePlusSeconds
  77. OffsetDateTimePlusMinutes
  78. OffsetDateTimePlusHours
  79. OffsetDateTimePlusDays
  80. OffsetDateTimePlusWeeks
  81. OffsetDateTimePlusMonths
  82. OffsetDateTimePlusYears
  83. OffsetDateTimeMinusNanos
  84. OffsetDateTimeMinusSeconds
  85. OffsetDateTimeMinusMinutes
  86. OffsetDateTimeMinusHours
  87. OffsetDateTimeMinusDays
  88. OffsetDateTimeMinusWeeks
  89. OffsetDateTimeMinusMonths
  90. OffsetDateTimeMinusYears
  91. ZonedDateTimePlusNanos
  92. ZonedDateTimePlusSeconds
  93. ZonedDateTimePlusMinutes
  94. ZonedDateTimePlusHours
  95. ZonedDateTimePlusDays
  96. ZonedDateTimePlusWeeks
  97. ZonedDateTimePlusMonths
  98. ZonedDateTimePlusYears
  99. ZonedDateTimeMinusNanos
  100. ZonedDateTimeMinusSeconds
  101. ZonedDateTimeMinusMinutes
  102. ZonedDateTimeMinusHours
  103. ZonedDateTimeMinusDays
  104. ZonedDateTimeMinusWeeks
  105. ZonedDateTimeMinusMonths
  106. ZonedDateTimeMinusYears

ClockInstant

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Instant testClockInstant() {
-    return Instant.now(Clock.systemUTC());
+    return Clock.systemUTC().instant();
   }

UtcConstant

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZoneId> testUtcConstant() {
     return ImmutableSet.of(
-        ZoneId.of("GMT"),
-        ZoneId.of("UTC"),
-        ZoneId.of("+0"),
-        ZoneId.of("-0"),
         ZoneOffset.UTC,
-        ZoneId.from(ZoneOffset.UTC));
+        ZoneOffset.UTC,
+        ZoneOffset.UTC,
+        ZoneOffset.UTC,
+        ZoneOffset.UTC,
+        ZoneOffset.UTC);
   }

LocalDateOfInstant

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDate> testLocalDateOfInstant() {
     return ImmutableSet.of(
-        Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toLocalDate(),
-        Instant.EPOCH.atOffset(ZoneOffset.UTC).toLocalDate(),
-        LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")).toLocalDate(),
-        OffsetDateTime.ofInstant(Instant.EPOCH, ZoneOffset.MIN).toLocalDate());
+        LocalDate.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")),
+        LocalDate.ofInstant(Instant.EPOCH, ZoneOffset.UTC),
+        LocalDate.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")),
+        LocalDate.ofInstant(Instant.EPOCH, ZoneOffset.MIN));
   }

LocalDateTimeOfInstant

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimeOfInstant() {
     return ImmutableSet.of(
-        Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toLocalDateTime(),
-        Instant.EPOCH.atOffset(ZoneOffset.UTC).toLocalDateTime(),
-        OffsetDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")).toLocalDateTime());
+        LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")),
+        LocalDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC),
+        LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")));
   }

LocalTimeOfInstant

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalTime> testLocalTimeOfInstant() {
     return ImmutableSet.of(
-        Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toLocalTime(),
-        Instant.EPOCH.atOffset(ZoneOffset.UTC).toLocalTime(),
-        LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")).toLocalTime(),
-        OffsetDateTime.ofInstant(Instant.EPOCH, ZoneOffset.MIN).toLocalTime(),
-        OffsetTime.ofInstant(Instant.EPOCH, ZoneOffset.MAX).toLocalTime());
+        LocalTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")),
+        LocalTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC),
+        LocalTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")),
+        LocalTime.ofInstant(Instant.EPOCH, ZoneOffset.MIN),
+        LocalTime.ofInstant(Instant.EPOCH, ZoneOffset.MAX));
   }

OffsetDateTimeOfInstant

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 OffsetDateTime testOffsetDateTimeOfInstant() {
-    return Instant.EPOCH.atZone(ZoneOffset.UTC).toOffsetDateTime();
+    return OffsetDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC);
   }

InstantAtOffset

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 OffsetDateTime testInstantAtOffset() {
-    return OffsetDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC);
+    return Instant.EPOCH.atOffset(ZoneOffset.UTC);
   }

OffsetTimeOfInstant

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetTime> testOffsetTimeOfInstant() {
     return ImmutableSet.of(
-        OffsetDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")).toOffsetTime(),
-        Instant.EPOCH.atOffset(ZoneOffset.UTC).toOffsetTime());
+        OffsetTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")),
+        OffsetTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC));
   }

InstantAtZone

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ZonedDateTime testInstantAtZone() {
-    return ZonedDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC);
+    return Instant.EPOCH.atZone(ZoneOffset.UTC);
   }

UtcClock

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Clock testUtcClock() {
-    return Clock.system(ZoneOffset.UTC);
+    return Clock.systemUTC();
   }

EpochInstant

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Instant> testEpochInstant() {
-    return ImmutableSet.of(
-        Instant.ofEpochMilli(0),
-        Instant.ofEpochMilli(0L),
-        Instant.ofEpochSecond(0),
-        Instant.ofEpochSecond(0, 0));
+    return ImmutableSet.of(Instant.EPOCH, Instant.EPOCH, Instant.EPOCH, Instant.EPOCH);
   }

InstantIsBefore

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testInstantIsBefore() {
-    return ImmutableSet.of(
-        Instant.MIN.compareTo(Instant.MAX) < 0, Instant.MIN.compareTo(Instant.MAX) >= 0);
+    return ImmutableSet.of(Instant.MIN.isBefore(Instant.MAX), !Instant.MIN.isBefore(Instant.MAX));
   }

InstantIsAfter

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testInstantIsAfter() {
-    return ImmutableSet.of(
-        Instant.MIN.compareTo(Instant.MAX) > 0, Instant.MIN.compareTo(Instant.MAX) <= 0);
+    return ImmutableSet.of(Instant.MIN.isAfter(Instant.MAX), !Instant.MIN.isAfter(Instant.MAX));
   }

LocalTimeMin

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalTime> testLocalTimeMin() {
     return ImmutableSet.of(
-        LocalTime.MIDNIGHT,
-        LocalTime.of(0, 0),
-        LocalTime.of(0, 0, 0),
-        LocalTime.of(0, 0, 0, 0),
-        LocalTime.ofNanoOfDay(0),
-        LocalTime.ofSecondOfDay(0));
+        LocalTime.MIN, LocalTime.MIN, LocalTime.MIN, LocalTime.MIN, LocalTime.MIN, LocalTime.MIN);
   }

LocalDateAtStartOfDay

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 LocalDateTime testLocalDateAtStartOfDay() {
-    return LocalDate.EPOCH.atTime(LocalTime.MIN);
+    return LocalDate.EPOCH.atStartOfDay();
   }

ChronoLocalDateIsBefore

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testChronoLocalDateIsBefore() {
     return ImmutableSet.of(
-        LocalDate.MIN.compareTo(LocalDate.MAX) < 0, LocalDate.MIN.compareTo(LocalDate.MAX) >= 0);
+        LocalDate.MIN.isBefore(LocalDate.MAX), !LocalDate.MIN.isBefore(LocalDate.MAX));
   }

ChronoLocalDateIsAfter

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testChronoLocalDateIsAfter() {
     return ImmutableSet.of(
-        LocalDate.MIN.compareTo(LocalDate.MAX) > 0, LocalDate.MIN.compareTo(LocalDate.MAX) <= 0);
+        LocalDate.MIN.isAfter(LocalDate.MAX), !LocalDate.MIN.isAfter(LocalDate.MAX));
   }

ChronoLocalDateTimeIsBefore

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testChronoLocalDateTimeIsBefore() {
     return ImmutableSet.of(
-        LocalDateTime.MIN.compareTo(LocalDateTime.MAX) < 0,
-        LocalDateTime.MIN.compareTo(LocalDateTime.MAX) >= 0);
+        LocalDateTime.MIN.isBefore(LocalDateTime.MAX),
+        !LocalDateTime.MIN.isBefore(LocalDateTime.MAX));
   }

ChronoLocalDateTimeIsAfter

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testChronoLocalDateTimeIsAfter() {
     return ImmutableSet.of(
-        LocalDateTime.MIN.compareTo(LocalDateTime.MAX) > 0,
-        LocalDateTime.MIN.compareTo(LocalDateTime.MAX) <= 0);
+        LocalDateTime.MIN.isAfter(LocalDateTime.MAX),
+        !LocalDateTime.MIN.isAfter(LocalDateTime.MAX));
   }

ChronoZonedDateTimeIsBefore

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testChronoZonedDateTimeIsBefore() {
     return ImmutableSet.of(
-        ZonedDateTime.now().compareTo(ZonedDateTime.now()) < 0,
-        ZonedDateTime.now().compareTo(ZonedDateTime.now()) >= 0);
+        ZonedDateTime.now().isBefore(ZonedDateTime.now()),
+        !ZonedDateTime.now().isBefore(ZonedDateTime.now()));
   }

ChronoZonedDateTimeIsAfter

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testChronoZonedDateTimeIsAfter() {
     return ImmutableSet.of(
-        ZonedDateTime.now().compareTo(ZonedDateTime.now()) > 0,
-        ZonedDateTime.now().compareTo(ZonedDateTime.now()) <= 0);
+        ZonedDateTime.now().isAfter(ZonedDateTime.now()),
+        !ZonedDateTime.now().isAfter(ZonedDateTime.now()));
   }

OffsetDateTimeIsAfter

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testOffsetDateTimeIsAfter() {
     return ImmutableSet.of(
-        OffsetDateTime.MIN.compareTo(OffsetDateTime.MAX) > 0,
-        OffsetDateTime.MIN.compareTo(OffsetDateTime.MAX) <= 0);
+        OffsetDateTime.MIN.isAfter(OffsetDateTime.MAX),
+        !OffsetDateTime.MIN.isAfter(OffsetDateTime.MAX));
   }

OffsetDateTimeIsBefore

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testOffsetDateTimeIsBefore() {
     return ImmutableSet.of(
-        OffsetDateTime.MIN.compareTo(OffsetDateTime.MAX) < 0,
-        OffsetDateTime.MIN.compareTo(OffsetDateTime.MAX) >= 0);
+        OffsetDateTime.MIN.isBefore(OffsetDateTime.MAX),
+        !OffsetDateTime.MIN.isBefore(OffsetDateTime.MAX));
   }

ZeroDuration

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Duration> testZeroDuration() {
     return ImmutableSet.of(
-        Duration.ofNanos(0),
-        Duration.ofMillis(0),
-        Duration.ofSeconds(0),
-        Duration.ofSeconds(0, 0),
-        Duration.ofMinutes(0),
-        Duration.ofHours(0),
-        Duration.ofDays(0),
-        Duration.of(0, ChronoUnit.MILLIS));
+        Duration.ZERO,
+        Duration.ZERO,
+        Duration.ZERO,
+        Duration.ZERO,
+        Duration.ZERO,
+        Duration.ZERO,
+        Duration.ZERO,
+        Duration.ZERO);
   }

DurationOfDays

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Duration testDurationOfDays() {
-    return Duration.of(1, ChronoUnit.DAYS);
+    return Duration.ofDays(1);
   }

DurationOfHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Duration testDurationOfHours() {
-    return Duration.of(1, ChronoUnit.HOURS);
+    return Duration.ofHours(1);
   }

DurationOfMillis

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Duration testDurationOfMillis() {
-    return Duration.of(1, ChronoUnit.MILLIS);
+    return Duration.ofMillis(1);
   }

DurationOfMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Duration testDurationOfMinutes() {
-    return Duration.of(1, ChronoUnit.MINUTES);
+    return Duration.ofMinutes(1);
   }

DurationOfNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Duration testDurationOfNanos() {
-    return Duration.of(1, ChronoUnit.NANOS);
+    return Duration.ofNanos(1);
   }

DurationOfSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Duration testDurationOfSeconds() {
-    return Duration.of(1, ChronoUnit.SECONDS);
+    return Duration.ofSeconds(1);
   }

DurationBetweenInstants

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Duration testDurationBetweenInstants() {
-    return Duration.ofMillis(Instant.MAX.toEpochMilli() - Instant.MIN.toEpochMilli());
+    return Duration.between(Instant.MIN, Instant.MAX);
   }

DurationBetweenOffsetDateTimes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 Duration testDurationBetweenOffsetDateTimes() {
-    return Duration.between(OffsetDateTime.MIN.toInstant(), OffsetDateTime.MAX.toInstant())
-        .plus(
-            Duration.ofSeconds(
-                OffsetDateTime.MAX.toEpochSecond() - OffsetDateTime.MIN.toEpochSecond()));
+    return Duration.between(OffsetDateTime.MIN, OffsetDateTime.MAX)
+        .plus(Duration.between(OffsetDateTime.MIN, OffsetDateTime.MAX));
   }

DurationIsZero

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Boolean> testDurationIsZero() {
-    return ImmutableSet.of(
-        Duration.ofDays(1).equals(Duration.ZERO), Duration.ZERO.equals(Duration.ofDays(2)));
+    return ImmutableSet.of(Duration.ofDays(1).isZero(), Duration.ofDays(2).isZero());
   }

ZeroPeriod

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<Period> testZeroPeriod() {
-    return ImmutableSet.of(
-        Period.ofDays(0),
-        Period.ofWeeks(0),
-        Period.ofMonths(0),
-        Period.ofYears(0),
-        Period.of(0, 0, 0));
+    return ImmutableSet.of(Period.ZERO, Period.ZERO, Period.ZERO, Period.ZERO, Period.ZERO);
   }

LocalDatePlusDays

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDate> testLocalDatePlusDays() {
-    return ImmutableSet.of(
-        LocalDate.EPOCH.plus(1L, ChronoUnit.DAYS), LocalDate.EPOCH.plus(Period.ofDays(1)));
+    return ImmutableSet.of(LocalDate.EPOCH.plusDays(1L), LocalDate.EPOCH.plusDays(1));
   }

LocalDatePlusWeeks

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDate> testLocalDatePlusWeeks() {
-    return ImmutableSet.of(
-        LocalDate.EPOCH.plus(1L, ChronoUnit.WEEKS), LocalDate.EPOCH.plus(Period.ofWeeks(1)));
+    return ImmutableSet.of(LocalDate.EPOCH.plusWeeks(1L), LocalDate.EPOCH.plusWeeks(1));
   }

LocalDatePlusMonths

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDate> testLocalDatePlusMonths() {
-    return ImmutableSet.of(
-        LocalDate.EPOCH.plus(1L, ChronoUnit.MONTHS), LocalDate.EPOCH.plus(Period.ofMonths(1)));
+    return ImmutableSet.of(LocalDate.EPOCH.plusMonths(1L), LocalDate.EPOCH.plusMonths(1));
   }

LocalDatePlusYears

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDate> testLocalDatePlusYears() {
-    return ImmutableSet.of(
-        LocalDate.EPOCH.plus(1L, ChronoUnit.YEARS), LocalDate.EPOCH.plus(Period.ofYears(1)));
+    return ImmutableSet.of(LocalDate.EPOCH.plusYears(1L), LocalDate.EPOCH.plusYears(1));
   }

LocalDateMinusDays

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDate> testLocalDateMinusDays() {
-    return ImmutableSet.of(
-        LocalDate.EPOCH.minus(1L, ChronoUnit.DAYS), LocalDate.EPOCH.minus(Period.ofDays(1)));
+    return ImmutableSet.of(LocalDate.EPOCH.minusDays(1L), LocalDate.EPOCH.minusDays(1));
   }

LocalDateMinusWeeks

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDate> testLocalDateMinusWeeks() {
-    return ImmutableSet.of(
-        LocalDate.EPOCH.minus(1L, ChronoUnit.WEEKS), LocalDate.EPOCH.minus(Period.ofWeeks(1)));
+    return ImmutableSet.of(LocalDate.EPOCH.minusWeeks(1L), LocalDate.EPOCH.minusWeeks(1));
   }

LocalDateMinusMonths

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDate> testLocalDateMinusMonths() {
-    return ImmutableSet.of(
-        LocalDate.EPOCH.minus(1L, ChronoUnit.MONTHS), LocalDate.EPOCH.minus(Period.ofMonths(1)));
+    return ImmutableSet.of(LocalDate.EPOCH.minusMonths(1L), LocalDate.EPOCH.minusMonths(1));
   }

LocalDateMinusYears

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDate> testLocalDateMinusYears() {
-    return ImmutableSet.of(
-        LocalDate.EPOCH.minus(1L, ChronoUnit.YEARS), LocalDate.EPOCH.minus(Period.ofYears(1)));
+    return ImmutableSet.of(LocalDate.EPOCH.minusYears(1L), LocalDate.EPOCH.minusYears(1));
   }

LocalTimePlusNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalTime> testLocalTimePlusNanos() {
-    return ImmutableSet.of(
-        LocalTime.NOON.plus(1L, ChronoUnit.NANOS), LocalTime.NOON.plus(Duration.ofNanos(1)));
+    return ImmutableSet.of(LocalTime.NOON.plusNanos(1L), LocalTime.NOON.plusNanos(1));
   }

LocalTimePlusSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalTime> testLocalTimePlusSeconds() {
-    return ImmutableSet.of(
-        LocalTime.NOON.plus(1L, ChronoUnit.SECONDS), LocalTime.NOON.plus(Duration.ofSeconds(1)));
+    return ImmutableSet.of(LocalTime.NOON.plusSeconds(1L), LocalTime.NOON.plusSeconds(1));
   }

LocalTimePlusMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalTime> testLocalTimePlusMinutes() {
-    return ImmutableSet.of(
-        LocalTime.NOON.plus(1L, ChronoUnit.MINUTES), LocalTime.NOON.plus(Duration.ofMinutes(1)));
+    return ImmutableSet.of(LocalTime.NOON.plusMinutes(1L), LocalTime.NOON.plusMinutes(1));
   }

LocalTimePlusHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalTime> testLocalTimePlusHours() {
-    return ImmutableSet.of(
-        LocalTime.NOON.plus(1L, ChronoUnit.HOURS), LocalTime.NOON.plus(Duration.ofHours(1)));
+    return ImmutableSet.of(LocalTime.NOON.plusHours(1L), LocalTime.NOON.plusHours(1));
   }

LocalTimeMinusNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalTime> testLocalTimeMinusNanos() {
-    return ImmutableSet.of(
-        LocalTime.NOON.minus(1L, ChronoUnit.NANOS), LocalTime.NOON.minus(Duration.ofNanos(1)));
+    return ImmutableSet.of(LocalTime.NOON.minusNanos(1L), LocalTime.NOON.minusNanos(1));
   }

LocalTimeMinusSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalTime> testLocalTimeMinusSeconds() {
-    return ImmutableSet.of(
-        LocalTime.NOON.minus(1L, ChronoUnit.SECONDS), LocalTime.NOON.minus(Duration.ofSeconds(1)));
+    return ImmutableSet.of(LocalTime.NOON.minusSeconds(1L), LocalTime.NOON.minusSeconds(1));
   }

LocalTimeMinusMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalTime> testLocalTimeMinusMinutes() {
-    return ImmutableSet.of(
-        LocalTime.NOON.minus(1L, ChronoUnit.MINUTES), LocalTime.NOON.minus(Duration.ofMinutes(1)));
+    return ImmutableSet.of(LocalTime.NOON.minusMinutes(1L), LocalTime.NOON.minusMinutes(1));
   }

LocalTimeMinusHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalTime> testLocalTimeMinusHours() {
-    return ImmutableSet.of(
-        LocalTime.NOON.minus(1L, ChronoUnit.HOURS), LocalTime.NOON.minus(Duration.ofHours(1)));
+    return ImmutableSet.of(LocalTime.NOON.minusHours(1L), LocalTime.NOON.minusHours(1));
   }

OffsetTimePlusNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetTime> testOffsetTimePlusNanos() {
-    return ImmutableSet.of(
-        OffsetTime.MIN.plus(1L, ChronoUnit.NANOS), OffsetTime.MIN.plus(Duration.ofNanos(1)));
+    return ImmutableSet.of(OffsetTime.MIN.plusNanos(1L), OffsetTime.MIN.plusNanos(1));
   }

OffsetTimePlusSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetTime> testOffsetTimePlusSeconds() {
-    return ImmutableSet.of(
-        OffsetTime.MIN.plus(1L, ChronoUnit.SECONDS), OffsetTime.MIN.plus(Duration.ofSeconds(1)));
+    return ImmutableSet.of(OffsetTime.MIN.plusSeconds(1L), OffsetTime.MIN.plusSeconds(1));
   }

OffsetTimePlusMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetTime> testOffsetTimePlusMinutes() {
-    return ImmutableSet.of(
-        OffsetTime.MIN.plus(1L, ChronoUnit.MINUTES), OffsetTime.MIN.plus(Duration.ofMinutes(1)));
+    return ImmutableSet.of(OffsetTime.MIN.plusMinutes(1L), OffsetTime.MIN.plusMinutes(1));
   }

OffsetTimePlusHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetTime> testOffsetTimePlusHours() {
-    return ImmutableSet.of(
-        OffsetTime.MIN.plus(1L, ChronoUnit.HOURS), OffsetTime.MIN.plus(Duration.ofHours(1)));
+    return ImmutableSet.of(OffsetTime.MIN.plusHours(1L), OffsetTime.MIN.plusHours(1));
   }

OffsetTimeMinusNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetTime> testOffsetTimeMinusNanos() {
-    return ImmutableSet.of(
-        OffsetTime.MAX.minus(1L, ChronoUnit.NANOS), OffsetTime.MAX.minus(Duration.ofNanos(1)));
+    return ImmutableSet.of(OffsetTime.MAX.minusNanos(1L), OffsetTime.MAX.minusNanos(1));
   }

OffsetTimeMinusSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetTime> testOffsetTimeMinusSeconds() {
-    return ImmutableSet.of(
-        OffsetTime.MAX.minus(1L, ChronoUnit.SECONDS), OffsetTime.MAX.minus(Duration.ofSeconds(1)));
+    return ImmutableSet.of(OffsetTime.MAX.minusSeconds(1L), OffsetTime.MAX.minusSeconds(1));
   }

OffsetTimeMinusMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetTime> testOffsetTimeMinusMinutes() {
-    return ImmutableSet.of(
-        OffsetTime.MAX.minus(1L, ChronoUnit.MINUTES), OffsetTime.MAX.minus(Duration.ofMinutes(1)));
+    return ImmutableSet.of(OffsetTime.MAX.minusMinutes(1L), OffsetTime.MAX.minusMinutes(1));
   }

OffsetTimeMinusHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetTime> testOffsetTimeMinusHours() {
-    return ImmutableSet.of(
-        OffsetTime.MAX.minus(1L, ChronoUnit.HOURS), OffsetTime.MAX.minus(Duration.ofHours(1)));
+    return ImmutableSet.of(OffsetTime.MAX.minusHours(1L), OffsetTime.MAX.minusHours(1));
   }

LocalDateTimePlusNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimePlusNanos() {
-    return ImmutableSet.of(
-        LocalDateTime.MIN.plus(1L, ChronoUnit.NANOS), LocalDateTime.MIN.plus(Duration.ofNanos(1)));
+    return ImmutableSet.of(LocalDateTime.MIN.plusNanos(1L), LocalDateTime.MIN.plusNanos(1));
   }

LocalDateTimePlusSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimePlusSeconds() {
-    return ImmutableSet.of(
-        LocalDateTime.MIN.plus(1L, ChronoUnit.SECONDS),
-        LocalDateTime.MIN.plus(Duration.ofSeconds(1)));
+    return ImmutableSet.of(LocalDateTime.MIN.plusSeconds(1L), LocalDateTime.MIN.plusSeconds(1));
   }

LocalDateTimePlusMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimePlusMinutes() {
-    return ImmutableSet.of(
-        LocalDateTime.MIN.plus(1L, ChronoUnit.MINUTES),
-        LocalDateTime.MIN.plus(Duration.ofMinutes(1)));
+    return ImmutableSet.of(LocalDateTime.MIN.plusMinutes(1L), LocalDateTime.MIN.plusMinutes(1));
   }

LocalDateTimePlusHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimePlusHours() {
-    return ImmutableSet.of(
-        LocalDateTime.MIN.plus(1L, ChronoUnit.HOURS), LocalDateTime.MIN.plus(Duration.ofHours(1)));
+    return ImmutableSet.of(LocalDateTime.MIN.plusHours(1L), LocalDateTime.MIN.plusHours(1));
   }

LocalDateTimePlusDays

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimePlusDays() {
-    return ImmutableSet.of(
-        LocalDateTime.MIN.plus(1L, ChronoUnit.DAYS), LocalDateTime.MIN.plus(Period.ofDays(1)));
+    return ImmutableSet.of(LocalDateTime.MIN.plusDays(1L), LocalDateTime.MIN.plusDays(1));
   }

LocalDateTimePlusWeeks

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimePlusWeeks() {
-    return ImmutableSet.of(
-        LocalDateTime.MIN.plus(1L, ChronoUnit.WEEKS), LocalDateTime.MIN.plus(Period.ofWeeks(1)));
+    return ImmutableSet.of(LocalDateTime.MIN.plusWeeks(1L), LocalDateTime.MIN.plusWeeks(1));
   }

LocalDateTimePlusMonths

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimePlusMonths() {
-    return ImmutableSet.of(
-        LocalDateTime.MIN.plus(1L, ChronoUnit.MONTHS), LocalDateTime.MIN.plus(Period.ofMonths(1)));
+    return ImmutableSet.of(LocalDateTime.MIN.plusMonths(1L), LocalDateTime.MIN.plusMonths(1));
   }

LocalDateTimePlusYears

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimePlusYears() {
-    return ImmutableSet.of(
-        LocalDateTime.MIN.plus(1L, ChronoUnit.YEARS), LocalDateTime.MIN.plus(Period.ofYears(1)));
+    return ImmutableSet.of(LocalDateTime.MIN.plusYears(1L), LocalDateTime.MIN.plusYears(1));
   }

LocalDateTimeMinusNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimeMinusNanos() {
-    return ImmutableSet.of(
-        LocalDateTime.MAX.minus(1L, ChronoUnit.NANOS),
-        LocalDateTime.MAX.minus(Duration.ofNanos(1)));
+    return ImmutableSet.of(LocalDateTime.MAX.minusNanos(1L), LocalDateTime.MAX.minusNanos(1));
   }

LocalDateTimeMinusSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimeMinusSeconds() {
-    return ImmutableSet.of(
-        LocalDateTime.MAX.minus(1L, ChronoUnit.SECONDS),
-        LocalDateTime.MAX.minus(Duration.ofSeconds(1)));
+    return ImmutableSet.of(LocalDateTime.MAX.minusSeconds(1L), LocalDateTime.MAX.minusSeconds(1));
   }

LocalDateTimeMinusMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimeMinusMinutes() {
-    return ImmutableSet.of(
-        LocalDateTime.MAX.minus(1L, ChronoUnit.MINUTES),
-        LocalDateTime.MAX.minus(Duration.ofMinutes(1)));
+    return ImmutableSet.of(LocalDateTime.MAX.minusMinutes(1L), LocalDateTime.MAX.minusMinutes(1));
   }

LocalDateTimeMinusHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimeMinusHours() {
-    return ImmutableSet.of(
-        LocalDateTime.MAX.minus(1L, ChronoUnit.HOURS),
-        LocalDateTime.MAX.minus(Duration.ofHours(1)));
+    return ImmutableSet.of(LocalDateTime.MAX.minusHours(1L), LocalDateTime.MAX.minusHours(1));
   }

LocalDateTimeMinusDays

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimeMinusDays() {
-    return ImmutableSet.of(
-        LocalDateTime.MAX.minus(1L, ChronoUnit.DAYS), LocalDateTime.MAX.minus(Period.ofDays(1)));
+    return ImmutableSet.of(LocalDateTime.MAX.minusDays(1L), LocalDateTime.MAX.minusDays(1));
   }

LocalDateTimeMinusWeeks

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimeMinusWeeks() {
-    return ImmutableSet.of(
-        LocalDateTime.MAX.minus(1L, ChronoUnit.WEEKS), LocalDateTime.MAX.minus(Period.ofWeeks(1)));
+    return ImmutableSet.of(LocalDateTime.MAX.minusWeeks(1L), LocalDateTime.MAX.minusWeeks(1));
   }

LocalDateTimeMinusMonths

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimeMinusMonths() {
-    return ImmutableSet.of(
-        LocalDateTime.MAX.minus(1L, ChronoUnit.MONTHS),
-        LocalDateTime.MAX.minus(Period.ofMonths(1)));
+    return ImmutableSet.of(LocalDateTime.MAX.minusMonths(1L), LocalDateTime.MAX.minusMonths(1));
   }

LocalDateTimeMinusYears

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<LocalDateTime> testLocalDateTimeMinusYears() {
-    return ImmutableSet.of(
-        LocalDateTime.MAX.minus(1L, ChronoUnit.YEARS), LocalDateTime.MAX.minus(Period.ofYears(1)));
+    return ImmutableSet.of(LocalDateTime.MAX.minusYears(1L), LocalDateTime.MAX.minusYears(1));
   }

OffsetDateTimePlusNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimePlusNanos() {
-    return ImmutableSet.of(
-        OffsetDateTime.MIN.plus(1L, ChronoUnit.NANOS),
-        OffsetDateTime.MIN.plus(Duration.ofNanos(1)));
+    return ImmutableSet.of(OffsetDateTime.MIN.plusNanos(1L), OffsetDateTime.MIN.plusNanos(1));
   }

OffsetDateTimePlusSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimePlusSeconds() {
-    return ImmutableSet.of(
-        OffsetDateTime.MIN.plus(1L, ChronoUnit.SECONDS),
-        OffsetDateTime.MIN.plus(Duration.ofSeconds(1)));
+    return ImmutableSet.of(OffsetDateTime.MIN.plusSeconds(1L), OffsetDateTime.MIN.plusSeconds(1));
   }

OffsetDateTimePlusMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimePlusMinutes() {
-    return ImmutableSet.of(
-        OffsetDateTime.MIN.plus(1L, ChronoUnit.MINUTES),
-        OffsetDateTime.MIN.plus(Duration.ofMinutes(1)));
+    return ImmutableSet.of(OffsetDateTime.MIN.plusMinutes(1L), OffsetDateTime.MIN.plusMinutes(1));
   }

OffsetDateTimePlusHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimePlusHours() {
-    return ImmutableSet.of(
-        OffsetDateTime.MIN.plus(1L, ChronoUnit.HOURS),
-        OffsetDateTime.MIN.plus(Duration.ofHours(1)));
+    return ImmutableSet.of(OffsetDateTime.MIN.plusHours(1L), OffsetDateTime.MIN.plusHours(1));
   }

OffsetDateTimePlusDays

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimePlusDays() {
-    return ImmutableSet.of(
-        OffsetDateTime.MIN.plus(1L, ChronoUnit.DAYS), OffsetDateTime.MIN.plus(Period.ofDays(1)));
+    return ImmutableSet.of(OffsetDateTime.MIN.plusDays(1L), OffsetDateTime.MIN.plusDays(1));
   }

OffsetDateTimePlusWeeks

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimePlusWeeks() {
-    return ImmutableSet.of(
-        OffsetDateTime.MIN.plus(1L, ChronoUnit.WEEKS), OffsetDateTime.MIN.plus(Period.ofWeeks(1)));
+    return ImmutableSet.of(OffsetDateTime.MIN.plusWeeks(1L), OffsetDateTime.MIN.plusWeeks(1));
   }

OffsetDateTimePlusMonths

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimePlusMonths() {
-    return ImmutableSet.of(
-        OffsetDateTime.MIN.plus(1L, ChronoUnit.MONTHS),
-        OffsetDateTime.MIN.plus(Period.ofMonths(1)));
+    return ImmutableSet.of(OffsetDateTime.MIN.plusMonths(1L), OffsetDateTime.MIN.plusMonths(1));
   }

OffsetDateTimePlusYears

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimePlusYears() {
-    return ImmutableSet.of(
-        OffsetDateTime.MIN.plus(1L, ChronoUnit.YEARS), OffsetDateTime.MIN.plus(Period.ofYears(1)));
+    return ImmutableSet.of(OffsetDateTime.MIN.plusYears(1L), OffsetDateTime.MIN.plusYears(1));
   }

OffsetDateTimeMinusNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimeMinusNanos() {
-    return ImmutableSet.of(
-        OffsetDateTime.MAX.minus(1L, ChronoUnit.NANOS),
-        OffsetDateTime.MAX.minus(Duration.ofNanos(1)));
+    return ImmutableSet.of(OffsetDateTime.MAX.minusNanos(1L), OffsetDateTime.MAX.minusNanos(1));
   }

OffsetDateTimeMinusSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimeMinusSeconds() {
-    return ImmutableSet.of(
-        OffsetDateTime.MAX.minus(1L, ChronoUnit.SECONDS),
-        OffsetDateTime.MAX.minus(Duration.ofSeconds(1)));
+    return ImmutableSet.of(OffsetDateTime.MAX.minusSeconds(1L), OffsetDateTime.MAX.minusSeconds(1));
   }

OffsetDateTimeMinusMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimeMinusMinutes() {
-    return ImmutableSet.of(
-        OffsetDateTime.MAX.minus(1L, ChronoUnit.MINUTES),
-        OffsetDateTime.MAX.minus(Duration.ofMinutes(1)));
+    return ImmutableSet.of(OffsetDateTime.MAX.minusMinutes(1L), OffsetDateTime.MAX.minusMinutes(1));
   }

OffsetDateTimeMinusHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimeMinusHours() {
-    return ImmutableSet.of(
-        OffsetDateTime.MAX.minus(1L, ChronoUnit.HOURS),
-        OffsetDateTime.MAX.minus(Duration.ofHours(1)));
+    return ImmutableSet.of(OffsetDateTime.MAX.minusHours(1L), OffsetDateTime.MAX.minusHours(1));
   }

OffsetDateTimeMinusDays

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimeMinusDays() {
-    return ImmutableSet.of(
-        OffsetDateTime.MAX.minus(1L, ChronoUnit.DAYS), OffsetDateTime.MAX.minus(Period.ofDays(1)));
+    return ImmutableSet.of(OffsetDateTime.MAX.minusDays(1L), OffsetDateTime.MAX.minusDays(1));
   }

OffsetDateTimeMinusWeeks

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimeMinusWeeks() {
-    return ImmutableSet.of(
-        OffsetDateTime.MAX.minus(1L, ChronoUnit.WEEKS),
-        OffsetDateTime.MAX.minus(Period.ofWeeks(1)));
+    return ImmutableSet.of(OffsetDateTime.MAX.minusWeeks(1L), OffsetDateTime.MAX.minusWeeks(1));
   }

OffsetDateTimeMinusMonths

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimeMinusMonths() {
-    return ImmutableSet.of(
-        OffsetDateTime.MAX.minus(1L, ChronoUnit.MONTHS),
-        OffsetDateTime.MAX.minus(Period.ofMonths(1)));
+    return ImmutableSet.of(OffsetDateTime.MAX.minusMonths(1L), OffsetDateTime.MAX.minusMonths(1));
   }

OffsetDateTimeMinusYears

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<OffsetDateTime> testOffsetDateTimeMinusYears() {
-    return ImmutableSet.of(
-        OffsetDateTime.MAX.minus(1L, ChronoUnit.YEARS),
-        OffsetDateTime.MAX.minus(Period.ofYears(1)));
+    return ImmutableSet.of(OffsetDateTime.MAX.minusYears(1L), OffsetDateTime.MAX.minusYears(1));
   }

ZonedDateTimePlusNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimePlusNanos() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.plus(1L, ChronoUnit.NANOS), ZONED_DATE_TIME.plus(Duration.ofNanos(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.plusNanos(1L), ZONED_DATE_TIME.plusNanos(1));
   }

ZonedDateTimePlusSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimePlusSeconds() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.plus(1L, ChronoUnit.SECONDS), ZONED_DATE_TIME.plus(Duration.ofSeconds(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.plusSeconds(1L), ZONED_DATE_TIME.plusSeconds(1));
   }

ZonedDateTimePlusMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimePlusMinutes() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.plus(1L, ChronoUnit.MINUTES), ZONED_DATE_TIME.plus(Duration.ofMinutes(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.plusMinutes(1L), ZONED_DATE_TIME.plusMinutes(1));
   }

ZonedDateTimePlusHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimePlusHours() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.plus(1L, ChronoUnit.HOURS), ZONED_DATE_TIME.plus(Duration.ofHours(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.plusHours(1L), ZONED_DATE_TIME.plusHours(1));
   }

ZonedDateTimePlusDays

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimePlusDays() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.plus(1L, ChronoUnit.DAYS), ZONED_DATE_TIME.plus(Period.ofDays(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.plusDays(1L), ZONED_DATE_TIME.plusDays(1));
   }

ZonedDateTimePlusWeeks

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimePlusWeeks() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.plus(1L, ChronoUnit.WEEKS), ZONED_DATE_TIME.plus(Period.ofWeeks(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.plusWeeks(1L), ZONED_DATE_TIME.plusWeeks(1));
   }

ZonedDateTimePlusMonths

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimePlusMonths() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.plus(1L, ChronoUnit.MONTHS), ZONED_DATE_TIME.plus(Period.ofMonths(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.plusMonths(1L), ZONED_DATE_TIME.plusMonths(1));
   }

ZonedDateTimePlusYears

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimePlusYears() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.plus(1L, ChronoUnit.YEARS), ZONED_DATE_TIME.plus(Period.ofYears(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.plusYears(1L), ZONED_DATE_TIME.plusYears(1));
   }

ZonedDateTimeMinusNanos

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimeMinusNanos() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.minus(1L, ChronoUnit.NANOS), ZONED_DATE_TIME.minus(Duration.ofNanos(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.minusNanos(1L), ZONED_DATE_TIME.minusNanos(1));
   }

ZonedDateTimeMinusSeconds

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimeMinusSeconds() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.minus(1L, ChronoUnit.SECONDS),
-        ZONED_DATE_TIME.minus(Duration.ofSeconds(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.minusSeconds(1L), ZONED_DATE_TIME.minusSeconds(1));
   }

ZonedDateTimeMinusMinutes

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimeMinusMinutes() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.minus(1L, ChronoUnit.MINUTES),
-        ZONED_DATE_TIME.minus(Duration.ofMinutes(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.minusMinutes(1L), ZONED_DATE_TIME.minusMinutes(1));
   }

ZonedDateTimeMinusHours

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimeMinusHours() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.minus(1L, ChronoUnit.HOURS), ZONED_DATE_TIME.minus(Duration.ofHours(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.minusHours(1L), ZONED_DATE_TIME.minusHours(1));
   }

ZonedDateTimeMinusDays

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimeMinusDays() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.minus(1L, ChronoUnit.DAYS), ZONED_DATE_TIME.minus(Period.ofDays(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.minusDays(1L), ZONED_DATE_TIME.minusDays(1));
   }

ZonedDateTimeMinusWeeks

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimeMinusWeeks() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.minus(1L, ChronoUnit.WEEKS), ZONED_DATE_TIME.minus(Period.ofWeeks(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.minusWeeks(1L), ZONED_DATE_TIME.minusWeeks(1));
   }

ZonedDateTimeMinusMonths

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimeMinusMonths() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.minus(1L, ChronoUnit.MONTHS), ZONED_DATE_TIME.minus(Period.ofMonths(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.minusMonths(1L), ZONED_DATE_TIME.minusMonths(1));
   }

ZonedDateTimeMinusYears

SUGGESTION

Simplification

Suppression

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

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

Samples

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

 ImmutableSet<ZonedDateTime> testZonedDateTimeMinusYears() {
-    return ImmutableSet.of(
-        ZONED_DATE_TIME.minus(1L, ChronoUnit.YEARS), ZONED_DATE_TIME.minus(Period.ofYears(1)));
+    return ImmutableSet.of(ZONED_DATE_TIME.minusYears(1L), ZONED_DATE_TIME.minusYears(1));
   }

Copyright © 2017-2024 Picnic Technologies BV