summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2024-04-29 02:16:23 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2024-04-29 15:20:43 +0200
commita82cc38a981bececf7ca732317d444e8d37a3d1b (patch)
tree83e8eb39e190d972e3efbf313df0ee65d0e4243b
parentcfe948ac7022510f47e22ee3c9d2f4ae3681b55c (diff)
downloadjgit-a82cc38a981bececf7ca732317d444e8d37a3d1b.tar.gz
jgit-a82cc38a981bececf7ca732317d444e8d37a3d1b.zip
[errorprone] Fix pattern ModifiedButNotUsed
See https://errorprone.info/bugpattern/ModifiedButNotUsed Change-Id: I3bd3f865d50a26af6c594391de5adf35230c984f
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java2
-rw-r--r--tools/BUILD2
3 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java
index a270ca8861..b8b9cbe558 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java
@@ -296,6 +296,7 @@ public class BlockListTest {
public void testAddRejectsBadIndexes() {
BlockList<Integer> list = new BlockList<>(4);
list.add(Integer.valueOf(41));
+ assertEquals(Integer.valueOf(41), list.get(0));
try {
list.add(-1, Integer.valueOf(42));
@@ -316,6 +317,7 @@ public class BlockListTest {
public void testRemoveRejectsBadIndexes() {
BlockList<Integer> list = new BlockList<>(4);
list.add(Integer.valueOf(41));
+ assertEquals(Integer.valueOf(41), list.get(0));
try {
list.remove(-1);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java
index 627417d462..a8077fdb0c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java
@@ -268,6 +268,7 @@ public class RefMapTest {
assertFalse(itr.hasNext());
}
+ @SuppressWarnings("ModifiedButNotUsed")
@Test
public void testPut_KeyMustMatchName_NoPrefix() {
final Ref refA = newRef("refs/heads/A", ID_ONE);
@@ -280,6 +281,7 @@ public class RefMapTest {
}
}
+ @SuppressWarnings("ModifiedButNotUsed")
@Test
public void testPut_KeyMustMatchName_WithPrefix() {
final Ref refA = newRef("refs/heads/A", ID_ONE);
diff --git a/tools/BUILD b/tools/BUILD
index 17ff5afb5d..2ad281e64a 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -270,7 +270,7 @@ java_package_configuration(
"-Xep:MixedDescriptors:ERROR",
"-Xep:MixedMutabilityReturnType:WARN",
"-Xep:MockitoUsage:ERROR",
- "-Xep:ModifiedButNotUsed:WARN",
+ "-Xep:ModifiedButNotUsed:ERROR",
"-Xep:ModifyCollectionInEnhancedForLoop:ERROR",
"-Xep:ModifyingCollectionWithItself:ERROR",
"-Xep:ModifySourceCollectionInStream:ERROR",