diff --git a/atlasdb-cassandra-multinode-tests/src/test/java/com/palantir/cassandra/multinode/TwoNodesDownGetTest.java b/atlasdb-cassandra-multinode-tests/src/test/java/com/palantir/cassandra/multinode/TwoNodesDownGetTest.java index 2064656bbc2..c8f0d80ca14 100644 --- a/atlasdb-cassandra-multinode-tests/src/test/java/com/palantir/cassandra/multinode/TwoNodesDownGetTest.java +++ b/atlasdb-cassandra-multinode-tests/src/test/java/com/palantir/cassandra/multinode/TwoNodesDownGetTest.java @@ -52,6 +52,7 @@ public void getRowsThrows() { } @Test + @SuppressWarnings("ReturnValueIgnored") // Assertion for test purposes public void getRangeThrows() { RangeRequest range = RangeRequest.builder().endRowExclusive(SECOND_ROW).build(); ClosableIterator> resultIterator = getTestKvs().getRange(TEST_TABLE, range, Long.MAX_VALUE); diff --git a/atlasdb-client/src/test/java/com/palantir/atlasdb/stream/BlockConsumingInputStreamTest.java b/atlasdb-client/src/test/java/com/palantir/atlasdb/stream/BlockConsumingInputStreamTest.java index 9a0d521f205..571581c127b 100644 --- a/atlasdb-client/src/test/java/com/palantir/atlasdb/stream/BlockConsumingInputStreamTest.java +++ b/atlasdb-client/src/test/java/com/palantir/atlasdb/stream/BlockConsumingInputStreamTest.java @@ -159,6 +159,7 @@ public void canReadAcrossBlocksWithIncompleteFinalBlock() throws IOException { } @Test + @SuppressWarnings("ReadReturnValueIgnored") // Relates to part of system not under test in this test public void readSingleByteWhenStreamExhaustedReturnsMinusOne() throws IOException { dataStream.read(new byte[DATA_SIZE]); @@ -167,6 +168,7 @@ public void readSingleByteWhenStreamExhaustedReturnsMinusOne() throws IOExceptio } @Test + @SuppressWarnings("ReadReturnValueIgnored") // Relates to part of system not under test in this test public void readWhenStreamExhaustedReturnsMinusOne() throws IOException { byte[] result = new byte[DATA_SIZE]; dataStream.read(result); @@ -279,6 +281,7 @@ public int expectedBlockLength() { } @Test + @SuppressWarnings("ReadReturnValueIgnored") // Relates to part of system not under test in this test public void canLoadMultipleBlocksAtOnceAndAlsoFewerBlocksAtEnd() throws IOException { BlockGetter spiedGetter = Mockito.spy(singleByteConsumer); BlockConsumingInputStream stream = BlockConsumingInputStream.create(spiedGetter, DATA_SIZE, 3); diff --git a/atlasdb-commons/src/main/java/com/palantir/util/crypto/Sha256Hash.java b/atlasdb-commons/src/main/java/com/palantir/util/crypto/Sha256Hash.java index 190a973733a..5b2868648d2 100644 --- a/atlasdb-commons/src/main/java/com/palantir/util/crypto/Sha256Hash.java +++ b/atlasdb-commons/src/main/java/com/palantir/util/crypto/Sha256Hash.java @@ -192,6 +192,7 @@ public MessageDigest newDigest() { return createDigest(algorithm); } + @SuppressWarnings("ReturnValueIgnored") // This method tests whether cloning is possible. private static boolean supportsClone(MessageDigest prototype) { try { prototype.clone(); diff --git a/atlasdb-commons/src/test/java/com/palantir/common/concurrent/CoalescingSupplierTest.java b/atlasdb-commons/src/test/java/com/palantir/common/concurrent/CoalescingSupplierTest.java index a38a396c5e2..5d88dfe5eda 100644 --- a/atlasdb-commons/src/test/java/com/palantir/common/concurrent/CoalescingSupplierTest.java +++ b/atlasdb-commons/src/test/java/com/palantir/common/concurrent/CoalescingSupplierTest.java @@ -105,6 +105,7 @@ public void batchesConcurrentRequests() throws InterruptedException { } @Test + @SuppressWarnings("ReturnValueIgnored") // Test relating to properties of a Supplier public void doesNotBatchSerialRequests() { supplier.get(); supplier.get(); @@ -188,6 +189,7 @@ private static void sleep(int millis) { } } + @SuppressWarnings("ReturnValueIgnored") // Test relating to properties of a Supplier private AsyncTasks getConcurrently(int count) { return AsyncTasks.runInParallel(supplier::get, count); } diff --git a/atlasdb-commons/src/test/java/com/palantir/util/CachedComposedSupplierTest.java b/atlasdb-commons/src/test/java/com/palantir/util/CachedComposedSupplierTest.java index 98a86649d59..b94f2aa0cb9 100644 --- a/atlasdb-commons/src/test/java/com/palantir/util/CachedComposedSupplierTest.java +++ b/atlasdb-commons/src/test/java/com/palantir/util/CachedComposedSupplierTest.java @@ -19,7 +19,6 @@ import static org.mockito.Mockito.when; import com.palantir.common.concurrent.PTExecutors; -import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; @@ -102,7 +101,7 @@ public void doesNotApplyFunctionIfGetIsInvokedAndSuppliedVersionConstant() { } @Test - public void appliesFunctionExactlyOncePerSuppliedValueChange() throws InterruptedException, ExecutionException { + public void appliesFunctionExactlyOncePerSuppliedValueChange() throws InterruptedException { testSupplier = new CachedComposedSupplier<>(this::countingFunction, this::increasingNumber); ExecutorService executorService = PTExecutors.newFixedThreadPool(16); for (int i = 0; i < 100_000; i++) { @@ -116,7 +115,8 @@ public void appliesFunctionExactlyOncePerSuppliedValueChange() throws Interrupte } @Test - public void recomputesIfSupplierHasNotUpdatedForTooLong() throws InterruptedException { + @SuppressWarnings("ReturnValueIgnored") // Test relating to properties of a Supplier + public void recomputesIfSupplierHasNotUpdatedForTooLong() { AtomicLong clockCounter = new AtomicLong(); testSupplier = new CachedComposedSupplier<>(this::countingFunction, this::constantNumber, 5, clockCounter::get); for (int i = 0; i < 25; i++) { diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionTest.java index 642041a942c..8ad60d7b965 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionTest.java @@ -1672,6 +1672,7 @@ public void getSortedColumnsReturnsCellsSortedByColumn() { } @Test + @SuppressWarnings("ReturnValueIgnored") // Part of an assertion! public void getSortedColumnsThrowsIfLockIsLost() { List cells = ImmutableList.of(Cell.create(ROW_FOO, COL_A)); putCellsInTable(cells, TABLE_SWEPT_THOROUGH); diff --git a/build.gradle b/build.gradle index 0bdac6aa2d7..234b71f6194 100644 --- a/build.gradle +++ b/build.gradle @@ -102,8 +102,6 @@ allprojects { 'FutureReturnValueIgnored', 'NarrowingCompoundAssignment', 'PublicConstructorForAbstractClass', - 'ReadReturnValueIgnored', - 'ReturnValueIgnored', 'Slf4jLogsafeArgs', 'StaticAssignmentInConstructor', 'StrictUnusedVariable' diff --git a/commons-db/src/main/java/com/palantir/nexus/db/sql/BasicSQLUtils.java b/commons-db/src/main/java/com/palantir/nexus/db/sql/BasicSQLUtils.java index c4f742e58e1..602129a50f2 100644 --- a/commons-db/src/main/java/com/palantir/nexus/db/sql/BasicSQLUtils.java +++ b/commons-db/src/main/java/com/palantir/nexus/db/sql/BasicSQLUtils.java @@ -318,6 +318,7 @@ public static T runUninterruptably( return result; } + @SuppressWarnings("ReadReturnValueIgnored") // Read is from a byte array input stream; will read everything public static void toStringSqlArgs(final StringBuilder sb, Object[] args) { if (args instanceof Object[][]) { // then we're doing a batch query