Skip to content

Commit

Permalink
Fix refaster rule (#177)
Browse files Browse the repository at this point in the history
Fix refaster rule for hasArgs -> containsArgs migration.

A different syntax needed to be used when dealing with varargs, see related issue:
google/error-prone#568
  • Loading branch information
dansanduleac authored and bulldozer-bot[bot] committed Jul 17, 2019
1 parent 63c784c commit 1c2117a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-177.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Fix refaster rule for `hasArgs` -> `containsArgs` migration.
links:
- https://github.com/palantir/safe-logging/pull/177
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.errorprone.refaster.annotation.AfterTemplate;
import com.google.errorprone.refaster.annotation.BeforeTemplate;
import com.google.errorprone.refaster.annotation.Repeated;
import com.palantir.logsafe.Arg;
import com.palantir.logsafe.SafeLoggable;
import com.palantir.logsafe.testing.LoggableExceptionAssert;
Expand All @@ -26,12 +27,12 @@ public final class DeprecatedLoggableExceptionAssertArgs<T extends Throwable & S

@BeforeTemplate
@SuppressWarnings("deprecation")
LoggableExceptionAssert<T> hasArgs(LoggableExceptionAssert<T> loggableExceptionAssert, Arg<?>... args) {
LoggableExceptionAssert<T> hasArgs(LoggableExceptionAssert<T> loggableExceptionAssert, @Repeated Arg<?> args) {
return loggableExceptionAssert.hasArgs(args);
}

@AfterTemplate
LoggableExceptionAssert<T> containsArgs(LoggableExceptionAssert<T> loggableExceptionAssert, Arg<?>... args) {
LoggableExceptionAssert<T> containsArgs(LoggableExceptionAssert<T> loggableExceptionAssert, @Repeated Arg<?> args) {
return loggableExceptionAssert.containsArgs(args);
}
}

0 comments on commit 1c2117a

Please sign in to comment.