This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push:
new fccb6fc0c Don't initialize an instance variable to its default value
fccb6fc0c is described below
commit fccb6fc0ce31010a825fd25c60412e55522225c4
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Oct 27 09:40:12 2023 -0400
Don't initialize an instance variable to its default value
---
src/conf/checkstyle.xml | 1 +
.../bloomfilter/CountingLongPredicate.java | 2 +-
.../collections4/bloomfilter/IndexProducer.java | 2 +-
.../commons/collections4/ClosureUtilsTest.java | 4 ++--
.../commons/collections4/CollectionUtilsTest.java | 26 +++++++++++-----------
.../commons/collections4/FactoryUtilsTest.java | 2 +-
.../commons/collections4/FluentIterableTest.java | 10 ++++-----
.../commons/collections4/IterableUtilsTest.java | 6 ++---
.../commons/collections4/IteratorUtilsTest.java | 8 +++----
.../AbstractOrderedBidiMapDecoratorTest.java | 2 +-
.../iterators/CollatingIteratorTest.java | 8 +++----
.../iterators/FilterListIteratorTest.java | 24 ++++++++++----------
.../collections4/iterators/IteratorChainTest.java | 6 ++---
.../iterators/LazyIteratorChainTest.java | 6 ++---
.../iterators/ListIteratorWrapper2Test.java | 2 +-
.../iterators/ListIteratorWrapperTest.java | 2 +-
.../iterators/ObjectGraphIteratorTest.java | 8 +++----
.../iterators/UniqueFilterIteratorTest.java | 2 +-
.../iterators/ZippingIteratorTest.java | 6 ++---
.../set/UnmodifiableNavigableSetTest.java | 4 ++--
.../set/UnmodifiableSortedSetTest.java | 4 ++--
21 files changed, 68 insertions(+), 67 deletions(-)
diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index e0edda7eb..eb410f1f7 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -42,6 +42,7 @@ limitations under the License.
<property name="headerFile" value="${checkstyle.header.file}"/>
</module>
<module name="TreeWalker">
+ <module name="ExplicitInitializationCheck" />
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
diff --git
a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java
b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java
index c03a21900..83d4c1a8c 100644
---
a/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java
+++
b/src/main/java/org/apache/commons/collections4/bloomfilter/CountingLongPredicate.java
@@ -25,7 +25,7 @@ import java.util.function.LongPredicate;
* execute the @code{text} with a zero value for each remaining @{code idx}
value.
*/
class CountingLongPredicate implements LongPredicate {
- private int idx = 0;
+ private int idx;
private final long[] ary;
private final LongBiPredicate func;
diff --git
a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexProducer.java
b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexProducer.java
index dd73a423d..7c284de37 100644
---
a/src/main/java/org/apache/commons/collections4/bloomfilter/IndexProducer.java
+++
b/src/main/java/org/apache/commons/collections4/bloomfilter/IndexProducer.java
@@ -82,7 +82,7 @@ public interface IndexProducer {
Objects.requireNonNull(producer, "producer");
return consumer -> {
final LongPredicate longPredicate = new LongPredicate() {
- int wordIdx = 0;
+ int wordIdx;
@Override
public boolean test(long word) {
diff --git
a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
index f34021c34..2b4af4d7e 100644
--- a/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java
@@ -45,7 +45,7 @@ public class ClosureUtilsTest {
private static final Object cString = "Hello";
static class MockClosure<T> implements Closure<T> {
- int count = 0;
+ int count;
@Override
public void execute(final T object) {
@@ -58,7 +58,7 @@ public class ClosureUtilsTest {
}
static class MockTransformer<T> implements Transformer<T, T> {
- int count = 0;
+ int count;
@Override
public T transform(final T object) {
diff --git
a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
index f1e6a2f8e..a56252416 100644
--- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
@@ -69,54 +69,54 @@ public class CollectionUtilsTest extends MockTestCase {
/**
* Collection of {@link Integer}s
*/
- private List<Integer> collectionA = null;
+ private List<Integer> collectionA;
/**
* Collection of {@link Long}s
*/
- private List<Long> collectionB = null;
+ private List<Long> collectionB;
/**
* Collection of {@link Integer}s that are equivalent to the Longs in
* collectionB.
*/
- private Collection<Integer> collectionC = null;
+ private Collection<Integer> collectionC;
/**
* Sorted Collection of {@link Integer}s
*/
- private Collection<Integer> collectionD = null;
+ private Collection<Integer> collectionD;
/**
* Sorted Collection of {@link Integer}s
*/
- private Collection<Integer> collectionE = null;
+ private Collection<Integer> collectionE;
/**
* Collection of {@link Integer}s, bound as {@link Number}s
*/
- private Collection<Number> collectionA2 = null;
+ private Collection<Number> collectionA2;
/**
* Collection of {@link Long}s, bound as {@link Number}s
*/
- private Collection<Number> collectionB2 = null;
+ private Collection<Number> collectionB2;
/**
* Collection of {@link Integer}s (cast as {@link Number}s) that are
* equivalent to the Longs in collectionB.
*/
- private Collection<Number> collectionC2 = null;
+ private Collection<Number> collectionC2;
- private Iterable<Integer> iterableA = null;
+ private Iterable<Integer> iterableA;
- private Iterable<Long> iterableB = null;
+ private Iterable<Long> iterableB;
- private Iterable<Integer> iterableC = null;
+ private Iterable<Integer> iterableC;
- private Iterable<Number> iterableA2 = null;
+ private Iterable<Number> iterableA2;
- private Iterable<Number> iterableB2 = null;
+ private Iterable<Number> iterableB2;
private final Collection<Integer> emptyCollection = new ArrayList<>(1);
diff --git
a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
index 014852b05..3ed25c8c8 100644
--- a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
@@ -168,7 +168,7 @@ public class FactoryUtilsTest {
}
public static class Mock3 {
- private static int cCounter = 0;
+ private static int cCounter;
private final int iVal;
public Mock3() {
iVal = cCounter++;
diff --git
a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
index a405aa9ba..5f4481218 100644
--- a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
+++ b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
@@ -47,27 +47,27 @@ public class FluentIterableTest {
/**
* Iterable of {@link Integer}s
*/
- private Iterable<Integer> iterableA = null;
+ private Iterable<Integer> iterableA;
/**
* Iterable of {@link Long}s
*/
- private Iterable<Long> iterableB = null;
+ private Iterable<Long> iterableB;
/**
* Collection of even {@link Integer}s
*/
- private Iterable<Integer> iterableEven = null;
+ private Iterable<Integer> iterableEven;
/**
* Collection of odd {@link Integer}s
*/
- private Iterable<Integer> iterableOdd = null;
+ private Iterable<Integer> iterableOdd;
/**
* An empty Iterable.
*/
- private Iterable<Integer> emptyIterable = null;
+ private Iterable<Integer> emptyIterable;
@BeforeEach
public void setUp() {
diff --git
a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
index 4a844b36f..028121ab4 100644
--- a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
@@ -50,17 +50,17 @@ public class IterableUtilsTest {
/**
* Iterable of {@link Integer}s
*/
- private Iterable<Integer> iterableA = null;
+ private Iterable<Integer> iterableA;
/**
* Iterable of {@link Long}s
*/
- private Iterable<Long> iterableB = null;
+ private Iterable<Long> iterableB;
/**
* An empty Iterable.
*/
- private Iterable<Integer> emptyIterable = null;
+ private Iterable<Integer> emptyIterable;
@BeforeEach
public void setUp() {
diff --git
a/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
b/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
index fca963a1d..aafbacaf1 100644
--- a/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
@@ -70,21 +70,21 @@ public class IteratorUtilsTest {
/**
* Collection of {@link Integer}s
*/
- private List<Integer> collectionA = null;
+ private List<Integer> collectionA;
/**
* Collection of even {@link Integer}s
*/
- private List<Integer> collectionEven = null;
+ private List<Integer> collectionEven;
/**
* Collection of odd {@link Integer}s
*/
- private List<Integer> collectionOdd = null;
+ private List<Integer> collectionOdd;
private final Collection<Integer> emptyCollection = new ArrayList<>(1);
- private Iterable<Integer> iterableA = null;
+ private Iterable<Integer> iterableA;
/**
* Creates a NodeList containing the specified nodes.
diff --git
a/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java
b/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java
index 48048b134..644b42f0c 100644
---
a/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java
+++
b/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecoratorTest.java
@@ -67,7 +67,7 @@ public class AbstractOrderedBidiMapDecoratorTest<K, V>
*/
private static final class TestOrderedBidiMap<K, V> extends
AbstractOrderedBidiMapDecorator<K, V> {
- private TestOrderedBidiMap<V, K> inverse = null;
+ private TestOrderedBidiMap<V, K> inverse;
TestOrderedBidiMap() {
super(new DualTreeBidiMap<>());
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java
b/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java
index a1a112830..bfc30467e 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/CollatingIteratorTest.java
@@ -45,10 +45,10 @@ public class CollatingIteratorTest extends
AbstractIteratorTest<Integer> {
//--------------------------------------------------------------- Lifecycle
- private Comparator<Integer> comparator = null;
- private ArrayList<Integer> evens = null;
- private ArrayList<Integer> odds = null;
- private ArrayList<Integer> fib = null;
+ private Comparator<Integer> comparator;
+ private ArrayList<Integer> evens;
+ private ArrayList<Integer> odds;
+ private ArrayList<Integer> fib;
@BeforeEach
public void setUp() throws Exception {
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java
b/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java
index 9ac73be84..7181bf4b3 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java
@@ -39,18 +39,18 @@ import org.junit.jupiter.api.Test;
@SuppressWarnings("boxing")
public class FilterListIteratorTest {
- private ArrayList<Integer> list = null;
- private ArrayList<Integer> odds = null;
- private ArrayList<Integer> evens = null;
- private ArrayList<Integer> threes = null;
- private ArrayList<Integer> fours = null;
- private ArrayList<Integer> sixes = null;
- private Predicate<Integer> truePred = null;
- private Predicate<Integer> falsePred = null;
- private Predicate<Integer> evenPred = null;
- private Predicate<Integer> oddPred = null;
- private Predicate<Integer> threePred = null;
- private Predicate<Integer> fourPred = null;
+ private ArrayList<Integer> list;
+ private ArrayList<Integer> odds;
+ private ArrayList<Integer> evens;
+ private ArrayList<Integer> threes;
+ private ArrayList<Integer> fours;
+ private ArrayList<Integer> sixes;
+ private Predicate<Integer> truePred;
+ private Predicate<Integer> falsePred;
+ private Predicate<Integer> evenPred;
+ private Predicate<Integer> oddPred;
+ private Predicate<Integer> threePred;
+ private Predicate<Integer> fourPred;
private final Random random = new Random();
@BeforeEach
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/IteratorChainTest.java
b/src/test/java/org/apache/commons/collections4/iterators/IteratorChainTest.java
index 3f1e42a85..88e33542b 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/IteratorChainTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/IteratorChainTest.java
@@ -41,9 +41,9 @@ public class IteratorChainTest extends
AbstractIteratorTest<String> {
"One", "Two", "Three", "Four", "Five", "Six"
};
- protected List<String> list1 = null;
- protected List<String> list2 = null;
- protected List<String> list3 = null;
+ protected List<String> list1;
+ protected List<String> list2;
+ protected List<String> list3;
public IteratorChainTest() {
super(IteratorChainTest.class.getSimpleName());
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/LazyIteratorChainTest.java
b/src/test/java/org/apache/commons/collections4/iterators/LazyIteratorChainTest.java
index ff1a8e454..1f97d27f0 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/LazyIteratorChainTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/LazyIteratorChainTest.java
@@ -41,9 +41,9 @@ public class LazyIteratorChainTest extends
AbstractIteratorTest<String> {
"One", "Two", "Three", "Four", "Five", "Six"
};
- protected List<String> list1 = null;
- protected List<String> list2 = null;
- protected List<String> list3 = null;
+ protected List<String> list1;
+ protected List<String> list2;
+ protected List<String> list3;
public LazyIteratorChainTest() {
super(LazyIteratorChainTest.class.getSimpleName());
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapper2Test.java
b/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapper2Test.java
index c93124645..6fd8f115c 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapper2Test.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapper2Test.java
@@ -38,7 +38,7 @@ public class ListIteratorWrapper2Test<E> extends
AbstractIteratorTest<E> {
"One", "Two", "Three", "Four", "Five", "Six"
};
- protected List<E> list1 = null;
+ protected List<E> list1;
public ListIteratorWrapper2Test() {
super(ListIteratorWrapper2Test.class.getSimpleName());
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapperTest.java
b/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapperTest.java
index 97c5a589e..2d41458fe 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapperTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapperTest.java
@@ -39,7 +39,7 @@ public class ListIteratorWrapperTest<E> extends
AbstractIteratorTest<E> {
"One", "Two", "Three", "Four", "Five", "Six"
};
- protected List<E> list1 = null;
+ protected List<E> list1;
public ListIteratorWrapperTest() {
super(ListIteratorWrapperTest.class.getSimpleName());
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/ObjectGraphIteratorTest.java
b/src/test/java/org/apache/commons/collections4/iterators/ObjectGraphIteratorTest.java
index b01021b96..7befde8a5 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/ObjectGraphIteratorTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/ObjectGraphIteratorTest.java
@@ -39,10 +39,10 @@ public class ObjectGraphIteratorTest extends
AbstractIteratorTest<Object> {
protected String[] testArray = { "One", "Two", "Three", "Four", "Five",
"Six" };
- protected List<String> list1 = null;
- protected List<String> list2 = null;
- protected List<String> list3 = null;
- protected List<Iterator<String>> iteratorList = null;
+ protected List<String> list1;
+ protected List<String> list2;
+ protected List<String> list3;
+ protected List<Iterator<String>> iteratorList;
public ObjectGraphIteratorTest() {
super(ObjectGraphIteratorTest.class.getSimpleName());
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/UniqueFilterIteratorTest.java
b/src/test/java/org/apache/commons/collections4/iterators/UniqueFilterIteratorTest.java
index a5e2180ae..9ae28ca38 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/UniqueFilterIteratorTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/UniqueFilterIteratorTest.java
@@ -36,7 +36,7 @@ public class UniqueFilterIteratorTest<E> extends
AbstractIteratorTest<E> {
"One", "Two", "Three", "Four", "Five", "Six"
};
- protected List<E> list1 = null;
+ protected List<E> list1;
public UniqueFilterIteratorTest() {
super(UniqueFilterIteratorTest.class.getSimpleName());
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java
b/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java
index 899be2bb8..4c7e2e34b 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java
@@ -40,9 +40,9 @@ public class ZippingIteratorTest extends
AbstractIteratorTest<Integer> {
//--------------------------------------------------------------- Lifecycle
- private ArrayList<Integer> evens = null;
- private ArrayList<Integer> odds = null;
- private ArrayList<Integer> fib = null;
+ private ArrayList<Integer> evens;
+ private ArrayList<Integer> odds;
+ private ArrayList<Integer> fib;
@BeforeEach
public void setUp() throws Exception {
diff --git
a/src/test/java/org/apache/commons/collections4/set/UnmodifiableNavigableSetTest.java
b/src/test/java/org/apache/commons/collections4/set/UnmodifiableNavigableSetTest.java
index 2b5c7812a..c62802592 100644
---
a/src/test/java/org/apache/commons/collections4/set/UnmodifiableNavigableSetTest.java
+++
b/src/test/java/org/apache/commons/collections4/set/UnmodifiableNavigableSetTest.java
@@ -36,8 +36,8 @@ import org.junit.jupiter.api.Test;
* @since 4.1
*/
public class UnmodifiableNavigableSetTest<E> extends
AbstractNavigableSetTest<E> {
- protected UnmodifiableNavigableSet<E> set = null;
- protected ArrayList<E> array = null;
+ protected UnmodifiableNavigableSet<E> set;
+ protected ArrayList<E> array;
public UnmodifiableNavigableSetTest() {
super(UnmodifiableNavigableSetTest.class.getSimpleName());
diff --git
a/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java
b/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java
index 258e21097..574cb4292 100644
---
a/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java
+++
b/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java
@@ -37,8 +37,8 @@ import org.junit.jupiter.api.Test;
* @since 3.0
*/
public class UnmodifiableSortedSetTest<E> extends AbstractSortedSetTest<E> {
- protected UnmodifiableSortedSet<E> set = null;
- protected ArrayList<E> array = null;
+ protected UnmodifiableSortedSet<E> set;
+ protected ArrayList<E> array;
public UnmodifiableSortedSetTest() {
super(UnmodifiableSortedSetTest.class.getSimpleName());