Skip to content

Commit

Permalink
error prone checks: final (Consensys#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarla authored Jul 27, 2018
1 parent bbe6af9 commit febc79e
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 19 deletions.
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
id "com.diffplug.gradle.spotless" version "3.10.0"
id "com.github.hierynomus.license" version "0.14.0"
id "com.jfrog.bintray" version "1.8.0"
id 'net.ltgt.errorprone' version '0.0.13'
id 'net.ltgt.errorprone' version '0.0.14'
}

apply plugin: 'java-library'
Expand Down Expand Up @@ -93,7 +93,11 @@ tasks.withType(JavaCompile) {
'-Xlint:finally',
'-Xlint:static',
'-Werror',
'-Xep:FutureReturnValueIgnored:OFF'
'-Xep:FutureReturnValueIgnored:OFF',
'-Xep:InsecureCryptoUsage:WARN',
'-Xep:FieldCanBeFinal:WARN',
'-Xep:WildcardImport:WARN',
'-Xep:TestExceptionChecker:WARN'
]
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/consensys/orion/cmd/Orion.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public Orion(Vertx vertx) {
this.vertx = vertx;
}

private AtomicBoolean isRunning = new AtomicBoolean(false);
private final AtomicBoolean isRunning = new AtomicBoolean(false);

public void stop() {
if (!isRunning.compareAndSet(true, false)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public class SodiumEnclave implements Enclave {
private static final Nonce ZERO_NONCE = Nonce.fromBytes(new byte[Nonce.length()]);

private KeyStore keyStore;
private final KeyStore keyStore;

private final Box.PublicKey[] alwaysSendTo;
private final Box.PublicKey[] nodeKeys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public Map<String, Discoverer> discoverers() {
* Its job is to call /partyInfo periodically on a specified URL and merge results if needed in NetworkDiscovery state
*/
class Discoverer implements Handler<Long> {
private URL nodeUrl;
private final URL nodeUrl;
long currentRefreshDelay;
Instant lastUpdate = Instant.MIN;
long attempts = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/net/consensys/orion/cmd/OrionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

@ExtendWith(TempDirectoryExtension.class)
class OrionTest {
private Orion orion = new Orion();
private final Orion orion = new Orion();

@Test
void generateUnlockedKeysWithArgumentProvided(@TempDirectory Path tempDir) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
@ExtendWith(TempDirectoryExtension.class)
class CAOrTofuSecurityTest {

private static Vertx vertx = vertx();
private final static Vertx vertx = vertx();
private static Path knownClientsFile;
private static String exampleComFingerprint;
private static HttpClient nonCAhttpClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@ExtendWith(TempDirectoryExtension.class)
class CertificateAuthoritySecurityTest {

private static Vertx vertx = vertx();
private final static Vertx vertx = vertx();
private static HttpClient httpClient;
private static int nodePort;
private static Orion orion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
@ExtendWith(TempDirectoryExtension.class)
class InsecureSecurityTest {

private static Vertx vertx = vertx();
private final static Vertx vertx = vertx();
private static Path knownClientsFile;
private static String exampleComFingerprint;
private static HttpClient httpClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
@ExtendWith(TempDirectoryExtension.class)
class TofuSecurityTest {

private Vertx vertx = vertx();
private final Vertx vertx = vertx();
private Path knownClientsFile;
private String exampleComFingerprint;
private HttpClient httpClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
@ExtendWith(TempDirectoryExtension.class)
class WhiteListSecurityTest {

private static Vertx vertx = vertx();
private final static Vertx vertx = vertx();
private static HttpClient httpClient;
private static HttpClient httpClientWithUnregisteredCert;
private static HttpClient httpClientWithImproperCertificate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
@ExtendWith(TempDirectoryExtension.class)
class CaOrTofuNodeClientTest {

private static Vertx vertx = Vertx.vertx();
private final static Vertx vertx = Vertx.vertx();
private static HttpServer caValidServer;
private static HttpServer tofuServer;
private static String fooFingerprint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
@ExtendWith(TempDirectoryExtension.class)
class CertificateAuthorityNodeClientTest {

private static Vertx vertx = Vertx.vertx();
private final static Vertx vertx = Vertx.vertx();
private static HttpServer caValidServer;
private static HttpServer unknownServer;
private static HttpClient client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
@ExtendWith(TempDirectoryExtension.class)
class InsecureNodeClientTest {

private static Vertx vertx = Vertx.vertx();
private final static Vertx vertx = Vertx.vertx();
private static HttpServer insecureServer;
private static HttpServer foobarComServer;
private static Path knownServersFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
@ExtendWith(TempDirectoryExtension.class)
class TofuNodeClientTest {

private static Vertx vertx = Vertx.vertx();
private final static Vertx vertx = Vertx.vertx();
private static Config config;
private static Path knownServersFile;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
@ExtendWith(TempDirectoryExtension.class)
class WhitelistNodeClientTest {

private static Vertx vertx = Vertx.vertx();
private final static Vertx vertx = Vertx.vertx();
private static HttpServer whitelistedServer;
private static HttpServer unknownServer;
private static HttpClient client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ class EncryptedPayloadStorageTest {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
}

private Enclave enclave = new SodiumEnclaveStub();
private StorageKeyBuilder keyBuilder = new Sha512_256StorageKeyBuilder();
private Storage<EncryptedPayload> payloadStorage = new EncryptedPayloadStorage(new MapKeyValueStore(), keyBuilder);
private final Enclave enclave = new SodiumEnclaveStub();
private final StorageKeyBuilder keyBuilder = new Sha512_256StorageKeyBuilder();
private final Storage<EncryptedPayload> payloadStorage =
new EncryptedPayloadStorage(new MapKeyValueStore(), keyBuilder);

@Test
void storeAndRetrieve() throws Exception {
Expand Down

0 comments on commit febc79e

Please sign in to comment.