diff options
| author | sebright <sebright@google.com> | 2017-11-14 09:26:10 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-14 09:26:10 -0800 |
| commit | 9b50fa085c73ada5452e286cb030a33252d96cb4 (patch) | |
| tree | 680682d1d2bddf24b06b5d26d192ae70429029f7 /api/src/test | |
| parent | e898e0388d04b91083ff8b63172fa075ec3ce13a (diff) | |
| parent | e086f07b5708ad1ffddbc186cf7965a21e852ba7 (diff) | |
| download | platform_external_opencensus-java-9b50fa085c73ada5452e286cb030a33252d96cb4.tar.gz platform_external_opencensus-java-9b50fa085c73ada5452e286cb030a33252d96cb4.tar.bz2 platform_external_opencensus-java-9b50fa085c73ada5452e286cb030a33252d96cb4.zip | |
Merge pull request #804 from sebright/update-error-prone-warnings-for-2.1.2
Update lists of enabled Error Prone warnings with the latest bug patterns.
Diffstat (limited to 'api/src/test')
| -rw-r--r-- | api/src/test/java/io/opencensus/tags/TagContextTest.java | 5 | ||||
| -rw-r--r-- | api/src/test/java/io/opencensus/trace/AttributeValueTest.java | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/api/src/test/java/io/opencensus/tags/TagContextTest.java b/api/src/test/java/io/opencensus/tags/TagContextTest.java index 813e1a76..b5c44b15 100644 --- a/api/src/test/java/io/opencensus/tags/TagContextTest.java +++ b/api/src/test/java/io/opencensus/tags/TagContextTest.java @@ -23,6 +23,7 @@ import com.google.common.testing.EqualsTester; import java.util.Collections; import java.util.Iterator; import java.util.List; +import javax.annotation.Nullable; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -85,6 +86,9 @@ public final class TagContextTest { private static final class SimpleTagContext extends TagContext { private final List<Tag> tags; + // This Error Prone warning doesn't seem correct, because the constructor is just calling + // another constructor. + @SuppressWarnings("ConstructorLeaksThis") SimpleTagContext(Tag... tags) { this(Lists.newArrayList(tags)); } @@ -94,6 +98,7 @@ public final class TagContextTest { } @Override + @Nullable protected Iterator<Tag> getIterator() { return tags == null ? null : tags.iterator(); } diff --git a/api/src/test/java/io/opencensus/trace/AttributeValueTest.java b/api/src/test/java/io/opencensus/trace/AttributeValueTest.java index b7e0afbd..e505c59b 100644 --- a/api/src/test/java/io/opencensus/trace/AttributeValueTest.java +++ b/api/src/test/java/io/opencensus/trace/AttributeValueTest.java @@ -22,6 +22,7 @@ import static org.junit.Assert.fail; import com.google.common.testing.EqualsTester; import io.opencensus.common.Function; import io.opencensus.common.Functions; +import javax.annotation.Nullable; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -35,6 +36,7 @@ public class AttributeValueTest { attribute.match( new Function<String, Object>() { @Override + @Nullable public Object apply(String stringValue) { assertThat(stringValue).isEqualTo("MyStringAttributeValue"); return null; @@ -42,6 +44,7 @@ public class AttributeValueTest { }, new Function<Boolean, Object>() { @Override + @Nullable public Object apply(Boolean booleanValue) { fail("Expected a String"); return null; @@ -49,6 +52,7 @@ public class AttributeValueTest { }, new Function<Long, Object>() { @Override + @Nullable public Object apply(Long longValue) { fail("Expected a String"); return null; @@ -63,6 +67,7 @@ public class AttributeValueTest { attribute.match( new Function<String, Object>() { @Override + @Nullable public Object apply(String stringValue) { fail("Expected a Boolean"); return null; @@ -70,6 +75,7 @@ public class AttributeValueTest { }, new Function<Boolean, Object>() { @Override + @Nullable public Object apply(Boolean booleanValue) { assertThat(booleanValue).isTrue(); return null; @@ -77,6 +83,7 @@ public class AttributeValueTest { }, new Function<Long, Object>() { @Override + @Nullable public Object apply(Long longValue) { fail("Expected a Boolean"); return null; @@ -91,6 +98,7 @@ public class AttributeValueTest { attribute.match( new Function<String, Object>() { @Override + @Nullable public Object apply(String stringValue) { fail("Expected a Long"); return null; @@ -98,6 +106,7 @@ public class AttributeValueTest { }, new Function<Boolean, Object>() { @Override + @Nullable public Object apply(Boolean booleanValue) { fail("Expected a Long"); return null; @@ -105,6 +114,7 @@ public class AttributeValueTest { }, new Function<Long, Object>() { @Override + @Nullable public Object apply(Long longValue) { assertThat(longValue).isEqualTo(123456L); return null; |
