From df43b364873518f1233b0b4c7c16b3bd6553ae27 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Mon, 28 Aug 2017 21:07:30 -0700 Subject: [PATCH] Avoid injecting on final fields This can cause thread visibility issues. Found via error-prone. --- .../jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java | 2 +- .../org/jclouds/compute/reference/ComputeServiceConstants.java | 2 +- project/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java index 6364465f56..5cedc8081b 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java @@ -51,7 +51,7 @@ public class RetryOnRenew implements HttpRetryHandler { @VisibleForTesting @Inject(optional = true) @Named(Constants.PROPERTY_MAX_RETRIES) - static final int NUM_RETRIES = 5; + static int NUM_RETRIES = 5; private final LoadingCache authenticationResponseCache; diff --git a/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java b/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java index 7414624c45..036ebd088b 100644 --- a/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java +++ b/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java @@ -49,7 +49,7 @@ public final class ComputeServiceConstants { @Singleton public static class NamingConvention { @Inject(optional = true) - public final Supplier randomSuffix = new Supplier() { + public Supplier randomSuffix = new Supplier() { final SecureRandom random = new SecureRandom(); @Override diff --git a/project/pom.xml b/project/pom.xml index beaadefdc1..34a4bb70e3 100644 --- a/project/pom.xml +++ b/project/pom.xml @@ -808,7 +808,7 @@ -Xep:AssertFalse:ERROR -Xep:AssistedInjectAndInjectOnConstructors:ERROR -Xep:CollectionIncompatibleType:ERROR - -Xep:GuiceInjectOnFinalField:OFF + -Xep:GuiceInjectOnFinalField:ERROR -Xep:MissingFail:ERROR -Xep:NullablePrimitive:ERROR -Xep:OverridesGuiceInjectableMethod:OFF