Avoid injecting on final fields

This can cause thread visibility issues.  Found via error-prone.
This commit is contained in:
Andrew Gaul 2017-08-28 21:07:30 -07:00
parent e08acc6ed6
commit df43b36487
3 changed files with 3 additions and 3 deletions

View File

@ -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<Credentials, Access> authenticationResponseCache;

View File

@ -49,7 +49,7 @@ public final class ComputeServiceConstants {
@Singleton
public static class NamingConvention {
@Inject(optional = true)
public final Supplier<String> randomSuffix = new Supplier<String>() {
public Supplier<String> randomSuffix = new Supplier<String>() {
final SecureRandom random = new SecureRandom();
@Override

View File

@ -808,7 +808,7 @@
<compilerArg>-Xep:AssertFalse:ERROR</compilerArg>
<compilerArg>-Xep:AssistedInjectAndInjectOnConstructors:ERROR</compilerArg>
<compilerArg>-Xep:CollectionIncompatibleType:ERROR</compilerArg>
<compilerArg>-Xep:GuiceInjectOnFinalField:OFF</compilerArg> <!-- noisy -->
<compilerArg>-Xep:GuiceInjectOnFinalField:ERROR</compilerArg>
<compilerArg>-Xep:MissingFail:ERROR</compilerArg>
<compilerArg>-Xep:NullablePrimitive:ERROR</compilerArg>
<compilerArg>-Xep:OverridesGuiceInjectableMethod:OFF</compilerArg> <!-- internal error with 2.0.5 -->