Skip to content

Commit

Permalink
Support toSeconds in DurationToLongTimeUnit
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 676555168
  • Loading branch information
java-team-github-bot authored and Error Prone Team committed Sep 19, 2024
1 parent fa3c23d commit 2c04ada
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public final class DurationToLongTimeUnit extends BugChecker
// JavaTime
.put(instanceMethod().onExactClass(JAVA_DURATION).named("toNanos"), NANOSECONDS)
.put(instanceMethod().onExactClass(JAVA_DURATION).named("toMillis"), MILLISECONDS)
.put(instanceMethod().onExactClass(JAVA_DURATION).named("toSeconds"), SECONDS)
.put(instanceMethod().onExactClass(JAVA_DURATION).named("getSeconds"), SECONDS)
.put(instanceMethod().onExactClass(JAVA_DURATION).named("toMinutes"), MINUTES)
.put(instanceMethod().onExactClass(JAVA_DURATION).named("toHours"), HOURS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void javaTime(Future<String> f, java.time.Duration d) throws Exception {
f.get(42L, TimeUnit.SECONDS);
f.get(d.toNanos(), TimeUnit.NANOSECONDS);
f.get(d.toMillis(), TimeUnit.MILLISECONDS);
f.get(d.toSeconds(), TimeUnit.SECONDS);
f.get(d.getSeconds(), TimeUnit.SECONDS);
f.get(d.toMinutes(), TimeUnit.MINUTES);
f.get(d.toHours(), TimeUnit.HOURS);
Expand Down Expand Up @@ -104,6 +105,7 @@ void javaTime(Future<String> f, java.time.Duration d) throws Exception {
f.get(42L, SECONDS);
f.get(d.toNanos(), NANOSECONDS);
f.get(d.toMillis(), MILLISECONDS);
f.get(d.toSeconds(), SECONDS);
f.get(d.getSeconds(), SECONDS);
f.get(d.toMinutes(), MINUTES);
f.get(d.toHours(), HOURS);
Expand Down Expand Up @@ -161,6 +163,8 @@ void javaTime(Future<String> f, java.time.Duration d) throws Exception {
f.get(d.toNanos(), TimeUnit.MILLISECONDS);
// BUG: Diagnostic contains: f.get(d.toMillis(), TimeUnit.MILLISECONDS)
f.get(d.toMillis(), TimeUnit.NANOSECONDS);
// BUG: Diagnostic contains: f.get(d.toSeconds(), TimeUnit.SECONDS)
f.get(d.toSeconds(), TimeUnit.MINUTES);
// BUG: Diagnostic contains: f.get(d.getSeconds(), TimeUnit.SECONDS)
f.get(d.getSeconds(), TimeUnit.MINUTES);
// BUG: Diagnostic contains: f.get(d.toMinutes(), TimeUnit.MINUTES)
Expand Down Expand Up @@ -233,6 +237,8 @@ void javaTime(Future<String> f, java.time.Duration d) throws Exception {
f.get(d.toNanos(), MILLISECONDS);
// BUG: Diagnostic contains: f.get(d.toMillis(), TimeUnit.MILLISECONDS)
f.get(d.toMillis(), NANOSECONDS);
// BUG: Diagnostic contains: f.get(d.toSeconds(), TimeUnit.SECONDS)
f.get(d.toSeconds(), MINUTES);
// BUG: Diagnostic contains: f.get(d.getSeconds(), TimeUnit.SECONDS)
f.get(d.getSeconds(), MINUTES);
// BUG: Diagnostic contains: f.get(d.toMinutes(), TimeUnit.MINUTES)
Expand Down

0 comments on commit 2c04ada

Please sign in to comment.