]> source.dussan.org Git - jgit.git/commitdiff
ErrorProne: Increase severity of FutureReturnValueIgnored to ERROR 77/143577/4
authorDavid Pursehouse <david.pursehouse@gmail.com>
Sat, 8 Jun 2019 06:47:42 +0000 (15:47 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 11 Jun 2019 01:51:30 +0000 (10:51 +0900)
The only remaining code where the return value is ignored is in tests.
Update them to store the value and perform a basic assertion.

Change-Id: I29ef5bd5dd0648aac3490f9e47ecc74544109652
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/UploadTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java
tools/BUILD

index c6f95355646a8b24febd2495273f7c930feb2fd2..2334ec37af81c5ecf49312faab6e1fb8a6f71e79 100644 (file)
@@ -44,6 +44,7 @@ package org.eclipse.jgit.lfs.server.fs;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -56,6 +57,7 @@ import java.util.List;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
 import org.eclipse.jgit.lfs.lib.AnyLongObjectId;
@@ -122,11 +124,12 @@ public class UploadTest extends LfsServerTest {
                ExecutorService e = Executors.newFixedThreadPool(count);
                try {
                        for (Path p : paths) {
-                               e.submit(() -> {
+                               Future<Object> result = e.submit(() -> {
                                        barrier.await();
                                        putContent(p);
                                        return null;
                                });
+                               assertNotNull(result);
                        }
                } finally {
                        e.shutdown();
index 1fa5aa09ad8eb70b790b6a81ed01f941201e3587..54708da03c02c4e8fe1b36607f95f5978384bf00 100644 (file)
@@ -176,12 +176,13 @@ public class GcPackRefsTest extends GcTestCase {
                                return update.update();
                        });
 
-                       pool.submit(() -> {
+                       Future<Result> result2 = pool.submit(() -> {
                                refUpdateLockedRef.await();
                                gc.packRefs();
                                packRefsDone.await();
                                return null;
                        });
+                       assertNull(result2.get());
 
                        assertSame(result.get(), Result.FORCED);
 
index 9025e0a6d3ea4785c4acb44cc83bc95cdc0c8e6e..abf6c9dc0b4ad54bdc7262c42902753ece0b65b0 100644 (file)
@@ -42,7 +42,7 @@ java_package_configuration(
         "-Xep:FragmentInjection:WARN",
         "-Xep:FragmentNotInstantiable:WARN",
         "-Xep:FunctionalInterfaceClash:WARN",
-        "-Xep:FutureReturnValueIgnored:WARN",
+        "-Xep:FutureReturnValueIgnored:ERROR",
         "-Xep:GetClassOnEnum:WARN",
         "-Xep:ImmutableAnnotationChecker:WARN",
         "-Xep:ImmutableEnumChecker:WARN",