diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/TimeRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/TimeRules.java index 02cfe30b5c..e9f07afba5 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/TimeRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/TimeRules.java @@ -66,7 +66,7 @@ ZoneOffset after() { } } - static final class InstantToLocalDate { + static final class LocalDateOfInstant { @BeforeTemplate LocalDate before(Instant instant, ZoneId zoneId) { return Refaster.anyOf( @@ -86,7 +86,7 @@ LocalDate after(Instant instant, ZoneId zoneId) { } } - static final class InstantToLocalDateTime { + static final class LocalDateTimeOfInstant { @BeforeTemplate LocalDateTime before(Instant instant, ZoneId zoneId) { return Refaster.anyOf( @@ -105,7 +105,7 @@ LocalDateTime after(Instant instant, ZoneId zoneId) { } } - static final class InstantToLocalTime { + static final class LocalTimeOfInstant { @BeforeTemplate LocalTime before(Instant instant, ZoneId zoneId) { return Refaster.anyOf( @@ -126,7 +126,7 @@ LocalTime after(Instant instant, ZoneId zoneId) { } /** Prefer {@link Instant#atOffset(ZoneOffset)} over the more verbose alternative. */ - static final class InstantToOffsetDateTime { + static final class InstantAtOffset { @BeforeTemplate OffsetDateTime before(Instant instant, ZoneOffset zoneOffset) { return OffsetDateTime.ofInstant(instant, zoneOffset); @@ -138,7 +138,7 @@ OffsetDateTime after(Instant instant, ZoneOffset zoneOffset) { } } - static final class InstantToOffsetTime { + static final class OffsetTimeOfInstant { @BeforeTemplate OffsetTime before(Instant instant, ZoneId zoneId) { return instant.atZone(zoneId).toOffsetDateTime().toOffsetTime(); @@ -156,7 +156,7 @@ OffsetTime after(Instant instant, ZoneId zoneId) { } /** Prefer {@link Instant#atZone(ZoneId)} over the more verbose alternative. */ - static final class InstantToZonedDateTime { + static final class InstantAtZone { @BeforeTemplate ZonedDateTime before(Instant instant, ZoneId zoneId) { return ZonedDateTime.ofInstant(instant, zoneId); diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/TimeRulesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/TimeRulesTestInput.java index 0afc86a315..f5caaeeab5 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/TimeRulesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/TimeRulesTestInput.java @@ -36,7 +36,7 @@ ImmutableSet testUtcConstant() { ZoneId.from(ZoneOffset.UTC)); } - ImmutableSet testInstantToLocalDate() { + ImmutableSet testLocalDateOfInstant() { return ImmutableSet.of( Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toLocalDate(), Instant.EPOCH.atZone(ZoneId.of("Europe/Paris")).toOffsetDateTime().toLocalDate(), @@ -44,14 +44,14 @@ ImmutableSet testInstantToLocalDate() { LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")).toLocalDate()); } - ImmutableSet testInstantToLocalDateTime() { + ImmutableSet testLocalDateTimeOfInstant() { return ImmutableSet.of( Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toLocalDateTime(), Instant.EPOCH.atZone(ZoneId.of("Europe/Berlin")).toOffsetDateTime().toLocalDateTime(), Instant.EPOCH.atOffset(ZoneOffset.UTC).toLocalDateTime()); } - ImmutableSet testInstantToLocalTime() { + ImmutableSet testLocalTimeOfInstant() { return ImmutableSet.of( Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toLocalTime(), Instant.EPOCH.atZone(ZoneId.of("Europe/Paris")).toOffsetDateTime().toLocalTime(), @@ -59,17 +59,17 @@ ImmutableSet testInstantToLocalTime() { LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")).toLocalTime()); } - OffsetDateTime testInstantToOffsetDateTime() { + OffsetDateTime testInstantAtOffset() { return OffsetDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC); } - ImmutableSet testInstantToOffsetTime() { + ImmutableSet testOffsetTimeOfInstant() { return ImmutableSet.of( Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toOffsetDateTime().toOffsetTime(), Instant.EPOCH.atOffset(ZoneOffset.UTC).toOffsetTime()); } - ZonedDateTime testInstantToZonedDateTime() { + ZonedDateTime testInstantAtZone() { return ZonedDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC); } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/TimeRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/TimeRulesTestOutput.java index bb4073e511..ba0e4908cf 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/TimeRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/TimeRulesTestOutput.java @@ -36,7 +36,7 @@ ImmutableSet testUtcConstant() { ZoneOffset.UTC); } - ImmutableSet testInstantToLocalDate() { + ImmutableSet testLocalDateOfInstant() { return ImmutableSet.of( LocalDate.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")), LocalDate.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Paris")), @@ -44,14 +44,14 @@ ImmutableSet testInstantToLocalDate() { LocalDate.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin"))); } - ImmutableSet testInstantToLocalDateTime() { + ImmutableSet testLocalDateTimeOfInstant() { return ImmutableSet.of( LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")), LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")), LocalDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC)); } - ImmutableSet testInstantToLocalTime() { + ImmutableSet testLocalTimeOfInstant() { return ImmutableSet.of( LocalTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")), LocalTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Paris")), @@ -59,17 +59,17 @@ ImmutableSet testInstantToLocalTime() { LocalTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin"))); } - OffsetDateTime testInstantToOffsetDateTime() { + OffsetDateTime testInstantAtOffset() { return Instant.EPOCH.atOffset(ZoneOffset.UTC); } - ImmutableSet testInstantToOffsetTime() { + ImmutableSet testOffsetTimeOfInstant() { return ImmutableSet.of( OffsetTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")), OffsetTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC)); } - ZonedDateTime testInstantToZonedDateTime() { + ZonedDateTime testInstantAtZone() { return Instant.EPOCH.atZone(ZoneOffset.UTC); }