aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml7
-rw-r--r--api/src/main/java/io/opencensus/trace/CurrentSpanUtils.java2
-rw-r--r--api/src/test/java/io/opencensus/tags/TagContextTest.java3
-rw-r--r--api/src/test/java/io/opencensus/trace/SpanBuilderTest.java2
-rw-r--r--build.gradle37
-rw-r--r--contrib/log_correlation/stackdriver/src/test/java/io/opencensus/contrib/logcorrelation/stackdriver/OpenCensusTraceLoggingEnhancerTest.java2
-rw-r--r--exporters/trace/jaeger/src/test/java/io/opencensus/exporter/trace/jaeger/JaegerExporterHandlerIntegrationTest.java3
-rw-r--r--gradle/errorprone/experimental_errors27
-rw-r--r--gradle/errorprone/experimental_suggestions32
-rw-r--r--gradle/errorprone/experimental_warnings29
-rw-r--r--gradle/errorprone/warnings89
-rw-r--r--impl_core/src/test/java/io/opencensus/implcore/trace/SpanBuilderImplTest.java2
-rw-r--r--impl_core/src/test/java/io/opencensus/implcore/trace/export/InProcessRunningSpanStoreImplTest.java2
-rw-r--r--impl_core/src/test/java/io/opencensus/implcore/trace/export/SpanExporterImplTest.java2
14 files changed, 20 insertions, 219 deletions
diff --git a/.travis.yml b/.travis.yml
index a7fb171a..0f06f5cd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -67,13 +67,6 @@ matrix:
before_install:
- git log --oneline --decorate --graph -30
- - if \[ "$TASK" == "BUILD" \]; then
- mkdir -p $HOME/.gradle ;
- cat gradle/errorprone/warnings > $HOME/.gradle/gradle.properties ;
- cat gradle/errorprone/experimental_errors >> $HOME/.gradle/gradle.properties ;
- cat gradle/errorprone/experimental_warnings >> $HOME/.gradle/gradle.properties ;
- cat gradle/errorprone/experimental_suggestions >> $HOME/.gradle/gradle.properties ;
- fi
- if \[ "$TASK" == "BUILD_EXAMPLES_BAZEL" \]; then
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list ;
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - ;
diff --git a/api/src/main/java/io/opencensus/trace/CurrentSpanUtils.java b/api/src/main/java/io/opencensus/trace/CurrentSpanUtils.java
index a249d152..21511142 100644
--- a/api/src/main/java/io/opencensus/trace/CurrentSpanUtils.java
+++ b/api/src/main/java/io/opencensus/trace/CurrentSpanUtils.java
@@ -78,7 +78,7 @@ final class CurrentSpanUtils {
private static final class ScopeInSpan implements Scope {
private final Context origContext;
private final Span span;
- private boolean endSpan;
+ private final boolean endSpan;
/**
* Constructs a new {@link ScopeInSpan}.
diff --git a/api/src/test/java/io/opencensus/tags/TagContextTest.java b/api/src/test/java/io/opencensus/tags/TagContextTest.java
index 05473255..025c7bae 100644
--- a/api/src/test/java/io/opencensus/tags/TagContextTest.java
+++ b/api/src/test/java/io/opencensus/tags/TagContextTest.java
@@ -86,9 +86,6 @@ public final class TagContextTest {
private static final class SimpleTagContext extends TagContext {
@Nullable 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));
}
diff --git a/api/src/test/java/io/opencensus/trace/SpanBuilderTest.java b/api/src/test/java/io/opencensus/trace/SpanBuilderTest.java
index a929ad97..839c8945 100644
--- a/api/src/test/java/io/opencensus/trace/SpanBuilderTest.java
+++ b/api/src/test/java/io/opencensus/trace/SpanBuilderTest.java
@@ -37,7 +37,7 @@ import org.mockito.MockitoAnnotations;
// Need to suppress warnings for MustBeClosed because Java-6 does not support try-with-resources.
@SuppressWarnings("MustBeClosedChecker")
public class SpanBuilderTest {
- private Tracer tracer = Tracing.getTracer();
+ private final Tracer tracer = Tracing.getTracer();
@Mock private SpanBuilder spanBuilder;
@Mock private Span span;
diff --git a/build.gradle b/build.gradle
index e5bd13d4..b466c3f8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -73,30 +73,17 @@ subprojects {
it.options.compilerArgs += ["-Xlint:all", "-Xlint:-try", "-Xlint:-processing"]
if (useErrorProne) {
if (JavaVersion.current().isJava8Compatible()) {
- it.options.compilerArgs += ["-XepDisableWarningsInGeneratedCode"]
- // Exclude generated protobuf from error-prone checks.
- it.options.compilerArgs += ["-XepExcludedPaths:.*/gen_gradle/.*"]
- // TODO(bdrutu): Read files directly instead of reading from properties.
- if (rootProject.hasProperty("errorProneWarnings")) {
- it.options.compilerArgs += rootProject.properties["errorProneWarnings"].split(',').collect {
- it as String
- }
- }
- if (rootProject.hasProperty("errorProneExperimentalErrors")) {
- it.options.compilerArgs += rootProject.properties["errorProneExperimentalErrors"].split(',').collect {
- it as String
- }
- }
- if (rootProject.hasProperty("errorProneExperimentalWarnings")) {
- it.options.compilerArgs += rootProject.properties["errorProneExperimentalWarnings"].split(',').collect {
- it as String
- }
- }
- if (rootProject.hasProperty("errorProneExperimentalSuggestions")) {
- it.options.compilerArgs += rootProject.properties["errorProneExperimentalSuggestions"].split(',').collect {
- it as String
- }
- }
+ it.options.compilerArgs += ["-XepAllDisabledChecksAsWarnings", "-XepDisableWarningsInGeneratedCode"]
+
+ // MutableMethodReturnType can suggest returning Guava types from
+ // API methods (https://github.com/google/error-prone/issues/982).
+ it.options.compilerArgs += ["-Xep:MutableMethodReturnType:OFF"]
+
+ // ReturnMissingNullable conflicts with Checker Framework null analysis.
+ it.options.compilerArgs += ["-Xep:ReturnMissingNullable:OFF"]
+
+ // OpenCensus doesn't currently use Var annotations.
+ it.options.compilerArgs += ["-Xep:Var:OFF"]
}
}
if (useCheckerFramework) {
@@ -159,7 +146,7 @@ subprojects {
appengineVersion = '1.9.63'
autoValueVersion = '1.4'
findBugsVersion = '3.0.1'
- errorProneVersion = '2.2.0'
+ errorProneVersion = '2.3.1'
grpcVersion = '1.12.0'
guavaVersion = '20.0'
googleAuthVersion = '0.9.1'
diff --git a/contrib/log_correlation/stackdriver/src/test/java/io/opencensus/contrib/logcorrelation/stackdriver/OpenCensusTraceLoggingEnhancerTest.java b/contrib/log_correlation/stackdriver/src/test/java/io/opencensus/contrib/logcorrelation/stackdriver/OpenCensusTraceLoggingEnhancerTest.java
index 2cafea72..0c4b6167 100644
--- a/contrib/log_correlation/stackdriver/src/test/java/io/opencensus/contrib/logcorrelation/stackdriver/OpenCensusTraceLoggingEnhancerTest.java
+++ b/contrib/log_correlation/stackdriver/src/test/java/io/opencensus/contrib/logcorrelation/stackdriver/OpenCensusTraceLoggingEnhancerTest.java
@@ -46,7 +46,7 @@ import org.junit.runners.JUnit4;
public class OpenCensusTraceLoggingEnhancerTest {
private static final String GOOGLE_CLOUD_PROJECT = "GOOGLE_CLOUD_PROJECT";
- private static Tracer tracer = Tracing.getTracer();
+ private static final Tracer tracer = Tracing.getTracer();
@Test
public void enhanceLogEntry_Sampled() {
diff --git a/exporters/trace/jaeger/src/test/java/io/opencensus/exporter/trace/jaeger/JaegerExporterHandlerIntegrationTest.java b/exporters/trace/jaeger/src/test/java/io/opencensus/exporter/trace/jaeger/JaegerExporterHandlerIntegrationTest.java
index 9d492aa5..9d6a7976 100644
--- a/exporters/trace/jaeger/src/test/java/io/opencensus/exporter/trace/jaeger/JaegerExporterHandlerIntegrationTest.java
+++ b/exporters/trace/jaeger/src/test/java/io/opencensus/exporter/trace/jaeger/JaegerExporterHandlerIntegrationTest.java
@@ -63,7 +63,8 @@ public class JaegerExporterHandlerIntegrationTest {
private static final Logger logger =
LoggerFactory.getLogger(JaegerExporterHandlerIntegrationTest.class);
- private HttpRequestFactory httpRequestFactory = new NetHttpTransport().createRequestFactory();
+ private final HttpRequestFactory httpRequestFactory =
+ new NetHttpTransport().createRequestFactory();
private static GenericContainer<?> container;
diff --git a/gradle/errorprone/experimental_errors b/gradle/errorprone/experimental_errors
deleted file mode 100644
index f791feda..00000000
--- a/gradle/errorprone/experimental_errors
+++ /dev/null
@@ -1,27 +0,0 @@
-errorProneExperimentalErrors = \
--Xep:AssistedInjectAndInjectOnSameConstructor:ERROR,\
--Xep:AutoFactoryAtInject:ERROR,\
--Xep:ClassName:ERROR,\
--Xep:ComparisonContractViolated:ERROR,\
--Xep:DepAnn:ERROR,\
--Xep:DivZero:ERROR,\
--Xep:EmptyIf:ERROR,\
--Xep:FuzzyEqualsShouldNotBeUsedInEqualsMethod:ERROR,\
--Xep:InjectInvalidTargetingOnScopingAnnotation:ERROR,\
--Xep:InjectMoreThanOneQualifier:ERROR,\
--Xep:InjectScopeAnnotationOnInterfaceOrAbstractClass:ERROR,\
--Xep:InjectScopeOrQualifierAnnotationRetention:ERROR,\
--Xep:InjectedConstructorAnnotations:ERROR,\
--Xep:InsecureCryptoUsage:ERROR,\
--Xep:IterablePathParameter:ERROR,\
--Xep:JMockTestWithoutRunWithOrRuleAnnotation:ERROR,\
--Xep:JavaxInjectOnFinalField:ERROR,\
--Xep:LockMethodChecker:ERROR,\
--Xep:LongLiteralLowerCaseSuffix:ERROR,\
--Xep:NoAllocation:ERROR,\
--Xep:NumericEquality:ERROR,\
--Xep:ParameterPackage:ERROR,\
--Xep:ProtoStringFieldReferenceEquality:ERROR,\
--Xep:RestrictTo:ERROR,\
--Xep:StaticOrDefaultInterfaceMethod:ERROR,\
--Xep:UnlockMethod:ERROR
diff --git a/gradle/errorprone/experimental_suggestions b/gradle/errorprone/experimental_suggestions
deleted file mode 100644
index d44049e9..00000000
--- a/gradle/errorprone/experimental_suggestions
+++ /dev/null
@@ -1,32 +0,0 @@
-# FieldMissingNullable is marked as WARN
-# detects errors in autovalue generated code.
-
-# ReturnMissingNullable is turned off because it
-# conflicts with Checker Framework null analysis.
-
-errorProneExperimentalSuggestions = \
--Xep:BooleanParameter:ERROR,\
--Xep:ConstantField:ERROR,\
--Xep:EmptySetMultibindingContributions:ERROR,\
--Xep:FieldMissingNullable:WARN,\
--Xep:LambdaFunctionalInterface:ERROR,\
--Xep:MethodCanBeStatic:ERROR,\
--Xep:MixedArrayDimensions:ERROR,\
--Xep:MultiVariableDeclaration:ERROR,\
--Xep:MultipleTopLevelClasses:ERROR,\
--Xep:MultipleUnaryOperatorsInMethodCall:ERROR,\
--Xep:PackageLocation:ERROR,\
--Xep:ParameterComment:ERROR,\
--Xep:ParameterNotNullable:ERROR,\
--Xep:PrivateConstructorForNoninstantiableModuleTest:ERROR,\
--Xep:PrivateConstructorForUtilityClass:ERROR,\
--Xep:RemoveUnusedImports:ERROR,\
--Xep:ReturnMissingNullable:OFF,\
--Xep:SwitchDefault:ERROR,\
--Xep:ThrowsUncheckedException:ERROR,\
--Xep:TypeParameterNaming:ERROR,\
--Xep:UngroupedOverloads:ERROR,\
--Xep:UnnecessarySetDefault:ERROR,\
--Xep:UnnecessaryStaticImport:ERROR,\
--Xep:UseBinds:ERROR,\
--Xep:WildcardImport:ERROR
diff --git a/gradle/errorprone/experimental_warnings b/gradle/errorprone/experimental_warnings
deleted file mode 100644
index 46e2371a..00000000
--- a/gradle/errorprone/experimental_warnings
+++ /dev/null
@@ -1,29 +0,0 @@
-# MutableMethodReturnType is turned off because it can suggest returning Guava
-# types from API methods (https://github.com/google/error-prone/issues/982).
-
-errorProneExperimentalWarnings = \
--Xep:AssertFalse:ERROR,\
--Xep:AssistedInjectAndInjectOnConstructors:ERROR,\
--Xep:BigDecimalLiteralDouble:ERROR,\
--Xep:BinderIdentityRestoredDangerously:ERROR,\
--Xep:BindingToUnqualifiedCommonType:ERROR,\
--Xep:ConstructorInvokesOverridable:ERROR,\
--Xep:ConstructorLeaksThis:ERROR,\
--Xep:EmptyTopLevelDeclaration:ERROR,\
--Xep:ExpectedExceptionChecker:ERROR,\
--Xep:FunctionalInterfaceClash:ERROR,\
--Xep:HardCodedSdCardPath:ERROR,\
--Xep:InconsistentOverloads:ERROR,\
--Xep:MissingDefault:ERROR,\
--Xep:MutableMethodReturnType:OFF,\
--Xep:NonCanonicalStaticMemberImport:ERROR,\
--Xep:PrimitiveArrayPassedToVarargsMethod:ERROR,\
--Xep:ProvidesFix:ERROR,\
--Xep:QualifierWithTypeUse:ERROR,\
--Xep:RedundantThrows:ERROR,\
--Xep:StaticQualifiedUsingExpression:ERROR,\
--Xep:StringEquality:ERROR,\
--Xep:StringSplit:ERROR,\
--Xep:TestExceptionChecker:ERROR,\
--Xep:UnnecessaryDefaultInEnumSwitch:ERROR,\
--Xep:Var:OFF
diff --git a/gradle/errorprone/warnings b/gradle/errorprone/warnings
deleted file mode 100644
index 3a8bb2f5..00000000
--- a/gradle/errorprone/warnings
+++ /dev/null
@@ -1,89 +0,0 @@
-# NarrowingCompoundAssignment is marked as WARN
-# detects errors in autovalue generated code.
-
-errorProneWarnings = \
--Xep:AmbiguousMethodReference:ERROR,\
--Xep:ArgumentSelectionDefectChecker:ERROR,\
--Xep:AssertEqualsArgumentOrderChecker:ERROR,\
--Xep:AssertionFailureIgnored:ERROR,\
--Xep:BadAnnotationImplementation:ERROR,\
--Xep:BadComparable:ERROR,\
--Xep:BoxedPrimitiveConstructor:ERROR,\
--Xep:CannotMockFinalClass:ERROR,\
--Xep:CanonicalDuration:ERROR,\
--Xep:CatchFail:ERROR,\
--Xep:ClassCanBeStatic:ERROR,\
--Xep:ClassNewInstance:ERROR,\
--Xep:CollectionToArraySafeParameter:ERROR,\
--Xep:CollectorShouldNotUseState:ERROR,\
--Xep:ComparableAndComparator:ERROR,\
--Xep:DateFormatConstant:ERROR,\
--Xep:DefaultCharset:ERROR,\
--Xep:DoubleCheckedLocking:ERROR,\
--Xep:EqualsHashCode:ERROR,\
--Xep:EqualsIncompatibleType:ERROR,\
--Xep:FallThrough:ERROR,\
--Xep:Finally:ERROR,\
--Xep:FloatCast:ERROR,\
--Xep:FloatingPointLiteralPrecision:ERROR,\
--Xep:FragmentInjection:ERROR,\
--Xep:FragmentNotInstantiable:ERROR,\
--Xep:FutureReturnValueIgnored:ERROR,\
--Xep:GetClassOnEnum:ERROR,\
--Xep:HidingField:ERROR,\
--Xep:ImmutableAnnotationChecker:ERROR,\
--Xep:ImmutableEnumChecker:ERROR,\
--Xep:IncompatibleModifiers:ERROR,\
--Xep:IncrementInForLoopAndHeader:ERROR,\
--Xep:InjectOnConstructorOfAbstractClass:ERROR,\
--Xep:InputStreamSlowMultibyteRead:ERROR,\
--Xep:InstanceOfAndCastMatchWrongType:ERROR,\
--Xep:IntLongMath:ERROR,\
--Xep:IterableAndIterator:ERROR,\
--Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR,\
--Xep:JUnit4ClassUsedInJUnit3:ERROR,\
--Xep:JUnitAmbiguousTestClass:ERROR,\
--Xep:JavaLangClash:ERROR,\
--Xep:JdkObsolete:ERROR,\
--Xep:LogicalAssignment:ERROR,\
--Xep:MissingCasesInEnumSwitch:ERROR,\
--Xep:MissingFail:ERROR,\
--Xep:MissingOverride:ERROR,\
--Xep:ModifyCollectionInEnhancedForLoop:ERROR,\
--Xep:MultipleParallelOrSequentialCalls:ERROR,\
--Xep:MutableConstantField:ERROR,\
--Xep:NarrowingCompoundAssignment:WARN,\
--Xep:NestedInstanceOfConditions:ERROR,\
--Xep:NonAtomicVolatileUpdate:ERROR,\
--Xep:NonOverridingEquals:ERROR,\
--Xep:NullableConstructor:ERROR,\
--Xep:NullablePrimitive:ERROR,\
--Xep:NullableVoid:ERROR,\
--Xep:OperatorPrecedence:ERROR,\
--Xep:OptionalNotPresent:ERROR,\
--Xep:OverrideThrowableToString:ERROR,\
--Xep:Overrides:ERROR,\
--Xep:OverridesGuiceInjectableMethod:ERROR,\
--Xep:ParameterName:ERROR,\
--Xep:PreconditionsInvalidPlaceholder:ERROR,\
--Xep:ProtoFieldPreconditionsCheckNotNull:ERROR,\
--Xep:QualifierOrScopeOnInjectMethod:ERROR,\
--Xep:ReachabilityFenceUsage:ERROR,\
--Xep:ReferenceEquality:ERROR,\
--Xep:RequiredModifiers:ERROR,\
--Xep:ShortCircuitBoolean:ERROR,\
--Xep:StaticGuardedByInstance:ERROR,\
--Xep:StringSplitter:ERROR,\
--Xep:SynchronizeOnNonFinalField:ERROR,\
--Xep:ThreadJoinLoop:ERROR,\
--Xep:ThreadLocalUsage:ERROR,\
--Xep:ThreeLetterTimeZoneID:ERROR,\
--Xep:TruthConstantAsserts:ERROR,\
--Xep:TypeParameterShadowing:ERROR,\
--Xep:TypeParameterUnusedInFormals:ERROR,\
--Xep:URLEqualsHashCode:ERROR,\
--Xep:UnsafeFinalization:ERROR,\
--Xep:UnsynchronizedOverridesSynchronized:ERROR,\
--Xep:UseCorrectAssertInTests:ERROR,\
--Xep:WaitNotInLoop:ERROR,\
--Xep:WakelockReleasedDangerously:ERROR
diff --git a/impl_core/src/test/java/io/opencensus/implcore/trace/SpanBuilderImplTest.java b/impl_core/src/test/java/io/opencensus/implcore/trace/SpanBuilderImplTest.java
index a7cdb553..1804130c 100644
--- a/impl_core/src/test/java/io/opencensus/implcore/trace/SpanBuilderImplTest.java
+++ b/impl_core/src/test/java/io/opencensus/implcore/trace/SpanBuilderImplTest.java
@@ -47,7 +47,7 @@ import org.mockito.MockitoAnnotations;
public class SpanBuilderImplTest {
private static final String SPAN_NAME = "MySpanName";
private SpanBuilderImpl.Options spanBuilderOptions;
- private TraceParams alwaysSampleTraceParams =
+ private final TraceParams alwaysSampleTraceParams =
TraceParams.DEFAULT.toBuilder().setSampler(Samplers.alwaysSample()).build();
private final TestClock testClock = TestClock.create();
private final RandomHandler randomHandler = new FakeRandomHandler();
diff --git a/impl_core/src/test/java/io/opencensus/implcore/trace/export/InProcessRunningSpanStoreImplTest.java b/impl_core/src/test/java/io/opencensus/implcore/trace/export/InProcessRunningSpanStoreImplTest.java
index e81df48e..85db0868 100644
--- a/impl_core/src/test/java/io/opencensus/implcore/trace/export/InProcessRunningSpanStoreImplTest.java
+++ b/impl_core/src/test/java/io/opencensus/implcore/trace/export/InProcessRunningSpanStoreImplTest.java
@@ -51,7 +51,7 @@ public class InProcessRunningSpanStoreImplTest {
private final StartEndHandler startEndHandler =
new StartEndHandlerImpl(
sampledSpansServiceExporter, activeSpansExporter, null, new SimpleEventQueue());
- private EnumSet<Options> recordSpanOptions = EnumSet.of(Options.RECORD_EVENTS);
+ private final EnumSet<Options> recordSpanOptions = EnumSet.of(Options.RECORD_EVENTS);
private SpanImpl createSpan(String spanName) {
final SpanContext spanContext =
diff --git a/impl_core/src/test/java/io/opencensus/implcore/trace/export/SpanExporterImplTest.java b/impl_core/src/test/java/io/opencensus/implcore/trace/export/SpanExporterImplTest.java
index 9b471352..d99776d1 100644
--- a/impl_core/src/test/java/io/opencensus/implcore/trace/export/SpanExporterImplTest.java
+++ b/impl_core/src/test/java/io/opencensus/implcore/trace/export/SpanExporterImplTest.java
@@ -60,7 +60,7 @@ public class SpanExporterImplTest {
SpanContext.create(
TraceId.generateRandomId(random), SpanId.generateRandomId(random), TraceOptions.DEFAULT);
private final RunningSpanStoreImpl runningSpanStore = new InProcessRunningSpanStoreImpl();
- private EnumSet<Options> recordSpanOptions = EnumSet.of(Options.RECORD_EVENTS);
+ private final EnumSet<Options> recordSpanOptions = EnumSet.of(Options.RECORD_EVENTS);
private final TestHandler serviceHandler = new TestHandler();
@Mock private Handler mockServiceHandler;