Skip to content

Commit

Permalink
Annotate SafeArg/UnsafeArg name parameter with @CompileTimeConstant (#…
Browse files Browse the repository at this point in the history
…105)

This adds a dependency on error_prone_annotations to safe-logging,
previously only required by safe-logging preconditions.
  • Loading branch information
Carter Kozak authored and bulldozer-bot[bot] committed Jan 17, 2019
1 parent 21e0713 commit 0ba6bae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion preconditions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply from: "${rootDir}/gradle/publish-jar.gradle"

dependencies {
api project(':safe-logging')
api 'com.google.errorprone:error_prone_annotations:2.1.3'
compileOnly 'com.google.code.findbugs:jsr305'

testImplementation 'junit:junit'
Expand Down
4 changes: 4 additions & 0 deletions safe-logging/build.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
apply from: "${rootDir}/gradle/publish-jar.gradle"

dependencies {
api 'com.google.errorprone:error_prone_annotations'
}
3 changes: 2 additions & 1 deletion safe-logging/src/main/java/com/palantir/logsafe/SafeArg.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.palantir.logsafe;

import com.google.errorprone.annotations.CompileTimeConstant;
import javax.annotation.Nullable;

/** A wrapper around an argument known to be safe for logging. */
Expand All @@ -25,7 +26,7 @@ private SafeArg(String name, @Nullable T value) {
super(name, value);
}

public static <T> SafeArg<T> of(String name, @Nullable T value) {
public static <T> SafeArg<T> of(@CompileTimeConstant String name, @Nullable T value) {
return new SafeArg<>(name, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.palantir.logsafe;

import com.google.errorprone.annotations.CompileTimeConstant;
import javax.annotation.Nullable;

/** A wrapper around an argument that is not safe for logging. */
Expand All @@ -25,7 +26,7 @@ private UnsafeArg(String name, @Nullable T value) {
super(name, value);
}

public static <T> UnsafeArg<T> of(String name, @Nullable T value) {
public static <T> UnsafeArg<T> of(@CompileTimeConstant String name, @Nullable T value) {
return new UnsafeArg<>(name, value);
}

Expand Down

0 comments on commit 0ba6bae

Please sign in to comment.